Ask Your Question
2

Conversion focal distance from mm to pixels

asked 2013-07-19 01:55:15 -0500

tenta4 gravatar image

updated 2013-07-19 03:00:40 -0500

berak gravatar image

For my calculations i need the local length in pixels(opencv format). The andriod API getFocusDistances(float[]) give me the focal length in mm. I try to convert from mm to pixels

In opencv exists the function cv::CalibrationMatrixValues that convert from pixels to mm. I want to do the inverse conversion (based on the function's source code). But i can't understand the apertureWidth and apertureHeight parameters.

Can someone help me?

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
6

answered 2013-07-20 05:46:11 -0500

Nghia gravatar image

Depending on how accurate you need the focal you can get a good quick estimate if you know either of the following:

  • CCD/CMOS sensor physical size
  • Horizontal field of view (FOV)

If you know the sensor's physical width in mm, then the focal in pixels is:

focal_pixel = (focal_mm / sensor_width_mm) * image_width_in_pixels

And if you know the horizontal field of view, say in degrees,

focal_pixel = (image_width_in_pixels * 0.5) / tan(FOV * 0.5 * PI/180)

edit flag offensive delete link more

Comments

Thank you for answer. Unfortunately the android API return the correct values of FOV not for all devices, That's why i use OpenCV autocalibration APIs, namely cv::СalibrateСamera.

tenta4 gravatar imagetenta4 ( 2013-07-24 06:12:26 -0500 )edit

I am getting different results using image sesnor size and foca length size in mm i.e focal length is 4.25mm, horizontal field of view is 85 degrees and sensor width is 6.9 mm so when I use first equation answer is 394 and the second equation gives me 293

Hemang gravatar imageHemang ( 2017-10-30 13:24:24 -0500 )edit
-2

answered 2013-07-19 03:19:34 -0500

I think that google'ing isn't that hard right? The aperture is the width of the opening before your CCD or CMOS sensor and it defines the amount of light that is entering the camera.

An ideal model makes this a point, leading to a single dot focal point. However, in real situations this aperture can be adapted to get more of less light through at a single shot. It is a camera specific setting, which is in the metadata of most images taken with decent camera equipment.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2013-07-19 01:55:15 -0500

Seen: 20,870 times

Last updated: Jul 20 '13