欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

opencv 播放视频 博客分类: 计算机视觉java opencv 

程序员文章站 2024-03-16 21:59:58
...

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 ShowVidioMain {

	public static void main(String[] args) {
		try {
			System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

			VideoCapture vc = new VideoCapture("d:/workspace/dp4jTest/vtest.avi");

			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();
		}

	}

}

 

相关标签: opencv