Width dissecting with a line on masked image

asked 2018-01-25 21:38:22 -0500

hw_gn gravatar image

Dear all,

I am currently working with OpenCV 3.2.0 on Python.

Suppose I have a colored object that is centered against a white backdrop, and that I've filtered it to produce a B&W image, I wish to retrieve information on the respective length of the two sides of the object as well as the width (in pixels) of the object in the image.

Example: image description

As above, the object is white in colour.

May I know the general approach I should adopt in solving this?

Thank you!

edit retag flag offensive close merge delete

Comments

To calculate the length of 2 sides, after pre-processing, you can use canny edge ur picture. Then, find contours. I think you can only find 2 contours matching 2 sides. To calculate the width. you must find distance between of 2 above contours.

hoang anh tuan gravatar imagehoang anh tuan ( 2018-01-26 01:24:58 -0500 )edit

To calculate the length of 2 sides, after pre-processing, you can use canny edge ur picture. Then, find contours. I think you can only find 2 contours matching 2 sides. To calculate the width, you must find distance between of 2 above contours.

hoang anh tuan gravatar imagehoang anh tuan ( 2018-01-26 01:25:10 -0500 )edit

I think you can find your answer in python tutorials and specifically this one

LBerger gravatar imageLBerger ( 2018-01-26 01:38:16 -0500 )edit