4

There are some photos captured by a fish eye camera that I no longer have access to. I am trying to remove the fish eye effect on those photos using opencv, all the solutions I have seen required taking photos of a known sized object (i.e: A chess board) and then calling cv2.calibrate() then it will return the calibration parameters to be used in cv2.undistorted() but this is not applicable. However These attributes were attached with the camera regarding the fish eye effect parameters.

<intrinsic>
        <fisheyeAmt1 format="float" value="308.8805"/>
        <fisheyeAmt2 format="float" value="-14.2861"/>
        <fisheyeAmt3 format="float" value="51.4445"/>
        <fisheyeAmt4 format="float" value="-10.362"/>
        <opt_axis_x_rot_deg format="float" value="0"/>
        <opt_axis_z1_rot_deg format="float" value="0"/>
        <opt_axis_z2_rot_deg format="float" value="0"/>
        <image_flip_x_bool format="bool" value="false"/>
        <image_flip_y_bool format="bool" value="false"/>
        <cam_aspect format="float" value="0.9999"/>
        <source_image_x_res format="float" value="1280.0"/>
        <source_image_y_res format="float" value="806.0"/>
        <cxoffs_pix format="float" value="5.35"/>
        <cyoffs_pix format="float" value="6.477"/>
      </intrinsic>
<extrinsic>
        <rot__x_deg format="float" value="68.46"/>
        <rot_z1_deg format="float" value="-89.34"/>
        <rot_z2_deg format="float" value="0.75"/>
        <pointx_mm format="float" value="4133.0"/>
        <pointy_mm format="float" value="-97.0"/>
        <pointz_mm format="float" value="919.31"/>
      </extrinsic>

My question is, is there anything in these attributes I can use as an alternative to the values returned by cv2.calibrate()?

There is another question here that addresses a similar problem. But I am not sure if the values I have can be used as fx, fy, cx, cy, k1, k2, p1, p2 that are used in the other question.

omargamal8
  • 551
  • 5
  • 12
  • Possible duplicate of [correcting fisheye distortion programmatically](https://stackoverflow.com/questions/2477774/correcting-fisheye-distortion-programmatically) – Tom Wyllie Jul 20 '17 at 16:49
  • @TomWyllie It is a pretty similar question, but the thing here is that I don't know which of these values represent the fx, fy, cx, cy, k1, k2, p1, p2. – omargamal8 Jul 20 '17 at 16:59

2 Answers2

0

If you have images containing a known textured planar surface, it is possible to perform another calibration.

Where does these attributes come from? Some of their names are not standard. Do you have EXIF information about the images mentioning the focal?

  • cxoffs_pix: cx - 1280/2
  • cyoffs_pix: cy - 806/2
  • source_image_x_res: should be close of 2*cx
  • source_image_y_res: should be close of 2*cy
  • cam_aspect: fx/fy
  • image_flip_x_bool: should indicate whether to negate fx
  • image_flip_y_bool: should indicates whether to negate fy

Could you give the values associated with the names? It could help to guess.

If you had information about the field of view it could help for fx, fy

Vincent Vidal
  • 323
  • 2
  • 11
  • These are the only information I got unfortunately. However, I'll update it to have the values with it. – omargamal8 Jul 20 '17 at 23:37
  • I also have a picture caught by the camera of long straight line on a road. Which I think might help given that it must be a straight line in the real world. @Vincent Vidal – omargamal8 Jul 21 '17 at 03:00
  • So, from the values cx = cxoffs_pix + 1280/2 and cy = cyoffs_pix + 806/2 (I edied my post). If you are very lucky, 308.8805 could be the focal in px unit (fx and fy) and fisheyeAmt2, fisheyeAmt3 and fisheyeAmt4 would be k1, k2, k3, but I cannot tell for certain. A rectangle could do the job to calibrate without distorsion (to estimate/check fx, fy, cx, cy). To get the distorsion parameters, I do not know the minimal pattern. – Vincent Vidal Jul 24 '17 at 20:30
0

One solution is to use a GUI for adjusting camera calibration parameters manually! Sample code: camcalib_gui. Another automated solution is to find edges or lines in an image that is supposed to be a straight line but curved because of the fisheye. Draw over these lines and save the points. Then solve the camera parameters as an optimization problem. Can't share this code as I did it at Ignitarium

Jerin Antony
  • 133
  • 1
  • 9
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/30997398) – Nuclear03020704 Feb 10 '22 at 16:18
  • The link is no longer valid. Do you still have the repository somewhere else or could you give me some clues? I have been trying to manually find parameters but I am struggling, especially with k1, k2, k3, k4 – dj_rydu Jul 12 '22 at 14:51
  • @dj_rydu, code is now accessible. You may implement line drawing and optimisation for finding parameters that make straight lines that became curved due to fish eye back into straight lines. Use checker/charuco itself if camera is available. – Jerin Antony Jul 30 '22 at 06:16