- 下载javacv-1.2-bin.zip https://github.com/bytedeco/javacv
- 解压
- 在Eclipse项目 Referenced Libraries 中 Add External JARs...
- javacv.jar
- javacpp.jar
- opencv.jar
以下为简单示例程序:
import static org.bytedeco.javacpp.opencv_imgcodecs.IMREAD_COLOR;
import static org.bytedeco.javacpp.opencv_imgcodecs.imread; import org.bytedeco.javacpp.opencv_core.Mat; public class FirstTest { public static void main(String[] args) {
Mat image = imread("TEST.JPG", IMREAD_COLOR);
System.out.println("图像宽x高:" + image.cols() + " x " + image.rows());
} }