-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCameraTest.java
More file actions
55 lines (49 loc) · 1.84 KB
/
CameraTest.java
File metadata and controls
55 lines (49 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* Tests to see if the camera works with JRPiCam
*
* @JackEastman
* @5/23/19
*/
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
import java.util.*;
import com.hopding.jrpicam.RPiCamera;
import com.hopding.jrpicam.enums.AWB;
import com.hopding.jrpicam.enums.DRC;
import com.hopding.jrpicam.enums.Encoding;
import com.hopding.jrpicam.enums.Exposure;
import com.hopding.jrpicam.enums.ImageEffect;
import com.hopding.jrpicam.enums.MeteringMode;
import com.hopding.jrpicam.exceptions.FailedToRunRaspistillException;
public class CameraTest
{
//Creates a camera object variable as a field
public static RPiCamera piCam;
public static void main(String[] args)
{
try {
piCam = new RPiCamera("/home/pi/Pictures");
} catch (FailedToRunRaspistillException e) {
e.printStackTrace();
}
piCam.setWidth(800).setHeight(600); // Set Camera to produce 800 by 600 images.
piCam.setBrightness(50); // Adjust Camera's brightness setting.
piCam.setExposure(Exposure.AUTO); // Camera exposure
piCam.setTimeout(2); // Camera timeout delay
piCam.setAddRawBayer(true); // Add Raw Bayer data to images
// resets Camera settings
piCam.setToDefaults();
piCam.setWidth(800).setHeight(600); // Set Camera to produce 800 by 600 images.
try {
piCam.takeStill("Picture1");
} catch (IOException e) { //Catches exception if Raspistill is not installed
e.printStackTrace();
} catch (InterruptedException e) { //Catches exception if
e.printStackTrace();
}
//BufferedImage image = piCam.takeBufferedStill(); //used for creating buffered images in raspberry pi
}
}