Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lens profile for Olympus 12-45 f/4 PRO #1345

Closed
fsenore opened this issue Jan 15, 2021 · 10 comments
Closed

Lens profile for Olympus 12-45 f/4 PRO #1345

fsenore opened this issue Jan 15, 2021 · 10 comments

Comments

@fsenore
Copy link

fsenore commented Jan 15, 2021

I have created a profile for the Olympus 12-45 f/4 PRO lens for Micro 4/5. I used Torsten Bronger's phyton script.
Please let me know if you need more information.

Fulvio Senore

lensfun.zip

@andyrtr
Copy link

andyrtr commented Jun 18, 2021

I've purchased that lens recently. I've tried to patch your correction into data/db/mil-olympus.xml and build a package (Arch Linux). Darktable fails to detect that lens.

It seems that exiv2 doesn't know anything about it yet:
https://github.com/Exiv2/exiv2/blob/main/src/olympusmn_int.cpp

so "exiv2 -pt some_foo.ORF | grep -ai lens" reports back only
Exif.OlympusEq.LensType Byte 6 0 0 52 16 0 0

See this Exiv2 issue report and how to get it reported properly until a new release happens.

But even with the proper lens recognition I couldn't get darktable to apply your lens corrections.

No idea what's wrong with that patch even with properly matching lens name:

--- lensfun-0.3.95/data/db/mil-olympus.xml	2018-06-29 12:29:17.000000000 +0200
+++ lensfun-0.3.95/data/db/mil-olympus.xml.new	2021-06-18 21:31:29.350955493 +0200
@@ -1041,5 +1041,110 @@
             <tca model="poly3" focal="8" br="-0.0000479" vr="1.0005124" bb="0.0000296" vb="1.0000150"/>
         </calibration>
     </lens>
+    
+    <lens>
+        <maker>Olympus</maker>
+        <model>Olympus M.Zuiko Digital ED 12-45mm F4.0 Pro</model>
+        <mount>Micro 4/3 System</mount>
+        <cropfactor>2</cropfactor>
+        <aspect-ratio>4:3</aspect-ratio>
+        <calibration>
+            <distortion model="ptlens" focal="12" a="0.031812271" b="-0.098856010" c="0.007293939"/>
+            <distortion model="ptlens" focal="13" a="0.030839019" b="-0.092296325" c="0.009693979"/>
+            <distortion model="ptlens" focal="14" a="0.024482033" b="-0.071387947" c="0.008042580"/>
+            <distortion model="ptlens" focal="18" a="0.012685479" b="-0.031394072" c="0.002193320"/>
+            <distortion model="ptlens" focal="25" a="-0.002197178" b="0.014694992" c="-0.018250587"/>
+            <distortion model="ptlens" focal="30" a="0.008554791" b="-0.014629611" c="0.014377394"/>
+            <distortion model="ptlens" focal="35" a="-0.004786063" b="0.026555913" c="-0.022028668"/>
+            <distortion model="ptlens" focal="45" a="0.003838943" b="0.000218436" c="0.007860576"/>
+            <tca model="poly3" focal="12" vr="1.0002455" vb="0.9999341"/>
+            <tca model="poly3" focal="14" vr="1.0001865" vb="0.9999292"/>
+            <tca model="poly3" focal="18" vr="1.0001815" vb="0.9999207"/>
+            <tca model="poly3" focal="25" vr="1.0001108" vb="0.9999054"/>
+            <tca model="poly3" focal="30" vr="1.0000611" vb="0.9999091"/>
+            <tca model="poly3" focal="35" vr="1.0000150" vb="0.9999099"/>
+            <tca model="poly3" focal="45" vr="0.9999473" vb="0.9999120"/>
+            <vignetting model="pa" focal="12" aperture="4" distance="10" k1="0.1249" k2="-0.6524" k3="-0.1369"/>
+            <vignetting model="pa" focal="12" aperture="4" distance="1000" k1="0.1249" k2="-0.6524" k3="-0.1369"/>
+            <vignetting model="pa" focal="12" aperture="5.6" distance="10" k1="-0.1778" k2="0.4269" k3="-0.8335"/>
+            <vignetting model="pa" focal="12" aperture="5.6" distance="1000" k1="-0.1778" k2="0.4269" k3="-0.8335"/>
+            <vignetting model="pa" focal="12" aperture="8" distance="10" k1="-0.3517" k2="0.9738" k3="-1.1529"/>
+            <vignetting model="pa" focal="12" aperture="8" distance="1000" k1="-0.3517" k2="0.9738" k3="-1.1529"/>
+            <vignetting model="pa" focal="12" aperture="11" distance="10" k1="-0.4427" k2="1.1871" k3="-1.2213"/>
+            <vignetting model="pa" focal="12" aperture="11" distance="1000" k1="-0.4427" k2="1.1871" k3="-1.2213"/>
+            <vignetting model="pa" focal="12" aperture="22" distance="10" k1="-0.2914" k2="0.5397" k3="-0.5809"/>
+            <vignetting model="pa" focal="12" aperture="22" distance="1000" k1="-0.2914" k2="0.5397" k3="-0.5809"/>
+            <vignetting model="pa" focal="13" aperture="4" distance="10" k1="-0.0021" k2="-0.1324" k3="-0.3214"/>
+            <vignetting model="pa" focal="13" aperture="4" distance="1000" k1="-0.0021" k2="-0.1324" k3="-0.3214"/>
+            <vignetting model="pa" focal="13" aperture="5.6" distance="10" k1="-0.1159" k2="0.1278" k3="-0.2779"/>
+            <vignetting model="pa" focal="13" aperture="5.6" distance="1000" k1="-0.1159" k2="0.1278" k3="-0.2779"/>
+            <vignetting model="pa" focal="13" aperture="8" distance="10" k1="-0.1548" k2="0.2050" k3="-0.3104"/>
+            <vignetting model="pa" focal="13" aperture="8" distance="1000" k1="-0.1548" k2="0.2050" k3="-0.3104"/>
+            <vignetting model="pa" focal="13" aperture="11" distance="10" k1="-0.0757" k2="-0.1545" k3="0.0541"/>
+            <vignetting model="pa" focal="13" aperture="11" distance="1000" k1="-0.0757" k2="-0.1545" k3="0.0541"/>
+            <vignetting model="pa" focal="13" aperture="22" distance="10" k1="-0.0379" k2="-0.2976" k3="0.1809"/>
+            <vignetting model="pa" focal="13" aperture="22" distance="1000" k1="-0.0379" k2="-0.2976" k3="0.1809"/>
+            <vignetting model="pa" focal="14" aperture="4" distance="10" k1="-0.1178" k2="0.0999" k3="-0.3535"/>
+            <vignetting model="pa" focal="14" aperture="4" distance="1000" k1="-0.1178" k2="0.0999" k3="-0.3535"/>
+            <vignetting model="pa" focal="14" aperture="5.6" distance="10" k1="-0.1268" k2="-0.0177" k3="-0.0421"/>
+            <vignetting model="pa" focal="14" aperture="5.6" distance="1000" k1="-0.1268" k2="-0.0177" k3="-0.0421"/>
+            <vignetting model="pa" focal="14" aperture="8" distance="10" k1="-0.0745" k2="-0.2271" k3="0.1563"/>
+            <vignetting model="pa" focal="14" aperture="8" distance="1000" k1="-0.0745" k2="-0.2271" k3="0.1563"/>
+            <vignetting model="pa" focal="14" aperture="11" distance="10" k1="-0.0745" k2="-0.2267" k3="0.1559"/>
+            <vignetting model="pa" focal="14" aperture="11" distance="1000" k1="-0.0745" k2="-0.2267" k3="0.1559"/>
+            <vignetting model="pa" focal="14" aperture="22" distance="10" k1="-0.0730" k2="-0.2318" k3="0.1587"/>
+            <vignetting model="pa" focal="14" aperture="22" distance="1000" k1="-0.0730" k2="-0.2318" k3="0.1587"/>
+            <vignetting model="pa" focal="18" aperture="4" distance="10" k1="-0.0214" k2="-0.3973" k3="0.2040"/>
+            <vignetting model="pa" focal="18" aperture="4" distance="1000" k1="-0.0214" k2="-0.3973" k3="0.2040"/>
+            <vignetting model="pa" focal="18" aperture="5.6" distance="10" k1="-0.0816" k2="-0.2086" k3="0.1587"/>
+            <vignetting model="pa" focal="18" aperture="5.6" distance="1000" k1="-0.0816" k2="-0.2086" k3="0.1587"/>
+            <vignetting model="pa" focal="18" aperture="8" distance="10" k1="-0.0810" k2="-0.2137" k3="0.1574"/>
+            <vignetting model="pa" focal="18" aperture="8" distance="1000" k1="-0.0810" k2="-0.2137" k3="0.1574"/>
+            <vignetting model="pa" focal="18" aperture="11" distance="10" k1="-0.0844" k2="-0.2019" k3="0.1486"/>
+            <vignetting model="pa" focal="18" aperture="11" distance="1000" k1="-0.0844" k2="-0.2019" k3="0.1486"/>
+            <vignetting model="pa" focal="18" aperture="22" distance="10" k1="-0.0939" k2="-0.1772" k3="0.1283"/>
+            <vignetting model="pa" focal="18" aperture="22" distance="1000" k1="-0.0939" k2="-0.1772" k3="0.1283"/>
+            <vignetting model="pa" focal="25" aperture="4" distance="10" k1="-0.0596" k2="-0.4531" k3="0.2691"/>
+            <vignetting model="pa" focal="25" aperture="4" distance="1000" k1="-0.0596" k2="-0.4531" k3="0.2691"/>
+            <vignetting model="pa" focal="25" aperture="5.6" distance="10" k1="-0.1162" k2="-0.1299" k3="0.1018"/>
+            <vignetting model="pa" focal="25" aperture="5.6" distance="1000" k1="-0.1162" k2="-0.1299" k3="0.1018"/>
+            <vignetting model="pa" focal="25" aperture="8" distance="10" k1="-0.1165" k2="-0.1276" k3="0.0990"/>
+            <vignetting model="pa" focal="25" aperture="8" distance="1000" k1="-0.1165" k2="-0.1276" k3="0.0990"/>
+            <vignetting model="pa" focal="25" aperture="11" distance="10" k1="-0.1139" k2="-0.1416" k3="0.1084"/>
+            <vignetting model="pa" focal="25" aperture="11" distance="1000" k1="-0.1139" k2="-0.1416" k3="0.1084"/>
+            <vignetting model="pa" focal="25" aperture="22" distance="10" k1="-0.1196" k2="-0.1275" k3="0.0982"/>
+            <vignetting model="pa" focal="25" aperture="22" distance="1000" k1="-0.1196" k2="-0.1275" k3="0.0982"/>
+            <vignetting model="pa" focal="30" aperture="4" distance="10" k1="-0.0938" k2="-0.4672" k3="0.3237"/>
+            <vignetting model="pa" focal="30" aperture="4" distance="1000" k1="-0.0938" k2="-0.4672" k3="0.3237"/>
+            <vignetting model="pa" focal="30" aperture="5.6" distance="10" k1="-0.1127" k2="-0.1025" k3="0.0792"/>
+            <vignetting model="pa" focal="30" aperture="5.6" distance="1000" k1="-0.1127" k2="-0.1025" k3="0.0792"/>
+            <vignetting model="pa" focal="30" aperture="8" distance="10" k1="-0.1182" k2="-0.0949" k3="0.0756"/>
+            <vignetting model="pa" focal="30" aperture="8" distance="1000" k1="-0.1182" k2="-0.0949" k3="0.0756"/>
+            <vignetting model="pa" focal="30" aperture="11" distance="10" k1="-0.1180" k2="-0.0971" k3="0.0805"/>
+            <vignetting model="pa" focal="30" aperture="11" distance="1000" k1="-0.1180" k2="-0.0971" k3="0.0805"/>
+            <vignetting model="pa" focal="30" aperture="22" distance="10" k1="-0.1195" k2="-0.1010" k3="0.0794"/>
+            <vignetting model="pa" focal="30" aperture="22" distance="1000" k1="-0.1195" k2="-0.1010" k3="0.0794"/>
+            <vignetting model="pa" focal="35" aperture="4" distance="10" k1="-0.1887" k2="-0.2826" k3="0.2273"/>
+            <vignetting model="pa" focal="35" aperture="4" distance="1000" k1="-0.1887" k2="-0.2826" k3="0.2273"/>
+            <vignetting model="pa" focal="35" aperture="5.6" distance="10" k1="-0.1214" k2="-0.0405" k3="0.0369"/>
+            <vignetting model="pa" focal="35" aperture="5.6" distance="1000" k1="-0.1214" k2="-0.0405" k3="0.0369"/>
+            <vignetting model="pa" focal="35" aperture="8" distance="10" k1="-0.1175" k2="-0.0725" k3="0.0696"/>
+            <vignetting model="pa" focal="35" aperture="8" distance="1000" k1="-0.1175" k2="-0.0725" k3="0.0696"/>
+            <vignetting model="pa" focal="35" aperture="11" distance="10" k1="-0.1175" k2="-0.0754" k3="0.0700"/>
+            <vignetting model="pa" focal="35" aperture="11" distance="1000" k1="-0.1175" k2="-0.0754" k3="0.0700"/>
+            <vignetting model="pa" focal="35" aperture="22" distance="10" k1="-0.1187" k2="-0.0780" k3="0.0719"/>
+            <vignetting model="pa" focal="35" aperture="22" distance="1000" k1="-0.1187" k2="-0.0780" k3="0.0719"/>
+            <vignetting model="pa" focal="45" aperture="4" distance="10" k1="-0.4745" k2="0.5513" k3="-0.4361"/>
+            <vignetting model="pa" focal="45" aperture="4" distance="1000" k1="-0.4745" k2="0.5513" k3="-0.4361"/>
+            <vignetting model="pa" focal="45" aperture="5.6" distance="10" k1="-0.1148" k2="0.0062" k3="-0.0192"/>
+            <vignetting model="pa" focal="45" aperture="5.6" distance="1000" k1="-0.1148" k2="0.0062" k3="-0.0192"/>
+            <vignetting model="pa" focal="45" aperture="8" distance="10" k1="-0.0993" k2="-0.0727" k3="0.0617"/>
+            <vignetting model="pa" focal="45" aperture="8" distance="1000" k1="-0.0993" k2="-0.0727" k3="0.0617"/>
+            <vignetting model="pa" focal="45" aperture="11" distance="10" k1="-0.1029" k2="-0.0649" k3="0.0535"/>
+            <vignetting model="pa" focal="45" aperture="11" distance="1000" k1="-0.1029" k2="-0.0649" k3="0.0535"/>
+            <vignetting model="pa" focal="45" aperture="22" distance="10" k1="-0.1099" k2="-0.0505" k3="0.0444"/>
+            <vignetting model="pa" focal="45" aperture="22" distance="1000" k1="-0.1099" k2="-0.0505" k3="0.0444"/>
+        </calibration>
+    </lens>
 
 </lensdatabase>

Could you menage to actually use your corrections? Once this has been sorted out you should try to file a PR.

@fsenore
Copy link
Author

fsenore commented Jun 19, 2021

I use my correction with RawTherapee and it works.
I put those data in a different xml file (the name is "lenfun-mio.xml") to avoid the need of patching the olympus file at any RatTherapee release but it should work also in your way.

Are you sure that Darktable is not using a copy of lensfun from another folder?
I am a Windows user and I have not been able to make lensfun read the xml file from another folder, even if the documentation writes that it should be possible. In the end I had to change the files in the system location (for RawTherapee under Windows it is in a subfolder of the RT installation folder). This is unfortunate because when I upgrade RT I must remember to modify its own lenfun copy.

You can make a simple test: open an image taken with a different lens and check that DarkTable recognizes it. Then edit the lenfun file and change the lens name to something different. Now open again the same image: if DartTable still recognizes the lens it means that it is loading lensfun from somewhere else. Of course remember to restore the lens name in the xml file.

I don't think that Exiv2 is needed to correct the lens. Isn't it just for metadata?

By the way, the Olympus is a very good lens but it has large sample variations. The first copy that I received was defective: the right side of the images was never sharp. You can check such problems in a simple way:
https://wordpress.lensrentals.com/blog/2016/09/fun-with-field-of-focus-part-1/
Scroll to the end of the page for a simple method that uses the photo of a lawn or something similar. It worked very well for me.

@andyrtr
Copy link

andyrtr commented Jun 21, 2021

  1. exiv2 now includes proper lens detection. My PR got accepted.

  2. I've found why it wasn't working for me in darktable.

When you've ever used "lensfun-update-data" either as user or root to update the lensfun db that's preferred over /usr/share/lensfun/version_2/mil-olympus.xml and even over ~/.local/share/lensfun/newlens.xml it seems. Deleting everything from ~/.local/share/lensfun/updates/* and /var/lib/lensfun-updates/* allows the lens to be detected.

I'm going now to actually try your corrections to see if they work as intended.

@andyrtr
Copy link

andyrtr commented Jun 21, 2021

@fsenore: Please rename the lense in your zip to reflect the exiv2 naming or it won't get detected with new any new exiv2 release and change you local ~/.exiv2 to reflect that naming.

4 <model>Olympus M.Zuiko Digital ED 12-45mm F4.0 Pro</model>

Basic testing shows no issues here. Vignetting and distorsion seems to go away well. I don't yet have a photo with high chromatic aberrations.

@fsenore
Copy link
Author

fsenore commented Jun 25, 2021

There is a problem with the lens name. It looks like the RawTherapee name of the lens is

“Olympus M.Zuiko Digital ED 12-45mm f/4.0 Pro”

and the Exiv2 name of the same lens is

“Olympus M.Zuiko Digital ED 12-45mm F4.0 Pro”

Since the names are slightly different I suppose that a lensfun profile cannot work at the same time with RawTherapee and with DarkTable that uses EXiv2 to detect the lens.

Moreover both names are different from the one that I read at the Olympus web site:

“M.Zuiko Digital ED 12‑45mm F4 PRO”

Is the a way to solve this naming problem, or am I missing something?

@andyrtr
Copy link

andyrtr commented Jun 25, 2021

I've used the official OMDS naming from here and followed all the exiv2 MFT lenses scheme.

I guess this is more likely a RawTherapee bug if it doesn't detect that lens name. The Oly 12-40 Pro lens has the same lens naming scheme used in lensfun.

@fsenore
Copy link
Author

fsenore commented Jun 28, 2021

I looked at the Italian site and the lens name was different...
Anyway now I agree that you have chosen the right name.
I have attached a new version of the xml file with the new lens name.

lensfun.zip

@andyrtr
Copy link

andyrtr commented Jun 30, 2021

Looks good to me and should be pushed now.

@andyrtr
Copy link

andyrtr commented Jul 5, 2021

Maybe open a merge request to get it actually merged. It seems issues don't receive that much intention.

sarunasb added a commit that referenced this issue Nov 24, 2021
Replace distortion and TCA params with a full set from issue #1345 .
@tuxfanx
Copy link
Contributor

tuxfanx commented Apr 6, 2022

correction for the lens is completely included in db

@tuxfanx tuxfanx closed this as completed Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants