Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

locateRoi overwrites your arguments

locateRoi overwrites your argumentsarguments. you should rather use it like:

Size s = new Size();
Point p = new Point();
roiTmp.locateROI(s, p);

locateRoi overwrites your arguments. you should rather use it like:

Size s = new Size();
Point p = new Point();
roiTmp.locateROI(s, p);
// now, s is the size of the enclosing image,
// and p the top-left position of the roi

locateRoi overwrites your arguments. you should rather use it like:

Size s = new Size();
Point p = new Point();
roiTmp.locateROI(s, p);
// now, s is the size of the enclosing image,
// and p the top-left position of the roi

also, please be careful here:

newrectangle = Imgproc.boundingRect(points);
rectangle(roiTmp, newrectangle .tl(), newrectangle .br(), new Scalar(255, 0, 0), 1, 8, 0);

i guess, that points is a contour, if you took that on the original image (not on the roi) you have to offset your rectangle by the negative pos of the roi.