Java OpenCV - org.opencv.core.Core rectangle() met

2019-03-15 04:35发布

问题:

I have openCV-3.0.0 alpha and I found a sample code on the openCV tutorials website. I used to same code and compiled it, but eclipse tells me that the rectangle() method in the org.opencv.core.Core class cannot be found. I checked the class myself and indeed could not find this method. Does anyone know in which class this method is now stored in? I found a similar problem with the org.opencv.highgui.Highgui class which was discontinued in the openCV-3.0.0 and replaced by org.opencv.imgcodecs.Imgcodecs

回答1:

it is found in org.opencv.imgproc.Imgproc package, e.g.

Imgproc.rectangle(webcam_img, null, null, null);


回答2:

in OpenCV 3.0.0 you should change

import org.opencv.highgui.Highgui; to import org.opencv.imgcodecs.Imgcodecs; , Highgui.imread() to imgcodecs.imread() , Core.rectangle() to imgproc.rectangle() , Highgui.imwrite() to imgcodecs.imwrite()

take a look at this link https://fossies.org/diffs/opencv/2.4.11_vs_3.0.0-rc1/samples/java/sbt/src/main/java/DetectFaceDemo.java-diff.html