Object measurement from photo

asked 2017-05-27 11:56:27 -0500

I need to measure object's parameters (like round radius, dismentions). I have a photo of object. I can control lightning of photo, background and other things, that depends on camera and object positioning.

I've tried to use cv2.HoughCircles for circle detection, and it worked pretty well.I need edge coordinates in format like x1,y1;x2,y2. For edge detection i've tried cv2.goodFeaturesToTrack, but it didnt work pretty well. Results were inaccurate, and some edges weren't detect at all.

If anyone have ideas what methods/solutions i can use for more accurate detection of edges coordinates , please let me know.

Thanks in advance.

edit retag flag offensive close merge delete

Comments

cv2.goodFeaturesToTrack tracks good feature not edges. Edges can be found using gradient (sobel...) you can try this sample in C++

LBerger gravatar imageLBerger ( 2017-05-28 01:59:07 -0500 )edit

Thank you for your answer! I got the idea about what i was doing wrong. Now im thinking of using cv2.findcontours to solve my problem, but i got another question. When im using cv2.findcontours, it gives me many unnecessary contours. So, i think, solution to this is applying canny edge detector or thresholding the image before passing it to the cv2.findcontours function. But when im trying to use canny with differenth low and high treshold values, i still can't get the perfect edges of object without noises. Did you know any methods to increase accuracy of edge detection? Thanks in advance!

dammitqty gravatar imagedammitqty ( 2017-05-29 13:21:14 -0500 )edit