/**
* Opens a new camera using openCV at a certain device index with
* a given frame width and height, and a compression quality.
*
* @param cam the device index from 0.
* @param width the frame width
* @param height the frame height
* @param quality the compression quality
*
* @throws RuntimeException if the camera could not be opened
*/
public CvCamera(int cam, int width, int height, int quality){
capture = new VideoCapture();
capture.open(cam);
if(!capture.isOpened())
throw new RuntimeException("Unable to open camera " + cam);
image = new Mat();
buffer = new MatOfByte();
compressParams = new MatOfInt(Imgcodecs.CV_IMWRITE_JPEG_QUALITY, quality);
capture.set(Videoio.CAP_PROP_FRAME_WIDTH, width);
capture.set(Videoio.CAP_PROP_FRAME_HEIGHT, height);
camIndex = cam;
this.quality = quality;
}
CvCamera.java 文件源码
java
阅读 78
收藏 0
点赞 0
评论 0
项目:FlashLib
作者:
评论列表
文章目录