2
$\begingroup$

I'm studying Fourier optics and Interferometry and I intend to determine the contrast of an image using computer software. My teacher of Experimental Physics didn't tell me how to do it, and so, I'm requesting some attention from physicists that have already done this kind of analysis.

The contrast can be expressed as:

$$K=\frac{I_{max}-I_{min}}{I_{max}+I_{min}}$$

Consider the following interference spectrum where the object is an soldering iron:

enter image description here

I think it should be possible to measure the contrast, knowing the color of the pixels and their distribution in a certain region.

I know that intensity is proportional to the brightness of the regions. For example, to determine a quantity proportional to $I_{max}$, I just need to study the bright stripes of the image, and the dark ones for $I_{min}$.

My problem here is which software I should use? And is the previous method good to achieve my objective?

$\endgroup$

3 Answers 3

4
$\begingroup$

Whatever software you use (e.g. ImageJ), you must convert the image from sRGB colorspace to a linear colorspace first. To convert to linear RGB using ImageJ, you should convert the image to 32 bit first, divide by 255 and then run the math macro:

if(v<0.040445) v = v/12.92; if(v>0.04044) v = pow((v+0.055)/1.055,2.4)

and then multiply by 255 again.

The gray values of the pixels will then be proportional to the light intensity at the corresponding photo-sites.

$\endgroup$
4
  • $\begingroup$ Why would you pick this particular conversion? You don't know how the image file was created, neither does the OP, so there is no way to reconstruct the actual physical contrast from the image data. $\endgroup$
    – CuriousOne
    Commented Mar 13, 2016 at 0:59
  • $\begingroup$ @CuriousOne In principle any arbitrary conversion could have been used, but if the image was meant to be displayed on a computer screen then it is quite likely that it had been converted to sRGB. Given some arbitrary nonlinear transform, you can attempt to find the transform back to linear colorspace by considering out of focus areas of the picture. Some high contrast transition from brightness v1 to v2 will due to blurring be displayed as a brightness profile that changes from v1 to v2 gradually. In linear colorspace these functions from different areas are related via a scaling transform. $\endgroup$ Commented Mar 13, 2016 at 4:42
  • $\begingroup$ This allows you to deduce the transform to linear colorspace that will make the brightness profiles across blurred high contrast areas satisfy the scaling relations that they should satisfy. $\endgroup$ Commented Mar 13, 2016 at 4:45
  • $\begingroup$ The way Apple calibrates their screens is different from the way it's being done on PCs and if you use the color picker tool, it gives you multiple choices. One can pick the "native values", "srgb", "generic rgb" or "Adobe rgb". Moreover, I can calibrate my screen both on the Mac and the PC with a large number of options to optimize color reproduction. The same is true for digital cameras which sometimes have a dozen or more image calibration constants. There is not "one" way of encoding an image and every time you transcode for a different format you are likely to encounter another one. $\endgroup$
    – CuriousOne
    Commented Mar 13, 2016 at 5:05
2
$\begingroup$

ImageJ contains all of the tools you will require, is widely used, and is free. You can even add your own processing modules to extend its capabilities.

Usually the camera used will have to be taken into account when converting pixel brightness into intensities; for scientific work we usually use linear CCD cameras, where the vendor has done the calibrations for us.

Otherwise refer to the ImageJ tutorial for advice.

$\endgroup$
2
$\begingroup$

You could use Matlab: load the image into an matrix, and then find the maximum and minimum entries of the matrix. Plug these into your equation to find the contrast.

Alternatively, for higher accuracy, you could take the lowest and highest (say) 100 values and take the average of those to give you your Imin and Imax, respectively.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.