Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

finding the highest / lowest contours in a ROI

$
0
0
I am developing an app that searches for contours within a region of interest. I only want to display the top and bottom contours. I have managed to find the contours but i only want to display the highest and lowest contours. I have made a for loop that loops through the contours but i am unsure how to progress.. anyone got any ideas? Thankyou in advance RoiMat= image.submat(rect.y, rect.y + rect.height, rect.x, rect.x + rect.width); Imgproc.cvtColor(RoiMat, RoiMat, Imgproc.COLOR_RGB2GRAY); equalizeHist(RoiMat, RoiMat); Imgproc.GaussianBlur(RoiMat, RoiMat, new Size(5, 5), 0); Imgproc.threshold(RoiMat, RoiMat, 100, 255, Imgproc.THRESH_BINARY_INV); List contours = new ArrayList(); Mat hierarchy = new Mat(); Imgproc.findContours(RoiMat, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE); for (int contourIdx = 0; contourIdx < contours.size(); contourIdx++) { //search for the highest and lowest contours here and output as points. Mat contour = contours.get(idx); }

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>