0

I know how to draw a rectangle in opencv. But can I choose the length and breadth to be in centi meters?

curio17
  • 660
  • 1
  • 6
  • 15
  • On-screen centimetres? There is no way I am aware of doing it in OpenCV, but if you are on Windows, [this seems to work](http://stackoverflow.com/a/26539115/1270789). – Ken Y-N Feb 21 '17 at 03:02

1 Answers1

0

Its dependent on the pixel-distance ratio. You can measure this by taking an image of a meter-stick and and measuring its pixel width (for this example say its 1000px). The ratio of pixels to distance is 1000px/100cm, or 10. You can now use this constant as a multiplier, so for a given length and width in cm., you will just multiply by the ratio, and can get a pixel height and width, which can be passed into opencv's draw rectangle function.

sgk525
  • 132
  • 2
  • 13