Gamma calibration

Hi Chris,

Looking forward to the new releases. We now have two machines running 10.8 and we are hoping to start testing mworks in on our rigs in the next couple of weeks or so.

The most important thing we will need is the ability to gamma calibrate our monitors.
This is particularly important when we display very faint images and we need to linearize our monitors. Not sure how mworks does it now, most people don’t need except for maybe people who do gratings.

I am cc’ing my colleague Romesh on this, I’d like him to be part of the conversation since he will be able to give you details on how we do it here.

Best
Najib

Hi Najib & Romesh,

We now have two machines running 10.8 and we are hoping to start testing mworks in on our rigs in the next couple of weeks or so.

Great! If you run in to any issues, please let me know.

The most important thing we will need is the ability to gamma calibrate our monitors.

I had another inquiry about gamma corrections recently, so maybe this is a good time to address it. If you can give me the details on what you’re doing now, I’ll figure out how to make it work in MWorks.

Cheers,
Chris

The basic manual calibration procedure is as follows:

Present a full-field red screen at one of 8 values (from rgb[0 0 0] to
rgb[255 0 0]) in linear steps. Each stimulus should stay on the screen
until a key press. The user will then measure the screen luminance with a
photometer before advancing to the next stimuli. After all 8 levels have
been presented, fit the luminance readings to the levels with an
exponential (y=a*x^b), where x is the level, y is the luminance and b is
the gamma value of interest (a is a fudge factor amplitude). Do this for
blue and green. Using these gamma values for R,B,C, Use the inverse of the
gamma value to create a linear lookup table, which well then be used to
translate RGB values into luminance’s.

  • Romesh

Hi Chris,

Below are three websites that might be useful to think about.

The photometer way is the most accurate, but there are some images that help you do an approximate job, that would be good to have for people who don’t care about low contrast stimuli.
The image based routine is similar to what the mac provides under monitors, the “expert” calibrate option.

Best
Najib

http://apps.usd.edu/coglab/psyc770/USDCalibrate.html

http://www.psychopy.org/general/gamma.html

Hi guys,

Thanks for all the info. Let me think about this stuff for a bit and get back to you.

Cheers,
Chris

Hi guys,

I’ve been working on this and will give you a detailed update soon.

In the meantime, it looks like I need to purchase a photometer, as we don’t seem to have one in the lab. Do you have any specific recommendations on what I should get (i.e. manufacturer and model)? What do you use in your lab?

Thanks,
Chris

we use photoresearch pr650.

http://www.photoresearch.com/current/pr650.asp

but it might be overkill for a simple calibration. it is important for
calibrating color though. you might want to also try some of the cheaper
spectrometers, like the “datacolor spyder4express” :

http://www.bhphotovideo.com/bnh/controller/home?O=&sku=838843&Q=&is=REG&A=details

but the photodiode in the lab with voltmeter might be sufficient as well.
it depends on how deep you want to go.

best
najib

The PR650 was the standard spectrophotometer used in many vision labs. It’s
now discontinued.

http://www.photoresearch.com/current/spectroradiometers.asp

has a list of high-end photometers. If you can support the PR650/655 that
would be ideal (maybe see if you can barrow one), as it’s the one many of
us at NYU use.

  • Romesh

Hi all,

(I’ve added Lindsey Glickfeld to this discussion, as she asked a related question not long ago and got a much less detailed response from me.)

After spending a fair amount of time banging my head against the basics of color management and its implementation under OS X, I think I have a good understanding of how MWorks approaches these issues now and how we can improve things in the future.

What we do now

At present, MWorks does nothing to alter or correct color values provided by the user. More specifically, it performs neither full color matching nor simple gamma correction on input colors. Rather, input colors, whether read from image files or specified directly as RGB values, are implicitly treated as belonging to the color space of the display.

This has some unfortunate implications. For one thing, with a typical gamma-2.2 display, the default “medium gray” background (rgb(0.5, 0.5, 0.5)) will produce a luminance significantly less than 50% of maximum. Also, embedded ICC profiles in images are completely ignored, meaning, for example, that MWorks fails its own version of this test quite badly. (On the other hand, sRGB-encoded images should look more or less OK on a typical display, although color blending may be inaccurate.)

On the bright side, MWorks’ inaction means you can use other software to alter the display configuration without MWorks mucking things up. For example, you could use Gamma Control to alter the display’s gamma correction curve on the fly. Alternatively, to accomplish Najib and Romesh’s goal of linearizing the display, you could calibrate your display to gamma 1.0, store the calibration in an ICC profile, and assign the profile to the display in System Preferences.

What we can/should do in the future

There are a number of ways we could improve MWorks’ handling of color. Some are straightforward, while others require additional thought and discussion.

Perform color matching on image files

This seems like a no-brainer: Input images should be converted in to the color space of the stimulus display window. The pervasive awareness of color management throughout OS X and its APIs make doing this simple and straightforward.

Render visual stimuli in a linear color space

As mentioned previously, some operations in OpenGL require linear color to work correctly, so internally MWorks should perform all rendering in a linear color space.

A related but independent issue is the color space of explicitly specified RGB values. I imagine most users would expect rgb(0.5, 0.5, 0.5) to mean “gray at 50% max luminance”, so we should probably treat explicit RGB values as belonging to a linear color space, too. However, this approach has its own potentially negative implications. For example, when you use the standard OS X color picker widget, the RGB values you get out are in the system’s “Generic RGB” color space, which has a gamma of 1.8. If you then feed these values to MWorks, they’ll be interpreted as belonging to a gamma-1.0 color space and will therefore appear brighter than they did in the color picker.

There’s also the question of which linear color space to use. If the user is concerned with matching colors to external standards, then we need a color space with a standardized gamut (probably a “linearized” version of sRGB). On the hand, if it’s more important that the user be able to exercise the full gamut of the display, then we should use a linearized version of the display’s color space (as defined by its ICC profile), with the downside being that the actual colors shown will be device dependent.

Perform calibration/correction within MWorks

In addition to respecting the system-wide display color profile, MWorks could also provide ways to alter the display’s calibration.

Personally, I don’t think MWorks should be in the business of performing full-fledged display calibration and profiling. Other software packages (some open source) already do that job, and MWorks can (and should) make full use of the ICC profiles they generate.

However, we may want to make it easier for users to make display changes outside the scope of standard calibration and ICC profiles. For example, while MWorks would play no role in creating the custom gamma correction tables Lindsey needs for her use case, it could provide a means of loading them (from a file) at run time. Although the loading step could also be performed external to MWorks, clearly it’s easier on the user for MWorks to do so itself.

Getting back to the original question

Now that we’ve done a high-level survey of color issues and MWorks, let’s return to the specific question asked by Najib and Romesh: How can you gamma calibrate your monitor in conjunction with MWorks?

At present, MWorks won’t help you, but it won’t get in your way either. You have to calibrate yourself, using the tools of your choice, and apply the resulting calibration via an installed ICC profile or something like Gamma Control.

In the future, to make this process a little simpler, we could give MWorks the ability to load predefined gamma curves itself.

Alternatively, if MWorks were updated to (1) respect the ICC profiles embedded in image files and (2) treat explicit RGB color values as belonging to a linear color space, then all that would be required of the user would be to (a) provide appropriately linear input images/colors and (b) ensure that the display is accurately characterized by its assigned ICC profile. In that case, MWorks would ensure that the linear input colors are appropriately converted to the display’s color space.

For maximum flexibility, we should probably implement both of the preceding options.

Thus ends my treatise on color handling in MWorks. Please share your thoughts on the various issues and proposed paths forward.

Cheers,
Chris