HOW to work our light intensity of an image??

5 views (last 30 days)
task_m
task_m on 11 Aug 2013
how to work out the light intensity of an image? can someone provide me sample code to show this?

Answers (2)

Walter Roberson
Walter Roberson on 12 Aug 2013
An image is data. Data does not have a light intensity. Data might represent a light intensity. But you have to ask the question of whether it represents the transmitted intensity or the received intensity. And you have to ask about the relationship between the numbers in the stored data and the actual values (e.g., 3 might represent 3 millilumen, but 5 might represent 17 millilumen: the relationship is not necessarily one that is expressible in a simple equation, especially near the extremes of the possible values.)
  7 Comments
Image Analyst
Image Analyst on 14 Aug 2013
What I guessed from his comment was that he wanted to extract out (rather than work out) all regions or pixels in the image that were red, or blue, or green, or whatever color he specifies, though I could be wrong. Of course posting an image and describing what he wants to do or measure in it would be most helpful.
Walter Roberson
Walter Roberson on 14 Aug 2013
It looked to me that s/he is being asked to figure out which images are most nearly the same "contrastiness", possibly as one step in a CBIR.

Sign in to comment.


Image Analyst
Image Analyst on 14 Aug 2013
See my color segmentation demos in my File Exchange where I extract out parts of the image that are a certain color: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
  3 Comments
Image Analyst
Image Analyst on 14 Aug 2013
I suggest you have another person help you craft your question because it's taking way too long to make yourself understood. Perhaps you mean this, but I'm not sure
% Read in a standard MATLAB gray scale demo image.
myFolder = fullfile(matlabroot, '\toolbox\images\imdemos');
filePattern = fullfile(myFolder, '*.jpg');
jpegFiles = dir(filePattern);
subplot(2, 1, 1);
for k = 1:length(jpegFiles)
baseFileName = jpegFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
rgbImage = imread(fullFileName);
% Display color image.
imshow(rgbImage); % Display image.
drawnow; % Force display to update immediately.
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Get means
redMean(k) = mean2(redChannel);
greenMean(k) = mean2(greenChannel);
blueMean = mean2(blueChannel);
end
subplot(2, 1, 2);
plot(redMean, 'r-', 'LineWidth', 3);
hold on;
plot(greenMean, 'g-', 'LineWidth', 3);
plot(blueMean, 'b-', 'LineWidth', 3);

Sign in to comment.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!