Jump to content

Recommended Posts

Hello,

does anybody know, if there is a possibility, to use Adobe Lens Correction Profiles (*.lcp) in Affinity Photo? I use an UAV (DJI Phantom 2 Vision+) for taking pictures. Because it has a fish-eye lense, i have to correct them, before i can use them (for taking measurements). Therefore, DJI has released an Adobe Lens Correction Profiles (PHANTOM VISION FC200.lcp). In Photoshop, i can open Filter / Lens correction and choose this file, to eliminate distortion from the pictures. Is there a possibility to do it in AP, too? Maybe with an Plugin?

P.S.: See the pictures below. They show the original picture (before) and the corrected picture (after). It is very important for me, that the exact values from the Lens Correction Profile are used, because afterwards, i have to take measurements in the pictures.
        Picture-Before:       https://www.pic-upload.de/view-32675627/before.jpg.html
        Picture-Afterwards: https://www.pic-upload.de/view-32675621/after.jpg.html

Best regards
Thomas

Share this post


Link to post
Share on other sites

Hi,
 
AFAIK Photo uses different lens profiles, namely the Lensfun library here. If you look through the list of supported lenses there you will see one DJI lens entry, so there are chances that AP might use that lens database entry for it's lens autocorrection feature. BTW when you look into the lensfun GitHub project you can see these database entries here:

<camera>
        <maker>DJI</maker>
        <model>Phantom Vision FC200</model>
        <mount>dijPhantomVisionFC200</mount>
        <cropfactor>6</cropfactor>
    </camera>

    <camera>
        <maker>DJI</maker>
        <model>Phantom 3 Pro FC300X</model>
        <mount>dijPhantom3ProFC300X</mount>
        <cropfactor>5.5</cropfactor>
</camera>

However, you can also use Affinity Photo's manual lens correction panel and dial in the needed values for that lens manually. - Or you can make your own lensfun profile and add that to the used database (take a look here).

 

Hope that helps a little bit?


☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

Hello, thank you for your help. I think there is a little misunderstanding.

The Camera is recognized correctly in Affinity Phot, but i want to use the Lens Correction Profil for defishing my photo. AP just corrects the photo, but leaves it fish-eyed. In the Adobe '.lcp file, there are the exact parameters for defishing the photos.

 

Look at this video: https://youtu.be/tAAVc4-disg

Share this post


Link to post
Share on other sites

Ok I see, but if your cam/lens combination is recognized by that lensfun library which AP uses, then there maybe are also some lens profil data entries according to distortion corrections inside that. I mean things like these here from the GitHub project, though these entries here look much fewer than what the Adobe .lcp files in your video do contain as data:

<lens>
        <maker>DJI</maker>
        <model>Phantom Vision FC200 & compatibles</model>
        <model lang="en">fixed lens</model>
        <model lang="de">festes Objektiv</model>
        <mount>dijPhantomVisionFC200</mount>
        <cropfactor>6</cropfactor>
        <type>equisolid</type>
        <aspect-ratio>4:3</aspect-ratio>
        <calibration>
            <distortion model="ptlens" focal="5" a="0.02707" b="-0.10021" c="-0.09787" />
            <tca model="poly3" focal="5" vr="1.0002" vb="1.0007" />
        </calibration>
</lens>

BTW I've seen that this GitHub lensfun project also contains an entry for an Python3 app named lensfun-convert-lcp, which seems to allow to convert Adobe LCP files and their content to one Lensfun XML file, see here ...

 

 

This program reads Adobe LCP files and converts their content to one Lensfun XML file. It was tested against the LCP files shipped with “Adobe DNG Converter 9.0” although it should work with other sets of LCP files, too.  

This program assumes that one LCP file contains the data of exactly one lens.

...

 

However I don't know how much distortion information is used here from a .lcp file for those lensfun XML profiles. But maybe you can use that Python3 script in order to convert your "PHANTOM VISION FC200.lcp" into a better working lensfun XML profile file for AP.  Meaning you can give it a try, or ask in some drones forum etc. if somebody maybe already tried to do so and with what results, since that lensfun database is also used by other software than AP for performing lens corrections!

 

NOTE: that the above are just some points/hints to software related informations about that stuff, you must see yourself if it is of any help for you or not.


☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

Yes, I knew this converter "lensfun-convert-lcp". The problem is, that i tried about two hours, to run the script after installing Python 3.6 in Windows 10 Pro. No success. Afterwards i tried to install the Python packacke on my Synology NAS and to run it from there. No success.
I even tried the online service here: https://repl.it/languages/python3 - No success.

 

I started the script, typing in the following command:

python lensfun-convert-lcp.py --output test.xml --prefer-lcp

Using a Windows command shell, the script starts running with the error "Invalid argument". If i try this code:

python lensfun-convert-lcp.py --prefer-lcp

Python hangs in an endless loop. I can not ask anyone to do this work for me, but as far as Python 3 concerns, i am a newbie. I would be very grateful, if someone who has Python 3 installed could create the XML-File for me. For someone who knows the app, it should be done in a minute. I've attached all important files.

 

lensfun-convert-lcp.zip

Share this post


Link to post
Share on other sites

Here is your python run through python 3.6 with your phantom.lcp file inside the default directory...

 

> python3 lensfun-convert-lcp.py --output "out.xml"
> Warning: No Lensfun database found.
> Warning: Fall back to default mounts for Phantom / PHANTOM VISION FC200 (JPEGs).

 

The XML conversion output the script generated:

 

 

<lensdatabase version="2">

    <lens>
        <maker>Phantom</maker>
        <model>PHANTOM VISION FC200 (JPEGs)</model>
        <mount>Sigma SA</mount>
        <mount>Sony Alpha</mount>
        <mount>4/3 System</mount>
        <mount>Nikon F AF</mount>
        <mount>Minolta AF</mount>
        <mount>Canon EF</mount>
        <mount>Pentax KAF</mount>
        <mount>Canon FD</mount>
        <mount>Olympus OM</mount>
        <cropfactor>5.6</cropfactor>
        <calibration>
            <distortion focal="5.0" k1="-0.354597" k2="0.119435" k3="-0.018339" model="acm" />
            <tca alpha0="1.000181" alpha1="0.00029" alpha2="-0.000741" alpha3="0.000598" beta0="1.00064" beta1="0.00143" beta2="-0.00279" beta3="0.001636" focal="5.0" model="acm" />
        </calibration>
    </lens>

</lensdatabase>

 

Here is the output file:

 

 

 


☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

Thank you so much for the out.xml, you've attached to your last post. I tried it again a few times with the same command you used, but again, i get a syntax error. :(

 

I took your out.xml and copied the content into my actioncameras.xml and tried it again in Affinity Photo. Unfortunately it didn't work. Nothing happens. Here is the video from my approach:

 

https://youtu.be/Cv5r6ZECNfg

 

P.S.: I know, that i can use the sliders to defish my photo manually, but it has to be done with the correct values, to be able to take measurements in the photo.

P.P.S.: I've attached the two sample photos, the out.xml the edited actioncameras.xml and the original file (actioncameras.xml.bak).

photos_and_profiles.zip

Share this post


Link to post
Share on other sites

Forgotten to mention that I generated that "out.xml" file under OSX with python3 and not Win10, since I had Python 3.6 already installed on a dev Mac mashine here around. So that generated XML file will have instead probably Unix newline characters etc. inside. - NOTE that I actually don't have Affinity Photo (just Affinity Designer) here and thus I can't test/prove with your images if (and how) the Affinity Photo lensfun database can be updated with own lens entries !

 

However, according to that lensfun description here ...

 

 

...

The main place where Lensfun looks for database files usually is /usr/share/lensfun/version_x, where x is the database format version (Database format versions). However, this is configurable at compilation time, and for locally compiled Lensfun, it is mostly /usr/local/share/lensfun/version_x. A special directory is /var/lib/lensfun-updates/version_x: If it exists and contains a newer database, it is loaded instead of the main place. On Windows, this is something like C:\Documents and Settings\%User%\something\version_x but I'm not sure exactly :-).

...

 

... it's also not that clear if it is really the right place under Windows10, where the by Affinity Photo used lensfun library looks for XML lens update files (?) !

 

You have to look/search for your Windows system where Affinity Photo may have put that lensfun library stuff or may expect these to reside under Windows. - But maybe somebody of the Affinity Photo dev team can give you here a better much more concrete hint where AP's lensfun implementation looks for the lens XML database file!


☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

Thank you again. As i showed in my uploaded video, i've found the correct location ( D:\Programme\Affinity\Affinity Photo\Resources\Lens Profiles\actioncams.xml ) and edited the file there. I'll try to contact somebody of the dev team.

 

Best regards,

Thomas

Share this post


Link to post
Share on other sites

That looks more like the initial program installation location, but I somehow doubt that plain manual patching of the actioncams.xml file is here the right way to update the lens database. See:

 

 

Updating Lensfun's database: lensfun‑update-data
 

New lenses and cameras arrive at Lensfun every week. So, it is desirable to update your copy of Lensfun's database to stay up-to-date. In particular, if you have sent calibration pictures to Torsten's calibration service, you must update your local Lensfun database after the calibration in order to be able to use the new calibrations.

For this purpose, there exists a simple command-line tool called “update‑lensfun‑data”. If you call it (it doesn't need parameters), just wait for a second and the database is updated. It will report whether an update was necessary.

 

If you want the updates to be installed system-wide, the program needs root privileges. So call the program with “sudo lensfun‑update‑data” and enter your root password. There exists a second version of the programm called “g‑lensfun‑update‑data”. It will let you enter the root password – if new data is available – in a neat window. This version is especially useful for GUI programs, which can call it in the background.

 

If it is sufficient that the updates are available to only your user account, call “lensfun‑update‑data” without root priviledges. The updates are then written to ~/.local/share/lensfun/updates”.

In case there is more than one version of Lensfun on your system (e.g. you installed a new version, but the original version of your Linux distribution is still there and used by some programs), “lensfun‑update‑data” tries to detect this and updates the other database versions, too.

 

I would expect it instead to look somewhere locally under the Windows User's path (D:\Users\username\Affinity... or maybe under D:\Users\AppData\...) etc. - Don't know but maybe there is also a "lensfun‑update-data" script available for the Windows version of Lensfun which then in turn updates the initial lens database.

 

UPDATE:

 

In the meantime I had a chance to look into an AP Win trial version, the path you listed above looks Ok under Windows:

 

D:\Programme\Affinity\Affinity Photo\Resources\Lens Profiles\actioncams.xml

 

So far it seems to be the only reference for those XML lens profile files under AP Windows!

 

But the version of that Lensfun stuff that AP uses seems to be version 1 (<lensdatabase version="1">) and the Lensfun stuff from GitHub is version 2 (<lensdatabase version="2">) and they look slightly different in terms of how the XML lens data distortion entries (XML attributes/values) are defined inside. - In other words, I'm not sure if the above "out.xml" lensfun version 2 db entries will be recognized by the version db 1.


☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

Yes, i think the problem is the diffrent attribute definition.

 

The old one (variables a, b, c for the distortion model):

            <distortion model="ptlens" focal="5" a="0.02707" b="-0.10021" c="-0.09787" />
            <tca model="poly3" focal="5" vr="1.0002" vb="1.0007" />

The new one (variables k1, k2, k3 for the distortion model):

            <distortion focal="5.0" k1="-0.354597" k2="0.119435" k3="-0.018339" model="acm" />
            <tca alpha0="1.000181" alpha1="0.00029" alpha2="-0.000741" alpha3="0.000598" beta0="1.00064" beta1="0.00143" beta2="-0.00279" beta3="0.001636" focal="5.0" model="acm" />

Maybe a=k1, b=k2, and c=k3 ? But i'll wait of the answer of a dev member. Thank you for your help! ;)

Share this post


Link to post
Share on other sites

Maybe, since actually these settings are due to the used "lensfun-convert-lcp.py --prefer-lcp" call more LCP format conform looking.

 

 

parser.add_argument("--prefer-lcp", action="store_true", help="Prefer LCP data over Lensfun data.")

 

Sadly that python script from the GitHub lensfun project repository didn't produce anything valuable without that "--prefer-lcp" argument flag during my conversion run tryouts, outherwise it would have maybe generated more lensfun format conform output. At least it was my understanding, that this argument flag usually should influence the data output format slightly between LCP and Lensfun.  

 

BTW that "lensfun-convert-lcp" script wasn't available in the former lensfun 0.3.2.0 distribution version, which I believe Affinity Photo uses instead!


☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

I hope they will update the lensfun database in the near future.

 

P.S.: Do you know how to contact the support? On their website, AP ist NOT listet as a supported product for the support forms. That is why i send a PM to a staff member with a link to this topic. Is there an other (official) way?

Share this post


Link to post
Share on other sites

Well usually they will have to update the database from time to time, at least in order to support further cam and lens combinations etc.

 

Related to official support channels, honestly I don't know if there is another official way to contact AP support. - But I think this forum is probably the usual way to get in contact with them!


☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

Hey guys, 

 

jumping in on this as well. I have a phantom 4 Professional and in Lightroom I can use the INSPIRE 1 FC350 - RAW.lcp for decent results.

I used the instructions above to create an xml but just like Thomas I get incompatible values:

<lens>
        <maker>DJI</maker>
        <model>INSPIRE 1 FC350</model>
        <model lang="en">fixed lens</model>
        <model lang="de">festes Objektiv</model>
        <mount>compactCamera3855776423400872093</mount>
        <cropfactor>5.6</cropfactor>
        <calibration>
            <distortion focal="20.7" k1="-0.132569" k2="0.101281" k3="-0.018193" model="acm" />
        </calibration>
    </lens>

Please update on this as I would love to do all the developing in AP.

 

Thanks

Share this post


Link to post
Share on other sites

The Lensfun GitHub repository contains a branch "acm" which implements the Adobe Camera Model for distortion (including fisheye), TCA, and vignetting. It also contains the above mentioned Python3 script that converts LCP files into Lensfun XML. - Important here: It merges the two data sources, so you get one big database. It looks like it can even combine LCP and Lensfun correction for the same lens model.

 

 

...“lensfun‑convert‑lcp” merges the two data sources, so you get the best of both worlds. See the manpage of “lensfun‑convert‑lcp” and its output with the “‑h” option for further information.

 

See:

and see also:


☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

Thanks for the reply but I don't quite get it.

If I convert the LCP to xml and then add it to the actioncameras.xml it doesn't automatically apply the profile when loading the DNG.
 
The EXIF from the Image reads:

Camera: FC6310

Maker: DJI

Lens: n/a

...

 

Do you know which properties are used for profile selection?

Share this post


Link to post
Share on other sites

I assume that GitHub Lensfun version is a newer enhanced version of what is actually used with AP and that they (the Lensfun project) in the meantime changed the XML dataformat (from lensdatabase version 1 to lensdatabase version 2) slightly. Also the Lensfun project seem to have added in the meantime that additional Adobe Camera Model support. - I don't know if the "lensdatabase 2" XML properties are compatible with the previous "lensdatabase 1" ones, since they look different than those LCP converted ones and merged in.

 

This here ...

 

 

<calibration>
<distortion focal="20.7" k1="-0.132569" k2="0.101281" k3="-0.018193" model="acm" />
</calibration>

 

... is Lensfun ACM (Adobe Camera Model) data support from an converted/merged LCP file. This additional ACM support is added to the Lensfun projects ACM source branch. And this here is in contrast the older Lensfun XML data model ...

 

 

<distortion model="ptlens" focal="5" a="0.02707" b="-0.10021" c="-0.09787" />
            <tca model="poly3" focal="5" vr="1.0002" vb="1.0007" />

 

... as you can see they are different in properties/values!  So it depends on the used Lensfun implementation version if it supports the ACM (LCP) additions too or not.

 

Maybe the by AP used Lensfun version actually doesn't take that ACM branch into account at all and thus those by the "lensfun-convert-lcp" script generated XML data outputs can't be applied. - Instead someone from the Affinity dev team can tell you for sure if the things from the above mentioned Lensfun ACM branch are supported or not!


☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

Hm, i tried to take some pictures in the RAW mode and i found out, that the lens correction seems to work there. I took two pictures, a jpeg and a dng (RAW). In a normal image viewer (FastStone Image Viewer), both pictures have the fish-eye effect. If i open the dng-file in Affinity Photo, the fish-eye effect is removed automatically by the Developa Persona.

If i open the jpeg-file and go to the Developa Persona, the correction is not applied. Why? Are the corrections only applied on RAW-Images?

 

Here is a short video to demonstrate it:

 

https://youtu.be/J6Y_c5staSs

 

Edit: I've attached the two sample pictures!

Sample_Pictures(RAW_and_JPEG).zip

Share this post


Link to post
Share on other sites

Good question, can't tell you, the Win AD trial I used for checkups here expired due to it's time usage limits. - If you are sure on this and if you can constantly reproduce this behaviour, you might want to file in a bug report posting!


☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

Ok, now i have an answer:

 

 

Hi Thomas

 

Auto corrections are only applied to images that are opened directly in the Develop persona (so RAW, DNG), opening an image and then switching to the persona does not auto apply any corrections as it has no way of telling if there correcion had already been applied previously, however these can still be done manually using the lens panel

 

Thanks

 

So, i have to do the corrections manually, or i have to take the pictures in the raw mode. :(

Share this post


Link to post
Share on other sites

Makes sense to me to apply automatic corrections first of all preferable on RAW files, since not all cams do write these (lens correction applied) details/infos into their proprietary vendor EXIF maker notes for reference here. - Also many cams allow to perform in-cam lens corrections on demand and to detect if those have been applied is also often not obvious seeable for other third party software.

 

So all they could probably only do (meaning the AP software here) is to offer an additional settable switch (yes/no) for forcing to apply auto lens correction also for JPGs, if the user explicitely demands this via some preferences or panel setting. So the choice would be at the user's side here and that he already knows what he is doing when enabling that option.

 

If your Copter-cam can shoot/store both together and supports bigger storage cards, you can write RAW+JPG files. - However RAW format has many advantages over plain JPG in the overall image development process. The only downsize is bigger image sizes and some more work during the development process.

 

On the other side if the applying manual lens correction process could be automated via macros or scripting etc., so you can apply it again and again for JPG images with some repetitive used constant setup correction values, that would be probably usable too.


☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

 

So all they could probably only do (meaning the AP software here) is to offer an additional settable switch (yes/no) for forcing to apply auto lens correction also for JPGs, if the user explicitely demands this via some preferences or panel setting. So the choice would be at the user's side here and that he already knows what he is doing when enabling that option.

 

Yes, it would be great to be able to force to apply the lens correction. In my case i have to take the photos in RAW mode and i have to develope them manually. This is a lot of work, because after a flight i have hundrets of photos. And i also have to correct the lightning settings, make color adjustments, ...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.