Import of multiple images, problem with values
1 view (last 30 days)
Show older comments
Hi there,
I'm very new into Mathlab an programming. What I try to do is to import multiple images into Mathlab, and to calculate the mean value of a ROI.
The good news is, that it works. The bad is that I always get the value of the last image only. It seams to me, that the code calculates the first image's value and overwrites it with the next value and that is why I get the last value only.
My problem is, that I need all values.
Here is my code: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
clear all
file = dir('C:\Users\Icoo\Documents\MATLAB\iPro\Schwärzung\*.tif'); X = length(file);
for k = 1:X
% some code is missing here I guess. :)
end
Image = imread(fullfile('C:\Users\Icoo\Documents\MATLAB\iPro\Schwärzung\', file(k).name));
Image(:,:,1); % red channel
Image(:,:,2)=0; % green channel
Image(:,:,3)=0; % blue channel
M = mean(Image(:))*3; % calculates ROI's mean value
figure, imshow(Image); % shows red channel ROI impixelregion
figure, imshow(M); % shows mean impixelregion
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I realy hope somebody can help me out. :)
0 Comments
Accepted Answer
Image Analyst
on 23 Jan 2015
The "code that is missing" is contained in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
Use that and post your updated code if you still have trouble. And don't use Image as the name of a variable since image() is a built in function.
More Answers (0)
See Also
Categories
Find more on Explore and Edit Images with Image Viewer App 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!