The forum will not let me upload an XML file or any file big enough to store the raw image. Only the sixth (starting from zero) contour does not have duplicates.Īny help in figuring this out appreciated.įor the purposes of the forum, I am including a copy of the code. This code indicates that 10 contours are detected, 9 of which have duplicates. Here is a link to the code and an XML file with the raw image. Now my question: Other than Gaussian blur and deleting contours that have duplicate points entirely, is there any other approach to minimizing the number of contours that have duplicate points and/or addressing them? Questions have been asked about this in the past, including by me. Though improved, even with Gaussian blur, a significant percentage of the contours have duplicates. GaussianBlur(tImageUnMap,tImageUnMap,cv::Size(5,5),1.5) Īdding Gaussian blur helps some but results in a 50% performance hit. I have also added a Gaussian blur such as: The contour difference is solely due to contours appearing twice.Īfter doing Canny on the image, I get the contours using:įindContours(MaskFrame, Contours, Hierarchy, RETR_EXTERNAL, CHAIN_APPROX_NONE) Because they are not right next to each other, you cannot simply delete them and preserve the contour.įor example, in the following images, the same item is imaged and in each there is a single contour. The problem is that findContours intermittently returns duplicate contour points where the same point may be in the contour list multiple times (though not right next to each other). My question relates to findContours returning duplicates. I am using OpenCV 4.5.0 on a Win10 system with Visual Studio 2019 C++.
0 Comments
Leave a Reply. |