opencv - Measuring object size using webcam -


i need calculate distance between 2 points using webcam. catch don't need way related actual measurements in cm or whatever. want use different webcams of different resolutions , should give same measurement. i'll explain.

suppose viewing square shape using webcam of 640x480 , measures 1 unit. view same object same positions using webcam of 1024x768 , should still measure 1 unit. how do this?

you didn't mentioned process measuring dimensions of object. i'm gonna assume measuring using single camera. can take method reference & can applied methodology.

here steps measure size of object:

  1. how measure length of line drawn in picture? enter image description here
  2. you need ruler reference. make ruler have know real world ruler size in pixels in our case.
  3. now make graph. i'm gonna take unit line reference graph. i'm taking centimeter scale reference.
    enter image description here

  4. place graph in front of camera & detect 2 red dots. calculate number of pixels between 2 points ref. lets assume distance 1000 pixels. 1 cm taking 1000 pixels. 1 pixel equal 0.1 cm & take reference_pixels_count.

  5. repeat step 4 resolutions & find reference_pixels_count resolution.

  6. now place object & size of image.find corners & cycle through each corner , find distance between each corner. multiply distance reference_pixels_count actual dimension of object.enter image description here

note: method can work flat object negligible depth change.


Comments

Popular posts from this blog

wordpress - .htaccess: RewriteRule: bad flag delimiters -

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -