opencv 读取摄像头数据
程序员文章站
2022-07-13 13:54:20
...
opencv 读取摄像头数据代码:
package openvc; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.highgui.HighGui; import org.opencv.videoio.VideoCapture; public class ShowCameraMain { public static void main(String[] args) { try { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); VideoCapture vc = new VideoCapture(0); HighGui.namedWindow("video"); Mat pic = new Mat(); while (true) { vc.read(pic); if (pic.empty()) { break; } HighGui.imshow("video", pic); HighGui.waitKey(30); } } catch (Exception e) { e.printStackTrace(); } } }
备注: 环境搭建参考其他文章
上一篇: 心情很烦
下一篇: springmvc源码解析