How to read light intensity values on jpg image
Show older comments
I'm working on a project on fluorescence thermography. I am a beginner for matlab and I am looking for the matlab steps and command to import and read the fluorescence intensity values on gray scale (not color) images captured (in .jpg). These values are requred to interpret the temperature values at various points.
Any help for detailed steps is appreciated! Thanks.
Accepted Answer
More Answers (2)
Walter Roberson
on 3 Jan 2013
FLreadings = imread('YourInputImageName.jpg');
if ndim(FLreadings) > 2
error('Try again with a grayscale image')
end
Then for any particular point row R column C, FLreadings(R,C) will be the intensity reading as stored in the image.
3 Comments
Jurgen
on 3 Jan 2013
Providing the jpeg doesn't have gamma correction.
Walter Roberson
on 3 Jan 2013
JPEG does not itself do gamma correction: it just works on the exact values passed to the JPEG creation software, and reads back as close to those values as the lossy compression permits.
Jurgen
on 3 Jan 2013
You are correct that it is not part of the JPEG algorithm. But we don't know what process generated the JPEG. Typical consumer software also does other things to make a picture presentable. Since they are "captured in jpeg" I can only assume it is not a custom scientific camera?
Ling Fang Toh
on 3 Jan 2013
0 votes
3 Comments
Image Analyst
on 3 Jan 2013
Evidently you didn't try Walter's code, where it would warn you if you tried to read in a colored image. You can't use imhist() on a color image. You need to save your original thermal image in the original monochrome matrix, not the pseudocolored (color mapped) RGB version of it.
Walter Roberson
on 3 Jan 2013
Your image is not grayscale then. It might be RGB in which all three planes are identical, and thus be a Truecolor image that happens to consist entirely of grays. Try
I2 = FLreadings(:,:,1);
imhist(I2)
Image Analyst
on 3 Jan 2013
I don't know why but it seems like everyone who comes here and asks about thermal images has the pseudocolored image, unfortunately. Probably because the native format is a vendor proprietary floating point format where each pixel is the actual temperature in degrees Celsius, and people don't have MATLAB code to read those proprietary formats (like I do) so they just save data out as an 8 bit grayscale or colored bitmap image. But then all or most of the true actual temperature information is lost. Even if you have the color map, the best you can get is the grayscale image, not the actual temperatures. You'd need additional calibration information on what temperature got assigned to what gray level.
Categories
Find more on Lighting, Transparency, and Shading in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!