create opencv camera matrix for iPhone 5 solvepnp

后端 未结 5 1106
春和景丽
春和景丽 2021-01-31 12:35

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_

5条回答
  •  耶瑟儿~
    2021-01-31 13:08

    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.

提交回复
热议问题