I have two same size images:
Mat original;
Mat changed;
from Mat changed
, I did extract contours by
Imgproc.findContours
So now I have List<MatOfPoint> contours;
My next task is to get color from each MatOfPoint
.
I can do that by applying function Scalar color = mean(contour);
But the problem is that I need to find color of exactly same pixels from MatOfPoint
but from Mat original;
I can do that with Rect
like this :
Rect rect = Imgproc.boundingRect(contour);
Mat originalImageCropped = new Mat(original, rect);
Scalar color = mean(originalImageCropped);
My qustion is how can I get color for each MatOfPoint
from Mat original
by List<MatOfPoint> contours
from Mat changed