17 Replies Latest reply: Nov 10, 2010 10:02 AM by Mark Sirota-AvEEFa RSS

    Design-based profile for pinhole vignetting correction?

    Mark Sirota-AvEEFa Community Member

      I have a pinhole camera which shoots (nominally) 6x12cm frames on 120 film, with a 40mm focal length.  Naturally it has significant vignetting, as the corner of the frame is almost twice as far from the pinhole as the center of the frame, making the corners about two stops down from the center.

       

      Is it possible to hand-build a design-based lens profile for this to automatically correct for the vignetting?  How would I do that?

        • 1. Re: Design-based profile for pinhole vignetting correction?
          simonsaith Adobe Employee

          The design based lens profile as opposed to build from the checkerboard images?

           

          Yes, it is possible if you can create the lens design data interchange format as those used by the ALPC. ALPC can do the conversion for you to generate the lens profile. You can go to the ALPC Adobe Labs page. Under the Product Details page, there is a PDF doc http://download.macromedia.com/pub/labs/lensprofile_creator/lensprofile_creator_cameramode l_dataconversion.pdf that describes the interchange format.

           

          -Simon

          • 2. Re: Design-based profile for pinhole vignetting correction?
            Mark Sirota-AvEEFa Community Member

            Thanks, Simon.  Now that I've read through that, I think I could do that -- but it seems like it would be simpler to write a .lcp file directly.  The vignetting math is very simple, probably describable with just the stCamera:VignetteModelParam1 property.  And then I wouldn't have to fake a file from which to copy EXIF data (which I could do easily enough with Exiftool, but it seems like more work), as these are scans of film rather than files from a digital camera.

             

            Is there some reason not to just write a .lcp file by hand?  I just need a little better understanding of what number to stick in VignetteModelParam1, and perhaps a little more explanation about some of the others.

            • 3. Re: Design-based profile for pinhole vignetting correction?
              Mark Sirota-AvEEFa Community Member

              Simon,

               

              I've done it your way, inputting a text file and converting it to an LCP using the Lens Profile Creator.

              But the profile doesn't show up in Lightroom.

               

              What might I be doing wrong?  Could it be that I only have one input file (because there is only one focal length, one aperture, and focus distance is irrelevant)?  What should I put for focus distance (I used zero)?

               

              I see in the resulting LCP that the ApertureValue is 14.607561, even though my text file said 158.  Is that expected?

               

              Could it be that the file I gave it (and the one I'm viewing in Lightroom) is a TIFF file from the scanner, rather than a raw file?  The tool created an LCP for raw files.

               

              I'm also surprised that the tool used all three VignetteModelParam values.  The values I inputted fit neatly onto a parabola, so I think only the first should be needed to fit a curve.

               

              I'm still feeling like writing the .LCP file by hand is likely to be more successful, if only I understood all these parameters. :-)

              • 4. Re: Design-based profile for pinhole vignetting correction?
                Mark Sirota-AvEEFa Community Member

                Whoops, sorry -- I made a mistake in the math.  My points do not fit naturally on a parabola, it is a more complex curve.

                 

                For each millimeter off center (d), the light ratio is 1/(((d/ƒ)^2)+1), where ƒ is the focal length.

                The graph of that for ƒ=40mm looks like:

                falloff.png

                The X axis shows the distance from image center in mm; the Y axis shows the falloff as I think it is to be represented in the 5th column of the lens design data interchange file format.

                 

                Seems like every image needs this vignetting correction, unless it is already handled by empirical measurements through a standard lens profile.  For most situations the result is pretty small, as in most cameras the sensor isn't three times as wide as the focal length as it is in my pinhole camera (this graph goes out to the corner of my pinhole camera's image frame).

                 

                So assuming I now have the math right, my question is just why the profile isn't showing up.

                The tool put it in ~/Library/Application Support/Adobe/CameraRaw/LensProfiles/1.0, which is exactly where I think it belongs...

                • 5. Re: Design-based profile for pinhole vignetting correction?
                  simonsaith Adobe Employee

                  Mark,

                   

                  Check out this thread http://forums.adobe.com/thread/690985?tstart=60 that might help. There is a <stCamera:CameraRawProfile> tag in the lcp file that indicate whether it is for raw or non-raw images.You can hand edit it support your non-raw workflow case.By default, the design based profile is generated for raw images.

                   

                  -Simon

                  • 6. Re: Design-based profile for pinhole vignetting correction?
                    Mark Sirota-AvEEFa Community Member

                    Awesome, that took care of that -- I can now see the profile.

                     

                    Now the problem is that it has no effect.  Because focus distance in the source data is zero, maybe?

                    Edit: The profile was created without an <stCamera:FocusDistance> property, though the white paper says it is required.  Is that a bug, or is the documentation wrong?  Adding it by hand had no effect.

                    • 7. Re: Design-based profile for pinhole vignetting correction?
                      simonsaith Adobe Employee

                      I thought it needs the focus distance info to be specified in the lens design data interchange file.

                       

                      -Simon

                      • 8. Re: Design-based profile for pinhole vignetting correction?
                        Mark Sirota-AvEEFa Community Member

                        I did define it -- as zero, because it's meaningless for a pinhole camera.

                        I'll experiment with other values.

                        • 9. Re: Design-based profile for pinhole vignetting correction?
                          Mark Sirota-AvEEFa Community Member

                          No matter what I do, I can't get these profiles to do anything.  After I change stCamera:CameraRawProfile to False they show up, and as expected the Distortion and C. Aberration sliders are greyed out.  But the Vignetting slider has no effect.

                           

                          I'm wondering whether the Batch Convert process just doesn't work with TIFFs or something.

                           

                          I also can't figure out why other designed-based raw profiles show up in the pull-down lists.  Why can I choose, say, the one for the Sigma 4.5mm fisheye for this same image?  I even tried just copying that file and changing the profile name, but my copy didn't show up unless I change CameraRawProfile to False.  Doesn't make sense to me.

                          • 10. Re: Design-based profile for pinhole vignetting correction?
                            Mark Sirota-AvEEFa Community Member

                            Aha -- the reason I can apply the Sigma 4.5mm fisheye profile is because there's a non-raw version of this profile in the Nikon folder, in addition to the design-based profiles in the Sigma folder.  I got faked out.  Sorry about that.

                             

                            So now I'm back to wondering why my profile is visible but has no effect.

                            • 11. Re: Design-based profile for pinhole vignetting correction?
                              Mark Sirota-AvEEFa Community Member

                              I have it, through brute force experimentation -- I need  <stCamera:FocalLengthX> and <stCamera:FocalLengthY> in the  VignetteModel stanza.

                              I’m not clear why, and more to the point, I’m not clear what to put there.  It is defined as ƒ/Dmax, where Dmax is the larger pixel dimension of the image.  So the numerator is in millimeters, and the denominator is in pixels.

                              I see values like 0.626251 for the D3x (Dmax = 6048) and 50/1.8D.  So I don’t know how to calculate this value.

                               

                              I'm willing to assume a scan resolution of, say, 2400 ppi.  So for a 12cm negative, my Dmax should be 11314.584 pixels, if non-integer values are permitted.  And my focal length is 40mm.  So what should I put for FocalLengthX and FocalLengthY?

                              • 12. Re: Design-based profile for pinhole vignetting correction?
                                Mark Sirota-AvEEFa Community Member

                                Simon, thank you so much for working through this exercise with  me.  Between you and Eric, now I know a whole lot more about lens profiles!

                                I now have two working profiles, one for 6x9 scans and one for 6x12  scans.  The only assumptions made in the end are that the scans cover  exactly 6x9cm or 6x12cm, and that they’re centered properly.  Scan  resolution doesn’t end up playing a part, which is a bonus for my  workflow.

                                Turns out that several of the tags marked Required in the docs are not  actually required, at least if you’re only handling vignetting.  Here’s  my final working profile:

                                <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
                                <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.4.0-c007 1.126898, Tue Sep 30 2008 01:00:47        ">
                                    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
                                       <rdf:Description rdf:about=""
                                             xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
                                             xmlns:stCamera="http://ns.adobe.com/photoshop/1.0/camera-profile">
                                          <photoshop:CameraProfiles>
                                             <rdf:Seq>
                                                <rdf:li rdf:parseType="Resource">
                                                   <stCamera:Author>Mark Sirota</stCamera:Author>
                                                   <stCamera:ProfileName>Zero Image 612F @ 6x12</stCamera:ProfileName>
                                                   <stCamera:Make>Zero Image</stCamera:Make>
                                                   <stCamera:LensPrettyName>Zero 612F</stCamera:LensPrettyName>
                                                   <stCamera:CameraPrettyName>Zero 612F @ 6x12</stCamera:CameraPrettyName>
                                                   <stCamera:CameraRawProfile>False</stCamera:CameraRawProfile>
                                                   <stCamera:PerspectiveModel rdf:parseType="Resource">
                                                      <stCamera:Version>2</stCamera:Version>
                                                      <stCamera:VignetteModel rdf:parseType="Resource">
                                                         <stCamera:FocalLengthX>0.333333</stCamera:FocalLengthX>
                                                         <stCamera:FocalLengthY>0.333333</stCamera:FocalLengthY>
                                                         <stCamera:VignetteModelParam1>-0.817545</stCamera:VignetteModelParam1>
                                                         <stCamera:VignetteModelParam2>0.365188</stCamera:VignetteModelParam2>
                                                         <stCamera:VignetteModelParam3>-0.060324</stCamera:VignetteModelParam3>
                                                         <stCamera:ResidualMeanError>0.009584</stCamera:ResidualMeanError>
                                                      </stCamera:VignetteModel>
                                                   </stCamera:PerspectiveModel>
                                                </rdf:li>
                                             </rdf:Seq>
                                          </photoshop:CameraProfiles>
                                       </rdf:Description>
                                    </rdf:RDF>
                                </x:xmpmeta>
                                <?xpacket end="w"?>

                                Perhaps I’ll generalize the names, since this would work for any camera with ƒ=40mm and a 6x12cm frame, and upload them.

                                • 13. Re: Design-based profile for pinhole vignetting correction?
                                  Mark Sirota-AvEEFa Community Member

                                  Summary: This is possible if you're willing to muck with the .lcp files by hand.  The documentation is lacking; I couldn't have done it without help from Simon and Eric.  See above for the final working profile.

                                  • 14. Re: Design-based profile for pinhole vignetting correction?
                                    simonsaith Adobe Employee

                                    Hi Mark,

                                     

                                    Good to hear that you have figure it out yourself. Sorry I side tracked by work  items and did not get a chance to respond to you earlier.Normally,

                                    for designed based  profile, you don't need to specify the <stCamera:FocalLengthX> and <stCamera:FocalLengthY> info. It is not available because it does not  know the sensor pixel pitch ahead of time (it only has the lens info). So it only needs to specify <stCamera:FocalLength> in millimeters. But in your case, your image is from scanned films so you can compute <stCamera:FocalLengthX> and <stCamera:FocalLengthY> info ahead of time.  The <stCamera:FocalLengthX> and <stCamera:FocalLengthY> are defined as f/Dmax as documented, where f is the focal length (in your case 40mm) specified in the number of pixels. So you know the scanner resolution @2400ppi, so your f = 40 * 2400 / 25.4 = 3779.5275 pixels. With your Dmax = 11314.584 pixels, the <stCamera:FocalLengthX> and <stCamera:FocalLengthY> comes out at

                                    0.3340403. So you got it right. Congratulations!

                                     

                                    I'd like to see your image before and after the correction :-)

                                     

                                    -Simon

                                    • 15. Re: Design-based profile for pinhole vignetting correction?
                                      Mark Sirota-AvEEFa Community Member

                                      I don't have a good scan of a 6x12 handy, but here's a 6x9.  You can see this scan isn't perfect either -- there's a little white in the lower left corner, and you can see some film curvature near the bottom of the doorframe in the lower right (I don't know if the film was curved in the camera or in the scanner).

                                      sample.jpg

                                       

                                      sample-corrected.jpg

                                       

                                      Also, here's the 6x12 profile applied to a solid middle gray:

                                      6x12-corrected.jpg

                                       

                                      Thanks again for your help!  I submitted five profiles, but I understand if they're not approved...  They're certainly not traditional, they are dependent on the precision of the size and centering of the scan, and I don't know whether the Lens Profile Downloader will choke on them because they're missing several of the usual tags, and I can't figure out how to test that myself.  If they are approved, it would be easy enough to generate others for other focal length/frame size combinations.

                                      • 16. Re: Design-based profile for pinhole vignetting correction?
                                        simonsaith Adobe Employee

                                        Very cool. Because those profiles does not contain metadata tags for the camera and lens, ALPD does not how to handle it so they do not show up.

                                         

                                        -Simon

                                        • 17. Re: Design-based profile for pinhole vignetting correction?
                                          Mark Sirota-AvEEFa Community Member

                                          Understood.  Well, if anyone is following this and would like me to generate a profile for your particular camera and mail it to you, just let me know... I just need focal length and frame dimensions.