I got it:
Imgproc.drawContours(resultImage, contours, -1, new Scalar(255,0,0), 1, 8, hierarchy, 1, new Point(x,y));
It is able to add the offset by using the "Point-Class"
문제
On Android by using OpenCV I try to draw contours I got from a ROI but I am not able to draw them at the correct place at the image.
Mat resultImage= ...; // source
Rect roi = new Rect(x, y, widht, height);
Mat mat = new Mat(resultImage, roi);
Imgproc.adaptiveThreshold(mat, mat, 255, Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY_INV, 15, 4);
mat.convertTo(mat, CvType.CV_32SC1);
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Mat hierarchy = new Mat();
Imgproc.findContours(mat, contours, hierarchy, Imgproc.RETR_FLOODFILL, Imgproc.CHAIN_APPROX_SIMPLE);
mat.release();
Imgproc.drawContours(resultImage, contours, -1, new Scalar(255,0,0), 1);
It draws the contours on the left top corner. But I need it at "x","y" where the ROI is from.
Is there a way to add a offset to any contour?
해결책
I got it:
Imgproc.drawContours(resultImage, contours, -1, new Scalar(255,0,0), 1, 8, hierarchy, 1, new Point(x,y));
It is able to add the offset by using the "Point-Class"