I want to find all points in the rectangle. But when i use findContour method in opencv, it actually finds points in the lines drawn ( Not points inside the rectangle). I verified using drawcontour method ( even if we use thickness as -1, it draws lines ).
How can i find points inside the smaller rectangle using findContour method ?
//srcMatrix create
Mat srcMat = new Mat(); srcMat.create(100, 100, CvType.8UC3);
// create a canny matrix
Mat mCanny = new Mat();
// Make it to sizeof srcMatrix and // make channel to 1 mCanny.create( srcMat.cols(), srcMat.rows, CvType.8UC1)
// clear it
mCanny.setTo(new Scalar(0));
// draw a border rectangle on the mcanny
Core.rectangle(mCanny, new Point(0,0), new Point(100, 100), new Scalar(255));
// draw a rectangle
Core.rectangle(mCanny, new Point(25,25), new Point(50, 50), new Scalar(255));
// make it binary image
Imgproc.cvtColor(mCanny , mCanny , Imgproc.COLOR_RGB2GRAY);
// make it blur
Imgproc.blur( mCanny, mCanny, new Size(3,3));
//find canny
Imgproc.Canny(mCanny ,mCanny, 2,4);
/// find Contour
List<matofpoint> contours = new ArrayList<matofpoint>(); Imgproc.findContours(mCanny, contours, new Mat(), Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);