Ask Your Question
0

Core.compare openCV

asked 2017-07-10 15:58:20 -0600

arqam gravatar image

updated 2017-07-10 19:39:32 -0600

berak gravatar image

As per the openCV documentation it states that Core.Compare(Mat src1, Scalar src2, Mat dst, int cmpop) Performs the per-element comparison of two arrays or an array and scalar value.

So in the above line what does comparison actually mean?

Like if we take an example with :

Mat source = new Mat(1, 1, CvType.CV_8U, new Scalar(3));
Mat mask = new Mat();
Imgproc.grabCut(srcImage,mask,rect,new Mat(),new Mat(),3,Imgproc.GC_INIT_WITH_RECT);
Core.compare(mask, source,mask, Core.CMP_EQ);

The above makes the mask to be in the visible form which can be seen as an image. So what did Core.compare actually do?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-07-11 06:16:04 -0600

KjMag gravatar image

It did what it usually does - compared mask and source objects and wrote comparison results back to mask. As a result, mask is now a matrix of 0s and 1s indicating that individual pixels were equal or different.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-07-10 15:58:20 -0600

Seen: 1,568 times

Last updated: Jul 11 '17