0
\$\begingroup\$

I am trying to use ImageMagick to correct an image from the lens of a GoPro Hero3+ Black camera. I see here that ImageMagick has both instructions and code parameters here for a GoPro Hero 3 but these settings are based on the Hero 3 do not match my 12 MP Hero3+ Black GoPro camera.

I see from this web posting that there are some parameters for a Hero 3 Black but they do not have the desired results that I would expect. I assume the CMOS or the lens is different between the Hero3 Black and the Hero3+ Black cameras (or the parameters are just wrong).

Here is the original image I am trying to remove the fish-eye effect from: enter image description here

Here is the output from using the wide angle parameters from the first link (left, first image) and from the Hero 3 Black website (right, second image)

magick GoPro.JPG -distort barrel "0.06335 -0.18432 0.13009" out2.png

magick GoPro.JPG -distort barrel "0.010 -0.32 0" out.png

enter image description hereenter image description here

Clearly the parameters are not correct. Does anyone know the correct parameters for imagemagick distort barrel for a GoPro Hero3+ Black camera lens? I am hoping to avoid having to calculate those parameters myself.

\$\endgroup\$
2
  • \$\begingroup\$ When you try the ImageMagick parameters from your first link, what results do you get? \$\endgroup\$ May 23 at 22:41
  • \$\begingroup\$ @Saaru Lindestøkke - I have updated my post in response to your question. \$\endgroup\$
    – GBG
    May 24 at 14:28

1 Answer 1

3
\$\begingroup\$

The ImageMagick page on lens correction has a section on parameter sets. There it links to LensFun:

When PTlens's database became encrypted, the authors of Hugin tried to establish a free XML coded lens database as an alternative. This database is called LensFun and can be downloaded. It comes with a complete programming interface, but all you basically need is the information for your camera in the XML file.

The GoPro Hero 3+ black is on the supported camera list of LensFun version 0.3.3, so that means the parameters should be available for that camera.

In the Github repository of LensFun you can actually inspect the actioncams.xml file and see the parameters for your GoPro:

<lens>
    <maker>GoPro</maker>
    <model>GoPro Hero3+ black &amp; compatibles</model>
    <model lang="en">fixed lens</model>
    <model lang="de">festes Objektiv</model>
    <mount>goProHero3+</mount>
    <cropfactor>5.42</cropfactor>
    <aspect-ratio>4:3</aspect-ratio>
    <calibration>
        <distortion model="ptlens" focal="15" a="0.01049" b="0.01663" c="-0.40901"/>
    </calibration>
</lens>

Plugging in those a, b and c values into ImageMagick gives a good result (compared to your other attempts):

magick .\gopro-image.jpg -distort barrel "0.01049 0.01663 -0.40901" out.png

Distortion corrected image using magick and lensfun parameters for gopro hero 3+ black

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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