1

I know how to convert a fisheye image to equirectangular, to view it inside a 3D VR viewer as a "panorama":

ffmpeg -i input.jpg -vf v360:fisheye:equirectangular:ih_fov=180:iv_fov=180:pitch=0 -y output.jpg
  • -i input file
  • -vf video filter
    • v360: VR360 panorama conversion
      • fisheye: source format
      • equirectangular: destination format
      • ih_fov: input horizontal FOV
      • iv_fov: input verticalFOV
      • pitch: camera up/down orientation
    • -y Overwrite
    • Output file

Instead I would like to "rectify" the Ingenuity fisheye image, as if it was shot with a standard camera; I know about lensfun and lenscorrection parameters , but I don't undrestand which parameters I should use.

Cameras official data:

Navigation (NAV) Camera has a field-of-view (FOV) of 133 deg (horizontal) by 100 deg (vertical) with an average Instantaneous Field-of-view (IFOV) of 3.6 mRad/pixel

Return-to-Earth (RTE) Camera has a FOV of 47 deg (horizontal) by 47 deg (vertical) with an average IFOV of 0.26 mRad/pixel.

The NAV camera is pointed directly towards nadir, and the RTE camera is pointed approximately 22 deg below the horizon, resulting in an overlap region between the two camera image footprints of approximately 30 deg × 47 deg.

Source: https://rotorcraft.arc.nasa.gov/Publications/files/Balaram_AIAA2018_0023.pdf

Full FFMPEG documentation: link

Ingenuity raw images: https://mars.nasa.gov/mars2020/multimedia/raw-images/index.cfm?af=REAR_HAZCAM_RIGHT

2
3

FFmpeg is not the most appropriate tool to use for lens correction of still images. While it may work, it is not really meant to be used that way. Since you are already aware of the documentation, it's a matter of reading and applying it.

  • lensfun: The lens has to be in the lensfun database. NASA equipment is not typically available to the general public, so they are unlikely to be added to the database.

  • lenscorrection: You need to calculate k1 and k2, based on this equation:

    r_src = r_tgt * (1 + k1 * (r_tgt / r_0)^2 + k2 * (r_tgt / r_0)^4)
    

    Other parameters, like cx and cy, can be assumed. There is an OpenCV camera calibration example that calculates the parameters from photos of recognized targets (eg, chessboard pattern). Then you would plug the values into the command:

    ffmpeg -i in-file -vf "lenscorrection=cx=0.5:cy=0.5:k1=[]:k2=[]" out-file
    

    Unless NASA has taken and released calibration images, this approach is unlikely to work.

    See also:

Other tools to consider:

  • Hugin: Can calculate and apply lens correction parameters. Cannot be used to find k1 and k2 because it uses a different lens correction model. Will apply generic corrections that may be good enough if lens specifications are known (or guessed).

  • Photoshop: Adaptive Wide Angle Filter

  • RawTherapee, and other raw processing applications: Usually include a distortion correction tool with parameters you can tweak for a good-enough approximation.


Note: Some images released by NASA may already be corrected for distortion.

NASA image

2
  • Interesting, but unfortunately not helping so much.
    – jumpjack
    Jul 23 '21 at 6:43
  • You need k1, k2 parameters. To compute them, you need calibration images. Since people outside of NASA usually don't have access to their equipment, you should contact NASA for further assistance.
    – xiota
    Jul 23 '21 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.