Linux.com

Feature

Get top-quality scans from your scanner with Lprof

By Nathan Willis on November 15, 2006 (8:00:00 AM)

Share    Print    Comments   

The key to getting first-rate image output on any operating system is setting up a good workflow. One piece of the workflow puzzle that used to be out of reach for Linux users is device profiling -- accurately measuring hardware devices like scanners and monitors to account for their differing capabilities. But a relatively young open source application called Lprof does a professional job at that task.

At good workflow ensures that every stop the image file makes along its journey -- scanner, digital camera, editing software, monitor, printer -- is a known quantity, so the color management system can apply the correct transformation to the image at each step.

Often the very first step is a scanner, which can be quite tricky. Every model is different, there are variations among every device of the same model, and a scanner's characteristics change over time. The way around such problems is to make a scan of a tightly controlled target image for which you know the correct color values. You can then measure the scan against the known values and create a device profile that a color management system can reference for all scanning jobs.

Getting ready

The open source color management system LittleCMS has a GUI tool called Lprof to help us do just that. Lprof is GPL-licensed, uses Qt for its interface, and you can download it from lprof.sourceforge.net. The current release is tagged 0.11.4. The SourceForge.net releases are source code, and you can build the app yourself, but most Linux distributions now supply Lprof through their package management systems. If you can install it that way, do so to save a little time.

Scanner
IT8.7 target. Click to enlarge

To make an accurate profile, you will need a target image. The standard reference for scanner calibration (which Lprof expects) is called an IT8.7 (or occasionally, ISO 12641) target. It contains a matrix of more than 200 color and grayscale patches of graduated hue, saturation, and value, arranged in numbered rows and columns. Accompanying each is a text file listing the correct color values for each patch. You can find IT8.7 targets both for "reflective" scanners (meaning flatbeds) and on slide film for use with film scanners.

Film companies such as Kodak and Fuji make rather expensive target images. Your best bet is to purchase one from Wolf Faust, an open source fan whose coloraid.de site contains a lot of helpful links about color management. Faust makes IT 8.7 targets in a wide range of formats and sells them at reduced cost. Accompanying each target you buy from Faust is a CD with the appropriate text references files -- copy them someplace convenient, because you will need them when setting up your Lprof preferences.

Make a scan of your reference target using your normal scanner software (XSANE or Kooka, for example). For calibration purposes, be sure to turn off all automatic image tweaking and to save your scan in a lossless image format. Use as high a bit-depth as you can, set brightness and contrast controls to their defaults, and set the gamma control to something reasonable (the Lprof documentation recommends 2.2 to 2.4).

A scanner correctly

With your scan complete, fire up Lprof. You will be working mostly in the Camera/Scanner Profiler tab, but before getting started, click on the Preferences tab to do some setup. First, click on the "..." button next to the "Monitor profile" drop-down box. A file selector dialog will pop up; locate the directory in which your existing ICC profiles are located and click OK. You can then select a profile for your monitor from the drop-down box. If you have a specific profile for your monitor, use it, otherwise use something generic, like AdobeRGB or sRGB.

Second, click on the button labeled Install Reference File. Click on the "..." button next to the IT8 Target drop-down and locate the directory containing the text reference files corresponding to your IT8.7 targets. In the drop-down box, pick the reference file for the target you scanned, and you are ready to begin.

Alignment
Target alignment. Click to enlarge

All that remains now is to load your scanned image and have Lprof measure it against the reference file. In the Camera/Scanner Profiler tab, click on "Load Image" and find your scan. Double-check that the IT8 Target selected in this tab is the same one you chose in the preferences file. With the mouse, mark the four corners of the target on your scanned image. Lprof will overlay a green rectangle onto each color patch in the image -- if it is a little off-center, you can adjust where you put the corners.

Click the "Create Profile" button, and Lprof will work its magic, sampling the color of every patch and computing the necessary correction based on the reference file. By default, Lprof samples each patch 16 times. You can change this setting by clicking on the "Profile Parameters" button.

For my money, I would use the maximum number of samples, 33. The time difference is negligible, and it is far more accurate. For the same reason, I also recommend checking the "Local convergence analysis" and "verbose" options in Profile Parameters. You get better results, at the cost of only a few extra seconds.

Once you have made your profile, you can examine it by clicking on the "Profile Checker" button. In the Profile Checker, you can see a plot of your newly created profile against a CIE chromaticity diagram, examine a detailed error report, and look at various plots of your scanner's capabilities. I found that my scanner is a little bit off on the green-magenta channel, which is not uncommon.

Error
Error report. Click to enlarge
LUT
LUT curve. Click to enlarge
CIE
CIE diagram. Click to enlarge

For fun, try creating a profile using Lprof's default sampling parameters and compare it to a profile created with the maximum sampling quality. Even with the exact same scan, the increased sampling frequency can make a huge difference.

With an accurate profile of your scanner's capabilities in hand, you can now scan images, assign your scanner profile to them in any image editing application that supplies color management tools, and be assured that you are working with a color-corrected, top-notch image. Life is good.

Monitors, cameras, and other devices

You may have noticed that Lprof includes a Monitor Profiler tab and that the scanner profiling tab is labeled Camera/Scanner Profiler, and you may wonder why I haven't mentioned either. Two reasons.

For digital cameras, you could certainly make a snapshot of your IT8.7 target and walk through the profiling process, but your camera's image sensor has a far larger gamut than the printed target, so the resulting snapshot will drastically underrepresent your camera's capabilities. The camera manufacturer probably supplies accurate profiles for each device in its software bundle; look for those and use them with your favorite RAW image converter.

For monitors, Lprof supports two methods of profile creation. The "coarse" method is a simple walk-through in which you adjust your monitor settings by eye. It is easy to do, and if you want to read more about it, I covered the topic in an article titled "Monitor calibration under X." Lprof's method uses Norman Koren's calibration charts -- the same ones I discussed in the aforementioned article.

For a truly accurate monitor profile, you have to use a hardware color meter. Lprof's "accurate" method can do so if you already have a table of measurements from such a hardware device, but it does not support taking the measurements itself. There is preliminary Linux support for a few color meters at a much lower level, but we are still a ways away from seeing the functionality built directly into Lprof.

Share    Print    Comments   

Comments

on Get top-quality scans from your scanner with Lprof

Note: Comments are owned by the poster. We are not responsible for their content.

Some corrections

Posted by: Administrator on November 17, 2006 09:06 AM
As the maintainer of LProf I would like to thank you for this write up. However I would like to correct a few things that were incorrect or over looked in the write up.


There were a few steps that were left out of the description of the profiling process. In particular users must make sure to open the Profile Identification and Profile Parameters dialogs and at the very least review the setting in those locations. It is very important that the use enter meaningful values into the Profile Identification dialog as the value in the Description field is very commonly used by programs that are color management aware such as LProf, Krita, Scribus and Photoshop. Secondly users must also specify a file name and location for the resulting profile.



The scanning process for the target is a fairly critical step and the write up touched on this a little. It is particularly important that the scan does not have either clipped highlights or blocked up shadows. These are both fairly common mistakes, particularly clipped highlights. So double check your scans to make sure that none of the patches have values that are either the max or min values (max = 256 for 8 bit images or 65,536 for 16 bit images and min = 0). In particular clipped highlights will result in a bad profile since the profiling software will not have good values to work with. I some cases scanners may not have enough gamut to capture the whole range of the target. If this applies to your scanner adjust your scanner to prevent clipped highlight even if your shadows are blocked up.



Versions of LProf starting with 1.11.4 no longer have the local convergence setting option because of a much improved regression analysis algorithm that no longer uses this option. The new regression algorithms are now much more sophisticated yielding similar delta E numbers to the old local convergence algorithm with much smoother CLUT curves. In addition the new regression algorithms are faster and more user tunable.



In the write up it was stated ".. your camera's image sensor has a far larger gamut than the printed target, so the resulting snapshot will drastically underrepresent (sic) your camera's capabilities." The first part of that is true but the second is incorrect even though it is an often repeated myth.



Even though most cameras do have much wider gamuts then the color data on the IT8.7/2 target the regression analysis algorithms used by LProf and most other profilers do not limit the gamut of the resulting profile to the gamut of the target unless there is highlight clipping and/or blocked up shadows in the target image. A more correct statement would be to say that the resulting profile is accurate in the gamut range of the target and that values above and below this range are estimated fairly closely down to the minimum and up to the maximum values of the color space. The reason that the parts of these curves that fall outside of the target gamut are fairly close is that image sensors are well behaved (meaning very linear) and the extrapolated curves generated by the regression algorithms are in all likely hood a very good fit to the actual sensor curves even though we don't have data for the very upper and lower parts of these curves.



One way to confirm this is to profile a camera and then look at the CIE diagram of the profile in the Profile Checker. It is best to do this with an image that was processed from RAW data using dcraw or UFRAW so that you are capturing as much of the sensor gamut as possible. What you will find is that the triangle that is displayed that defines the gamut hull (bounds) of the device will be significantly larger that the area that contains the dots that represent actual data points from the target. In addition camera profiles often have some of the corners of the gamut hull triangle (these corners represent the RGB primaries of the device) fall outside of the sail shaped part of the CIE diagram that represents the human visible part of the gamut. In other words it actually shows that the sensor can see colors that are beyond the limits of human vision. Another tool that can be used to confirm this is iccexamin which can be used to display a 3D view of the gamut hull along with the target data points if the user creates the profile using the verbose setting in LProf. Again in iccexamin the gamut hull will be way larger than the data points from the target and in fact this is even more apparent than in the LProf Profile Checker.



I should add that creating camera profiles is much more demanding that creating scanner profiles since the conditions under which the target image is captured are much less controlled than is the case for a scanner. But with a little effort you can create excellent camera profiles with LProf.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya