Home > database >  How to convert the radius from meter to pixel?
How to convert the radius from meter to pixel?

Time:02-02

I have a camera with these specs:

  • full resolution 1280x1024
  • pixel size 0.0048mm
  • focal length 8 mm

I need to detect a ball in this image. It is 4 meters away and its radius is 0.0373 meter.

How to convert the radius to from meter to pixel in this case?

the reason is that I need to use cv2.HoughCircles() and need to have the value for this function.

CodePudding user response:

Pinhole camera model.

  • Focal length (mm): 8 mm
  • Sensor pixel pitch: 4.8 µm/px
  • Focal length (px): 8 mm / (4.8 µm/px) = 1667 px =: f

Object:

  • Width: 0.0373 m
  • Distance: 4 m

Projection of object (px): (0.0373 m / 4 m) * f = 15.5 px

So that ball will appear to be 15.5 pixels in size.

  • Related