0

I need to transform thermographic images into gray-scale to detect temperature variation using matlab.

I tried to use the inbuilt function rgb2gray(), but it's inefficient for my image database, so I tried to compute the formula for this, using correlation between colours and temperature and then interpolating it, but then will be it possible to get the efficient mathematical formula?

My formula:

i=0.29 * rgb_img(:,:,1) + 0.59 * rgb_img(:,:,2) + 0.11 * rgb_img(:,:,3);

and

i=0.6889*rgb_img(:,:,1)+.5211*rgb_img(:,:,2)+.4449*rgb_img(:,:,3)+72.8;

but both of these didn't help.

sample images are:

http://www.google.com/imgres?imgurl=http://www.breastthermography.com/images/AP-Breast-Case-2.jpg&imgrefurl=http://www.breastthermography.com/case_studies.htm&h=199&w=300&tbnid=48Yto8Y8RtRPjM:&zoom=1&docid=PX1nchTaFQpa3M&ei=ftVdVIatNZCQuATptoLgCA&tbm=isch

Alex Kulinkovich
  • 4,408
  • 15
  • 46
  • 50
  • How about this one - [Convert a color image to grayscale in MATLAB without rgb2gray](http://stackoverflow.com/questions/22007612/convert-a-color-image-to-grayscale-in-matlab-without-rgb2gray) ? – Divakar Nov 08 '14 at 09:46
  • 2
    These are grayscale images that have had a colormap applied to generate the images shown, but you need the grayscale image back? Do you not have access to the original data prior to the colormapping? Otherwise you'll need to construct a reverse look-up table to go from color -> temperature value, then reference that for each pixel. A straight formula won't work as the colormap has discrete hue steps. – Staus Nov 08 '14 at 12:48

2 Answers2

1

There is small vertical multicolor bar at the right edge of images. It represents palette which has been used for Gray->Color transformation. If you can no access to exact formula for this thansform, you can try approximation: extract 1-pixel wide vertical line to array from bottom to top.
If resulting array length is not equal to 256, adjust the range (interpolate if needed). Now you have map: Color -> Index of this Color = 8-bit Gray Value. Use it to construct grayscale image. If you need absolute temperature, you can adjust range to 280-350 (in 0.1 degrees) or another suitable range.

MBo
  • 77,366
  • 5
  • 53
  • 86
  • Dude ,we tried the same and henceforth we got the second formula stated above which was calculated using the same technique but it is also ineffective for our case. – Ashok Arora Nov 10 '14 at 18:19
  • You tried linear dependency while but it is definitely non-linear (probably piecewise-linear) – MBo Nov 11 '14 at 06:41
0

The formula used in JFIF is

     Y = 0.299R +0.587G +0.114B

That's fairly close to what you have. So I do know what you mean when you say what you were using did not work.

user3344003
  • 20,574
  • 3
  • 26
  • 62