How to get support for your image acquisition hardware

Not all hardware is supported by Imatest IS or Imatest IT’s acquire_image routine. In order to obtain support there are a number of possibilities:

1. Implement a standard image acquisition library

The quickest path to getting support for your device within the current version of Imatest is to implement a standard acquisition interface such as DirectShow or GenICam.

2. Integration Consulting

We can add support for your custom image acquisition SDK on a statement of work basis. Contact testing@imatest.com for a quote.

3. Get Support in MATLAB Image Acquisition Toolbox Adaptor

Many of our supported devices come courtesy of the Image Acquisition Toolbox. If you create a MATLAB imaq adaptor a future version of Imatest IS will be able to load that adaptor from a plugin folder. Please contact us if you are interested in this option.  

You might also request hardware support from Mathworks, but that could be a long process  for them to implement your device, release a new version of MATLAB and for us to upgrade to it.

 

Read More

Gamma, Chart Contrast and MTF Calculations

Gamma (the average slope of log pixel levels as a function of log exposure for light through dark gray tones) is used, per the ISO 12233 standard, to linearize the input data, i.e., to remove the gamma encoding applied by the camera or RAW converter. Gamma defaults to 0.5 = 1/2, which is typical of digital cameras, but may be affected by camera or RAW converter settings. 

Imatest Settings

For accurate calculation of edge-SFR from using Imatest’s SFRplus, eSFR ISO, SFRreg, Checkerboard, or SFR modules, it’s important to use a proper gamma for sharpness calculations.

If the chart contrast is known and is ≤10:1 (medium or low contrast), you can enter the contrast in the Chart contrast (for gamma calc.) box, then check the Use for MTF checkbox. Gamma will be then be calculated from the chart and displayed in the Edge/MTF plot.

Measuring Gamma

If chart contrast is not known you should measure gamma by obtaining the OECF (Opto-Electric Conversion Function) per the ISO 14524 standard.  This can be obtained using an image of a grayscale stepchart and running Colorcheck, Stepchart , Multicharts (interactive), or Multitest. A nominal value of gamma should be entered, even if the value of gamma derived from the chart (described above) is used to calculate MTF.

Errors in Gamma

Small errors in gamma have a minor effect on MTF measurements (a 10% error in gamma results in a 2.5% error in MTF50 for a normal contrast target). Gamma should be set to 0.45 when dcraw is used to convert RAW images into sRGB or a gamma=2.2 (Adobe RGB) color space. If gamma is set to less than 0.3 or greater than 0.8, the background will be changed to pink to indicate an unusual (possibly erroneous) selection.

Technical Details

Capture One LE with Film Curve
1. Capture One LE set to Film standard
(the default). Gamma = 0.679.

Capture One LE with Linear Curve
2. Capture One LE, Linear response. Gamma =
0.508. Recommended for SFR runs.

Canon FVU with Standard contrast

3. Canon FVU set to Standard contrast.
Gamma = 0.642.

Gamma is the exponent of the equation that relates image pixel level to luminance. For a monitor or print,

     Output luminance = (pixel level)gamma_display

When the raw output of the image sensor, which is linear, is converted to image file pixels for a standard color space, the approximate inverse of the above operation is applied.

     pixel level = (RAW pixel level)gamma_camera ~= exposuregamma_camera

The total system gamma is gamma_display * gamma_camera. Standard values of display gamma are 1.8 for older color spaces used in the Macintosh and 2.2 for color spaces used in Windows, such as sRGB (the default) and Adobe RGB (1998).

The three curves on the right, produced by Stepchart for the Canon EOS-10D, show how Gamma varies with RAW converter settings.In characteristic curves for film and paper, which use logarithmic scales (e.g., density (–log10(absorbed light) vs. log10(exposure)), gamma is the average slope of the transfer curve (excluding the “toe” and “shoulder” regions near the ends of the curve), i.e.,

Gamma is contrast.

See Kodak’s definition in Sensitometric and Image-Structure Data.

To obtain the correct MTF, Imatest must linearize the pixel levels— the camera’s gamma encoding must be removed. That is the purpose of Gamma in the SFR input dialog box, which defaults to 0.5, typical for digital cameras. It can, however, vary considerably with camera and RAW converter settings, most notably contrast.

Characteristic curves for the Canon EOS-10D with three RAW converter settings are shown on the right. Gamma deviates considerably from 0.5. Gamma = 0.679 could result in a 9% MTF50 error. For best accuracy we recommend measuring gamma using Colorcheck or Stepchart, which provides slightly more detailed results.

Confusion factor: Digital cameras rarely apply an exact gamma curve: A “tone reproduction curve” (an “S” curve) is often superposed on the gamma curve to extend dynamic range while maintaining visual contrast. This reduces contrast in highlights and (sometimes) deep shadows while maintaining or boosting it in middle tones. You can see it in curves 1 and 3, on the right. For this reason, “Linear response” (where no S-curves is applied on top of the gamma curve) is recommended for SFR measurements.

The transfer function may also be adaptive: camera gamma may be higher for low contrast scenes than for contrasty scenes. This can cause headaches with SFR measurements. But it’s not a bad idea generally; it’s quite similar to the development adjustments (N-1, N, N+1, etc.) in Ansel Adams’ zone system. For this reason it’s not a bad idea to place a Q-13 or Q-14 chart near the slanted edges.

To learn more about gamma, read Tonal quality and dynamic range in digital cameras and Monitor calibration.

Read More

Testing a macro lens using Checkerboard and Micro Multi-slide

Testing a 1-5x Macro Canon MP‑E 65mm Lens

Imatest’s Checkerboard module is our new flagship module for automated analysis of sharpness, distortion and chromatic aberration from a checkerboard (AKA chessboard) pattern. The big benefit of using the checkerboard is that there are looser framing requirements than with other kinds of test targets. While checkerboard lacks the color and tone analysis provided by SFRplus and eSFR ISO, these features are not available on the high precision chrome on glass substrate, so the checkerboard is the optimal pattern for this test.

The Imatest Micro Multi-Slide contains high precision checkerboard patterns with many different scales of frequencies. This makes a single target capable of effectively testing a wide range of magnifications.

We obtained the below cycles per object mm by dividing the LW/PH obtained from the image by 2*image height in mm.

Magnification Image height Center MTF50 Best Aperture
1x 23.71 mm 29.61 cycles / object mm f/5.6
2x 11.86 mm 57.04 cycles / object mm f/5.6
3x 7.90 mm 74.55 cycles / object mm f/5.6
4x 6.07 mm 81.52 cycles / object mm f/4
5x 4.74 mm 87.61 cycles / object mm f/4

 

Thanks to this study, we now know to select the f/4 aperture at 5x magnification to maximize the resolving power of this lens. Detailed results, capture and analysis procedures are available below.


1x Magnification

This report is shown in line widths per picture height (LW/PH):

1x

1x-3d


2x Magnification

2x

2x-3d


3x Magnification

3x

3x-3d


4x Magnification

4x

4x-3d


5x Magnification

At the limit of this lens’ magnification we obtain the most spatial detail on the target at f/4

5x

5x-3d


Capture Procedure

We use this camera setup to take high precision photographs of the test targets on a LED lightbox:  

micromulti_setup_scaled

We mounted the camera on an adjustable arm and used a Manfrotto 454 Micro Positioning plate for adjusting distance and focus. We masked off the extra parts of the lightbox using opaque material to prevent additional stray light from increasing flare.

We used the following framing for the various magnifications:

micromulti_site_blog_customized

To get good sharpness measurements we selected an area of the slide that had under 10 vertical squares in the image. This yields a reasonably large SFR region for the most reliable calculations and prevents there from being an excessive number of regions.

We centered the chart on the 3-dot mark in the center of the frequency zone. For optimal slanted-edge analysis, we rotated the chart by about 5° according to the ISO 12233 standard. Our current checkerboard routines can automatically detect the checkerboard, but they look for complete rows and columns before including the set of regions. Which means that rotation can make the framing a little more difficult, and if a corner of a complete row/column of squares gets clipped off, then the automatic region detection will skip some regions you may have wanted to test, producing less than optimal region availability around the periphery of your image. We will be improving these selection routines in future releases of our software.

If we wanted more detail about lateral chromatic aberration and distortion (which are very low for this lens) we would have analyzed the dot pattern regions of the chart.

We used 5 megapixel downsampled JPG’s from the camera to perform this analysis, which gives us the following table of image sizes:

Magnification Image height Image pixel size
1x 23.71mm 13µm
2x 11.86mm 6.5µm
3x 7.90mm 4.33µm
3.9x 6.07mm 3.33µm
5x 4.74mm 2.6µm

Analysis Procedure

We performed our Checkerboard Setup and selected all regions:

setup

After initially determining our range of expected MTF values, we disabled auto-scaling on our 3D plots and set our range to the total:

micromultiscaling

We used Imatest Batchview to coalesce the large volume of tests in order to produce the above bar graphs.  We also used ImageMagick to assemble the nifty animated GIF’s from the collections of 3D plots:

convert -delay 100 mag1/Results/*3D.png 1x-3D.gif

We hope that you find this write-up to be helpful in testing your own equipment. You can purchase Micro-multi Slide on our store or contact charts@imatest.com for customizing a test target that fits your unique requirements.  See our Macro Solutions for other close-range testing items.

Read More

Increasing the Repeatability of Your Sharpness Tests

By Robert Sumner

With contributions from Ranga Burada, Henry Koren, Brienna Rogers and Norman Koren

Consistency is a fundamental aspect of successful image quality testing. Each component in your system may contribute to variation in test results. For tasks such as pass/fail testing, the primary goal is to identify the variation due to the component and ignore the variation due to noise. Being able to accurately replicate test results with variability limited to 1-5% will give you a more accurate description of how your product will perform.

Since Imatest makes measurements directly from the image pixels, any source that adds noise to the image can affect measurements. A primary source of noise in images is electronic sensor noise. Photon shot noise also contributes significantly in low-light situations. Other systemic sources of measurement variability, such as autofocus hysteresis, will not be addressed in this post.  

In order to reduce variation in your sharpness results and increase test repeatability, you should take steps to decrease the amount of noise in your image.

Here are 5 tips to limit noise in your test results: (more…)

Read More

Imatest shuts down intermittently due to video driver problem

Symptom

Imatest version 4.2+ intermittently halts.  A MATLAB crash dump file is generated in the user’s %temp% folder.

The crash dump file will start with text such as:

Assertion in void __cdecl `anonymous-namespace'::mwJavaAbort(void) 

Cause

An older version of NVIDIA video drivers has compatibility issues with the new graphics libraries introduced in Imatest 4.2 (MATLAB R2014b+)

Solution

Update your video drivers to the latest version.

Read More

Visual C++ Runtime Library: “The Application has requested the Runtime to terminate in an unusual way. “

Symptoms of problem:

Running the library leads to this error:

UnusualRuntime

 

Root cause of problem:

This error is typically the result of a conflict between the Microsoft Visual C++ Redistributables libraries supplied with MATLAB, and those that are supplied by some third party applications.

 

Solution to problem:

To revert to a previous version of the C++ Redistributable libraries, you should uninstall all versions of your current 2005 and 2008 C++ Redistributable libraries through your Windows Control Panel, and reboot you machine. You can then re-install them by running the MATLAB-provided installers which can be found in the following locations:

For 32-bit Imatest:

 C:\Program Files (x86)\MATLAB\MATLAB Compiler Runtime\v81\bin\win32\vc90\vcredist_x86.exe

For 64-bit Imatest:

C:\Program Files\MATLAB\MATLAB Compiler Runtime\v81\bin\win64\vc90\vcredist_x64.exe

Note: for older releaseses, a different matlab folder will be used, for example, v714 for releases 3.10 and below.

See Also:

Read More

Best Practices for Calling Imatest IT Libraries

Only run in a single thread

The MATLAB runtime library does not support multiple threads using the same library.

For high speed parallel testing Imatest IT Parallel can use multiple processes to increase testing throughput up to three times.

 

Only initialize a single time for multiple runs

Initializing the library has significant computational cost. and the first call made to the library will run slower than subsequent runs.

The library should remain initialized throughout the life cycle of the calling program that should have reasonable longevity of its own.

 

mclTerminateApplication() or terminate() must be called once only per process

Calling mclTerminateApplication (C/C++) or terminate (Python) more than once may cause your application to exhibit unpredictable or undesirable behavior.

 

Do not use busy waiting while analysis runs

A main tester program that invokes a separate tester program should not use busy waiting or spinlocks to wait for the analysis to be completed.

 

Pass images directly instead of writing to disk

Use the direct passing of images in order to avoid having to write files to disk, only for them to be immediately read back by Imatest IT.

The availability of high speed SSD and HDD caches may reduce the expense of repeatedly writing and reading from disk, but have other risks associated with them and  

 

Use analysis modules that combine tests

SFRplus and eSFR ISO perform many different calculations on a single image.  These modules will always perform better

 

For SFR tests, use multiple regions on a single image

Multiple region selections allow a single module to test multiple points on the image. If you are cannot use the combined anaysis modules mentioned above, and are forced to use SFR for sharpness tests, make sure to use the multiple region selection.

 

Set the MCR_CACHE_ROOT and MCR_CACHE_SIZE environment variables

To substantially reduce startup times of IT/DLL and IT/EXE call, create and set the  MCR_CACHE_ROOT environment variable to a folder for which the user has read/write access, and the MCR_CACHE_SIZE environment variable to a value of 900000000 or higher. When these environment variables are set, the lengthy decompression stage that happens during IT initialization results in the data being stored in the MCR_CACHE_ROOT folder, instead of a temporary directory that is deleted after IT exits. If the relevant decompressed data is already present in MCR_CACHE_ROOT, then the decompression stage is skipped and substantial time is saved (~10s).

Example:

For Windows Vista and above:

To permanently set this environment variable you can use the  setx command. Open a command window and enter the following (substitute the folder path with your desired path)

setx /m MCR_CACHE_ROOT "C:\Users\<this_user>\My Documents\MCR_Cache"
setx /m MCR_CACHE_SIZE "900000000"

Note the ‘/m’ indicates that the variable will be defined for all users and that the new environment variable is only available after the command window is closed.

For Windows XP, please follow Microsoft’s instructions for setting environment variables.

For Linux:

To make MCR_CACHE_ROOT and MCR_CACH_SIZE available for all users, append its definition to either /etc/environment or /etc/profile.

MCR_CACHE_ROOT="/home/<this_user>/Documents/MCR_Cache"
MCR_CACHE_SIZE=900000000

Otherwise, modify the ~/.profile or ~/.bashrc files to append the definition.

 export MCR_CACHE_ROOT=/home/<this_user>/Documents/MCR_Cache
 export MCR_CACHE_SIZE=900000000

 

 

See Also:

Read More

Java issue with OS X 10.10 Yosemite

Symptoms of the problem:

After upgrading OS X to 10.10, Imatest no longer starts

Source of the problem:

A newer version of the java virtual machine can conflict with the version used by Imatest.

Solution: 

  1. Open an OS X terminal window  (hit ⌘-Space 
  2. Enter the following command:
    sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.8*.jdk
  3. Press return and authorize the change by entering your OS X user password
  4. Download and install the latest Imatest full release (not the upgrade).
  5. Deactivate and reactivate your license. The license manager is found by selecting help>license manager in the tool bar.
Read More

JSON output file changes in Imatest 4.2

In Imatest 4.1 and before, JSON outputs values that included a single numeric outputs would be inserted within JSON arrays, for example:

"HeightPxls":[808],
"WidthPxls": [1296],

In Imatest 4.2+ numeric outputs will not include the extra arrays:

"HeightPxls": 808,
"WidthPxls": 1296,

This should simplify the parsing process, but programs that are expecting the old format will need to be updated.

For outputs that involve more than a single numeric value, the arrays are maintained.

Something you are looking for missing from the JSON outputs? Please contact support@imatest.com.

Not familiar with JSON? Sick of parsing CSV files? Read more about this incredibly useful and flexible data output format www.json.org.

Read More

Non-Latin characters appear as boxes in Windows 10

Non-Latin characters in the Imatest UI may appear as boxes in Windows 10, as shown.

Step 0

This is likely caused by not having the appropriate language pack(s) installed for your locale. You should not need to entirely switch the locale of your operating system.

The language resources mentioned in this post are provided by Microsoft and can be downloaded directly from your system’s control panel.

Before installing any language pack(s), exit Imatest. To install the desired language pack(s), access “Region & language settings” from the Windows 10 control panel. Alternatively, you can search for the terms “region language” in the start menu, as shown.

Step 1

From the Region & language settings window, select “Add a language”.

Step 2

Locate the language you wish to install. Repeat this step along with the previous for each language you wish to install.

Step 3

Windows 10 will download the necessary resources and automatically install the language pack

Step 4

At this point, the necessary language resources have been installed. Restarting your computer is recommended.

If, after restarting your computer, Imatest still is unable to display the desired language(s), return to the “Region & language” settings window. Select the desired language, and click “Options”. Depending on the language you wish to install, you may also need to Download additional resources, as shown.

Step 5

If you are still unable to view Imatest in your selected language, please contact support@imatest.com.

Read More