Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9243521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:49:39+00:00 2026-06-18T08:49:39+00:00

I am developing an application for the iPhone using opencv. I have to use

  • 0

I am developing an application for the iPhone using opencv. I have to use the method solvePnPRansac:

http://opencv.willowgarage.com/documentation/cpp/camera_calibration_and_3d_reconstruction.html

For this method I need to provide a camera matrix:
__ __
| fx 0 cx |
| 0 fy cy |
|_0 0 1 _|

where cx and cy represent the center pixel positions of the image and fx and fy represent focal lengths, but that is all the documentation says. I am unsure what to provide for these focal lengths. The iPhone 5 has a focal length of 4.1 mm, but I do not think that this value is usable as is.

I checked another website:

http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html

which shows how opencv creates camera matrices. Here it states that focal lengths are measured in pixel units.

I checked another website:

http://www.velocityreviews.com/forums/t500283-focal-length-in-pixels.html

(about half way down)
it says that focal length can be converted from units of millimeters to pixels using the equation: fx = fy = focalMM * pixelDensity / 25.4;

Another Link I found states that fx = focalMM * width / (sensorSizeMM);
fy = focalMM * length / (sensorSizeMM);

I am unsure about these equations and how to properly create this matrix.

Any help, advice, or links on how to create an accurate camera matrix (especially for the iPhone 5) would be greatly appreciated,

Isaac

p.s. I think that (fx/fy) or (fy/fx) might be equal to the aspect ratio of the camera, but that might be completely wrong.

UPDATE:

Pixel coordinates to 3D line (opencv)

using this link, I can figure out how they want fx and fy to be formatted because they use it to scale angles relative to their distance from the center. therefore, fx and fy are likely in pixels/(unit length) but im still not sure what this unit length needs to be, can it be arbitrary as long as x and y are scaled to each other?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:49:40+00:00Added an answer on June 18, 2026 at 8:49 am

    You can get an initial (rough) estimate of the focal length in pixel dividing the focal length in mm by the width of a pixel of the camera’ sensor (CCD, CMOS, whatever).

    You get the former from the camera manual, or read it from the EXIF header of an image taken at full resolution. Finding out the latter is a little more complicated: you may look up on the interwebs the sensor’s spec sheet, if you know its manufacturer and model number, or you may just divide the overall width of its sensitive area by the number of pixels on the side.

    Absent other information, it’s usually safe to assume that the pixels are square (i.e. fx == fy), and that the sensor is orthogonal to the lens’s focal axis (i.e. that the term in the first row and second column of the camera matrix is zero). Also, the pixel coordinates of the principal point (cx, cy) are usually hard to estimate accurately without a carefully designed calibration rig, and an as-carefully executed calibration procedure (that’s because they are intrinsically confused with the camera translation parallel to the image plane). So it’s best to just set them equal to the geometrical geometrical center of the image, unless you know that the image has been cropped asymmetrically.

    Therefore, your simplest camera model has only one unknown parameter, the focal length f = fx = fy.

    Word of advice: in your application is usually more convenient to carry around the horizontal (or vertical) field-of-view angle, rather than the focal length in pixels. This is because the FOV is invariant to image scaling.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Developing iphone application using makkit framework. I have got the map view integrated in
I have been developing an iphone application using a domain model, and have put
I am developing Iphone application. I have used SecKeyGeneratePair method of Security/Security.h framework. I
I am using MACOS for Developing the iPhone Application. I have made the repository
I am developing an iPhone application using the PhoneGap Framework. Here I have to
I am developing iPhone application using SQLite . I decided to use fmdb .
I have developing an iPhone application using xcode 4 which is compatible with iOS
I'm developing one application for iphone using phone gap.I that I need to display
I'm currently developing a simple iPhone application using a UITabBar and table views for
I am developing an iPhone application. In my iPhone application, I am using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.