Extracting features with unclean canny detection
Hi Guys!
I performed a canny edge detection on an object and playing with the thresholds, I got the following output: Click here
The topmost rectangle is part of the part which I wish to ignore
The bottom two rectangles are the features I wish to outline in my original image. I know that it maybe possible to use HoughTransform to find the rectangles but I hoping to find a more generic method as my feature may not be of a fixed shape (perhaps using approxPolyDP?).
I'm not sure if it's possible but is it possible to: 1. extract the contours of the image 2. join lines that are close to one another 3. if the lines form a closed loop -> box the object if it's just stray lines, ignore.
If it is, can anyone give me the rough outline of how to do it? If it's not, do you guys have any other suggestions?
Thanks in advance!
It would be good if you share your actual image or other similar image before coming into conclusion.
I don't have it with me now but it's a very polished surface similar to this :https://img1.etsystatic.com/042/0/6723474/il_340x270.621018835_tj4e.jpg
It would be similar to trying to box the raised portion in the middle of the button. Hope it helps! :)