How to convert a color image to grayscale

Sometimes an undemosaiced Bayer raw image gets improperly saved into a BMP or TIFF format that includes color channels that are all equal. In this case, Imatest will recognize the image as color, and not give you the monochrome read options that allow you to perform demosaicing or analyze the image as a Bayer raw.

Here are a variety of ways to convert a color image to grayscale:

Imagemagick command line utility

$ convert -type Grayscale rawcolor.bmp mono.bmp

GIMP / Photoshop

Image -> Mode -> Grayscale



From Image -> Tyoe -> Select the desired output bit depth


Ctrl-G or from the image menu select Convert to Grayscale


img = imread('rawcolor.bmp');
r = img(:, :, 1);
imwrite(r, 'mono.bmp');


Read More

Avoiding reflections on transmissive charts for dynamic range and flare testing

The testing of dynamic range and flare requires a proper test chart and environmental setup to get accurate results.High precision and high-density chart technologies such as photographic film or chrome on glass come with the disadvantage of glossiness which makes them susceptible to specular reflections on the target. This affects the use of dynamic range or contrast resolution and backlit flare targets that lack anti-reflective patches. 

The goal of the backlit test setup is to maximize the fraction of light that is coming directly from your light source, through your test target, and into your lens, Any additional light that is present in your system can disrupt your measurements either by causing reflections on the analysis patch of your target, or otherwise introducing additional flare (veiling glare) into the image.

As the optimal lens and camera body housing will be manufactured with anti-reflective coating, it is good to take a similar approach with your test environment.  Nothing is actually entirely black, but dark, opaque materials come in many different forms. These can be characterized by their total hemispherical reflectance (THR).

Here are how some dark materials compare:

Product THR (vis+NIR) Notes
Black Paint 5-6% Not dark enough
Black Felt 2.5% Flexible and low-cost
Acktar black 1.5% Comes on adhesive foil
Vantablack 0.17% Costly, not durable, dangerous to humans

For general testing purposes, we use black felt for covering our darkened test box

Block all light from entering or reflecting inside the testing environment

For accurate testing, you should create a dark space where no outside light is able to enter, and as much internally generated light is absorbed. Here is a diagram of a test environment:

Minimize internal direct reflections

The more that the surfaces in your test environment are lit up, the more they will become reflections in the glossy chart.

The body of the camera under test or even just glass of a camera lens can reflect back onto a test chart.This is especially important incident towards dark analysis regions.

If using Imatest charts that are properly centered, the reflection might not fall on to a dark analysis region for dynamic range measurement. Here is an example of a reflection of a dev kit PCB that would disrupt dynamic range or contrast resolution measurement:

Reflective camera parts should be blocked by black masks. The entire area behind your camera will directly be reflected back, so this environment should be made as dark as possible.

Minimize other internal light emissions

Sensor development kits often have blinking LED’s that reflect directly, Front facing cameras with displays that are not disabled or blocked off can be particularly problematic.

Read More

DMX Lighting Control Software

Lights such as the Kino Flo Select 31 LED use a DMX control interface to signal changes of light level and color temperature.

DMX is an open protocol and there are a large number of possibilities for hardware and software control. I’ve tried out several of these are more oriented to stage control
For DMX controller hardware I have personally tried and will recommend the Enttec DMX USB Pro controller worked well for us.
For computer control software with a user Interface, the one that has worked best for me so far is the Q Light Controller Plus (QLC+) which has nice cross-platform support.
For light control software that provides an automated API, the best one I have found, and the one we use to automatically control lights in our lab is the Open Lighting Architecture (OLA). The downside of this is that it only has good support for Linux. I have attached a python script that includes an example OLA calls, along with calls to an isolight puck, which you can overlook.  Here is a basic call to set the lights to middle color temp and maximum intensity:
from ola.ClientWrapper import ClientWrapper
intensity = 255
cct       = 127
universe = 1
data      = array.array('B') 
wrapper = ClientWrapper()
client = wrapper.Client()
client.SendDmx(universe, data, DmxSent)
Our goal for Imatest 5.3 is to have an instrument control interface built into Imatest Master that can directly communicate with DMX hardware.


Read More

Error in Extracting CTF file

Error Message: Error in extracting CTF file to ‘C:\ProgramData\Imatest\mcr_cache\4.5\Master\mcrCache9.0.1\imates0’. Details: ‘Could not set last modified time: C:/ProgramData/Imatest/mcr_cache/4.5/Master/mcrCache9.0.1/imates0/toolbox/imaq/imaqextern/drivers/win64/genicam/genICam_v2_4/redist/Microsoft_VC80_CRT_x86_x64.msi: Broken pipe


Your system is having trouble extracting Mathwork’s CTF archive. Here is what the possible causes are:
  1. Permissions issue. For example if the application is unable to delete old directory or create a new one.
  2. Time stamp issue. The CTF-file is re-extracted only when the time stamp on the CTFarchive is newer than the time stamp on the _mcr directory. If somehow an out-of-date _mcr folder has a newer time stamp than the CTF-file, the new CTF-file will not be extracted and there will be errors when running the application.
  3. Extraction issue. If some error occurred during CTF extraction, there could be a problem where some of the encrypted M-files are of an old version and others are the new versions. This could cause the application to partially run and then only have an error when it runs into an old encrypted M-file.
  4. Installer issue. If the _mcr directory is already in the package, the installer may not be updating all files properly leaving some older files in the _mcr directory thinking that the files already exist.
So, here are the steps you should try to resolve this:
1. Delete old MCR directories on your machine. These can be found at C:\Program Files\MATLAB\MATLAB Runtime, delete the contents of this folder.
2. Run the Imatest installer again as administrator, ensuring that the “Matlab Libraries” checkbox is checked and that you are running the full installer rather than the upgrade installer:
Inline image 1
3. After the installer finishes, run Imatest as administrator.
If this process does not fix the issue please email us,
Read More

Imatest Stops Working – Advanced Troubleshooting

Recovering Mathworks Log Files

Please recover this log file and send to

The log file name is called “mathworks_<username>.log”. Where <username> is the username of the user that ran the installer. Please see the instructions below to locate the log file depending on your OS.

Windows 10 \ Windows 8 \ Windows 7 \ Windows Vista

The installer log file will be located in the AppData\Local\Temp directory under the user account who ran the installer. The full path, as an example, is:


A shortcut to get to this path is to enter the following into the address bar of File Explorer window, then press Enter:


Windows XP:

The directory is:

C:\Documents and Settings\<username>\Local Settings\Temp\mathworks_<username>.log


The log file will be located at the following location:


Mac OS X:

Follow these steps to retrieve the installer log file on a Mac:

1. Log in as the user who ran the installer.

2. Open a Terminal window (you can use Spotlight Search to find Terminal)

3. Copy and paste the following command, and press enter to run it in Terminal. Do not edit the command, run it exactly how it appears below:

cp $TMPDIR/mathworks_$USER.log ~/Desktop

This will create a copy of the installer log file on the desktop. If the command fails, this means the installer log file is not being created. This could indicate that the installer is starting at all, and is thus not able to write the log file. If that is the case, additional information may be able to be obtained from the Console:

Applications – Utilities – Console (or use Spotlight Search to find the Console application)

Use the ‘Clear display’ button to clear out previous console messages. Then try running the installer again and see what is recorded in the console. You can save this information from console. This output may be helpful in addition to the installer log file.

All operating systems:

Forcing the creation of the log file in a specific location:

If the installer is not creating a log file, then you may need to create your own. You can run the installer in command prompt or terminal with a flag to force a log file to be created. You could use a command like the following to do this:


/full/path/to/setup.exe -outputfile “C:\path\to\logfile.log”



./install -outputfile /path/to/logfile.log

As a note, you can drag the installer into command prompt or terminal and command prompt will automatically populate the path of the installer for you. When defining where the log file will go, make sure it is a directory that you have write permissions. You may need to run command prompt as administrator (Windows) or the installer as sudo (Linux/Mac) in order to do this. 

Read More

Handling an Lightroom for iPhone RAW DNG file

Adobe DNG converter for windows & mac can be used to re-save iPhone RAW files into supported DNG formats using the following custom settings:

We soon hope to will be adding native support for LightroomiPhone DNG RAW.


Read More

Calculating Field of View (FoV) using distance settings

For accurate calculation of field of view (FoV) from using Imatest’s SFRplus, eSFR ISO, or Checkerboard, modules, it is critical to use proper distance measurements entered into in centimeters into the more settings window.

Lens to chart distance (in centimeters) can be best measured by a laser range finder.

For SFRplus it’s the bar to bar height is measured from the top of the top bar to the bottom of the bottom bar.

For eSFR ISO this is the vertical distance between the registration marks in centimeters.

Checkerboard uses the size of the squares.

Read More

Automating CPIQ analysis Using Imatest IT and Python

The Python interface to Imatest IT provides a simple means of invoking Imatest’s tests. This post will show how Imatest runs can be automated, then the results of those tests can be collected and easily processed. For this example, we will run five Imatest modules across three light levels, then extract CPIQ quality loss metrics.

Development Setup

Image Collection

For each device, we capture the following set of images of different test charts at different light levels:   (Note: full details will be available with the publication of the standard in March of 2017)

  • DeviceX_eSFR_5000KLED_1000lux.JPG
  • DeviceX_eSFR_TL84_100lux.JPG
  • DeviceX_eSFR_Tung_10lux.JPG
  • DeviceX_Dot_5000KLED_1000lux.JPG
  • DeviceX_Dot_TL84_100lux.JPG
  • DeviceX_Dot_Tung_10lux.JPG
  • DeviceX_SG_5000KLED_1000lux.JPG
  • DeviceX_SG_TL84_100lux.JPG
  • DeviceX_SG_Tung_10lux.JPG
  • DeviceX_Coins_5000KLED_1000lux.JPG
  • DeviceX_Coins_TL84_100lux.JPG
  • DeviceX_Coins_Tung_10lux.JPG
  • DeviceX_Unif_100lux.JPG

Running All The Tests

Once we have these images collected in a folder named “DeviceX”, we define our lighting conditions, initialize the Imatest IT library and run our processing function on this and a number of other devices:

led5k = "5000KLED_1000lux"               # Light Levels
tl84 = "TL84_100lux"
tung = "Tung_10lux"
light_conditions = [led5k, tl84, tung]
imatest = ImatestLibrary()
phones = ['DeviceX',                     # Just for example...
for phone in phones:


The main processing script invokes the five modules, collects their data outputs and saves them to a JSON file:

def calc_phone(phone):
    print('Calculating Metrics for '+phone+ ' *****************************')
    uniformity_results = uniformity(phone) # Uniformity
    multitest_results  = multitest(phone) # Multitest
    dotpattern_results = dotpattern(phone) # Dot Pattern
    esfriso_results    = esfriso(phone) # eSFR ISO
    random_results     = random(phone) # Random

    # Output data to disk
    file_name = os.path.join(images_dir, phone, phone + '.json')
    with open(file_name, 'w') as outfile:
        full_data = {'multitest'  : multitest_results,
                     'dotpattern' : dotpattern_results,
                     'esfriso' : esfriso_results,
                     'random' : random_results,
                     'uniformity' : uniformity_results}
        json.dump(full_data, outfile, indent=4, separators=(',',': '))

    return full_data

We call the Imatest eSFR ISO module for each specified lighting condition:

# eSFR ISO (ISO 12233:2014) is used to test Visual Noise (VN) 
# and Spatial Frequency Response (SFR)
def esfriso(base):
    global images_dir, ini_file, light_conditions, op_mode
    output = {}
    for light_source in light_conditions:
        print('Testing ' + base + ' eSFR ISO at ' + light_source)
        input_file = os.path.join(images_dir, base, base+'_eSFR_'+light_source+'.jpg')
        if os.path.exists(input_file) != True:
            raise Exception('File ' + input_file + 'not found!')
        print('opening ' + input_file)
        result = imatest.esfriso_json(input_file=input_file, root_dir=root_dir, 
                                      op_mode=op_mode, ini_file=ini_file)
        data = json.loads(result)
        output[light_source] = data['esfrisoResults'];

return output

On the fly INI file changes

The most difficult part of this processing is to manually update region selections for the calls to Multitest, which does not yet have automatic region detection for the Colorchecker SG target (coming soon…).

In this case, we are we replacing the [sg] roi, nwid_save, and nht_save keys with the values stored in this multicharts-rois.json file:

"DeviceX_SG_5000KLED_1000lux.JPG": "468 417 2122 1578 468 1588 2102 397",
"DeviceX_SG_TL84_100lux.JPG":"482 376 2142 1571 482 1561 2157 376",
"DeviceX_SG_Tung_10lux.JPG":"386 336 2016 1492 401 1497 2021 321",

We use this script to modify INI files to dynamically insert different settings:

import ConfigParser

def get_config(path): # Used make ConfigParser case sensitive
    config = ConfigParser.ConfigParser()
        return config
     except Exception, e:

def setROI(roi,width,height):
    global ini_file
    imatestini = get_config(ini_file)

    imatestini.set('ccsg', 'roi', roi)
    imatestini.set('ccsg', 'nwid_save', width)
    imatestini.set('ccsg', 'nht_save', height)
    with open(tempINI, 'w') as outfile:

These functions are then called using the values loaded from the JSON file inside of our multicharts function call:

    roi_overrides = {}
    roi_overrides_lower = {}
    roi_override_file = os.path.join(images_dir,base,'multicharts-rois.json')
    if os.path.exists(roi_override_file):
        with open(roi_override_file,'r') as fh: # read ROI override file
            roi_overrides = json.load(fh)
        for override, rois in roi_overrides.iteritems(): # convert to lowercase
            roi_overrides_lower[override.lower()] = rois
        raise Exception('ROI override file ' + roi_override_file + ' not found.')
    if image_file.lower() in roi_overrides_lower:
         setROI(roi_overrides_lower[image_file.lower()], roi_overrides['width'], roi_overrides['height'])
         selectedINI = tempINI
         raise Exception('Missing ROI override for ' + image_file)

Extracting Scores

Finally, we extract Key Performance Indicators (KPI), which are all in perceptual quality loss (QL) in units of just noticeable differences (JND).  This script is a bit long for this post, so view the source on Github if you are interested./

Here is the resulting set of calculated metrics in JSON format:

{ 'DeviceX': 
    { 'CL_QL': { '5000KLED_1000lux': 0.9142,
                 'TL84_100lux': 0.1803,
                 'Tung_10lux': 2.565},
      'CU_QL': 0.07498,
      'LCD_QL': 0,
      'LGD_QL': 0,
      'SFR_QL': { '5000KLED_1000lux': 0.0,
                  'TL84_100lux': 0.1969,
                  'Tung_10lux': 0.3946},
      'TB_QL': { '5000KLED_1000lux': 1.2,
                 'TL84_100lux': 6.25,
                 'Tung_10lux': 9.1},
      'VN_QL': { '5000KLED_1000lux': 1.113,
                 'TL84_100lux': 2.409,
                 'Tung_10lux': 8.531}},
      'Combined_QL': 11.0245

Once test procedures and combined score calculations are finalized by the IEEE Conformity Assessment Program, these outputs will be combined into a simple camera phone rating score.

The full python source code for this example is posted on GitHub.

To add these automation capabilities to your existing Imatest Master license, upgrade to Imatest Ultimate. You can also request a free 30-day trial of Imatest IT to see how this works for you before you purchase.


Related Webinars

Join us March 1 for Automating Lab and Manufacturing Processes: Defining image quality parameters on automated test equipment. Register now

Read More

The Effects of misregistration on the dead leaves cross-correlation texture blur analysis

This paper was given as part of the Electronic Imaging 2017 Image Quality and System Performance XIV and Digital Photography and Mobile Imaging XIII sessions.

When: Tuesday, January 31, 2017, at 12:10 pm

By: Robert Sumner with support from Ranga Burada, Noah Kram (more…)

Read More

Measuring MTF with wedges: pitfalls and best practices

This paper was given as part of the Electronic Imaging 2017 Autonomous Vehicles and Machine session.

When: Monday, January 30, 2017, at 10:10 am

By: Norman Koren with support from Henry Koren, Robert Sumner (more…)

Read More

Best practices for using transmissive test charts


Light Source

Side chart largeThe most uniform light source available would be an integrating sphere, but these come with considerable size and expense. After considering how the light source uniformity impacts their results, most lab & manufacturing tests use LED or fluorescent lightboxes with flat-panel diffusers. (more…)

Read More

How to get support for your image acquisition hardware

Not all hardware is supported by Imatest 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 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. (more…)

Read More

Account Administration for Floating Licenses

Floating licenses can remove a lot of headache in keeping track of your licenses by allowing everyone on your team to use the same license. However, Imatest licenses require that the license code by assigned to one user account. This can be handled in one of two ways.


Assigning the license to one admin user


This is the easiest to implement method, and it’s how we have done it internally at Imatest. The user should not be the license purchaser, because the user’s store account will be used by the rest of the team.


  1. If the designated admin does not have an Imatest store account, they can create a new account on the Imatest customer portal.
  2. The admin user should then activate Imatest using their Imatest store account.
  3. The license is now “assigned” to that admin user that activated Imatest.
  4. The admin will share their account login details with all other users who will use that admin user account to activate Imatest on their machines.


If a company’s admin user changes for any reason, please contact us at, and we can quickly change to a different user that you designate.


Using a general licensing email account


This method requires the generation of a general email account unused by others, but it needs to be real in order for the email verification to work.


  1. Create an email account, like This email will be used for license support renewal notifications so the emails should get forwarded to the appropriate person.
  2. Use the generated email to create an Imatest store account via the Imatest customer portal.
  3. Have a user activate Imatest using the store account created in step 2.
  4. The license is now assigned to that store account with generic email.
  5. Provide the login details (email and password) for the general admin account to all users so they can activate Imatest on their specific machine.
Read More

Imatest shuts down intermittently due to video driver problem


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) 


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


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:



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. As of 5.1 ITP is now rolled in to IT.


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).


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.


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.


  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

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

Read More