Reputation: 1
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:
Upvotes: 0
Views: 1266
Reputation: 21647
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.
Upvotes: 0
Reputation: 80287
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.
Upvotes: 1