Why I'm getting The method rectangle(Mat, Point, Point, Scalar) is undefined for the type Core in openCV 3?

asked 2015-05-17 02:51:22 -0500

tsvetanakos gravatar image

I'm trying to follow THIS simple JAVA tutorial that detects a face and draws a rectangle, but at this line of code:

Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height),new Scalar(0, 255, 0));

I'm getting the following error:

The method rectangle(Mat, Point, Point, Scalar) is undefined for the type Core

I'm using openCV 3 and it seems that the rectangle method is removed, or changed, but there is no documentation.

Can someone give me a push? I know that I'm missing an extremely small point here, but I'm unable to spot it.

edit retag flag offensive close merge delete

Comments

2

with 3.0, - all drawing functions are in Imgproc now.

there's a couple more changes, - highgui removed, imgcodecs, videoio added, when in doubt, consult docs

also, your link seems to refer to 2.4 code, rather use the proper 3.0 version

berak gravatar imageberak ( 2015-05-17 03:06:40 -0500 )edit
1

Thanks! I fixed it using Imgproc.rectangle() I already replaced highgui with imgcodecs I love this library! I'm going ahead to test the video face recognition. :)

tsvetanakos gravatar imagetsvetanakos ( 2015-05-17 03:29:41 -0500 )edit

did you mean face detection ? (like in the example?)

to access the actual face recognitioncode, you would additionally need https://github.com/Itseez/opencv_contrib

berak gravatar imageberak ( 2015-05-17 03:32:30 -0500 )edit