Strings help! URGENT!!!

Im having problems with this code, i am trying to reading ten image files, i then want to average the files as i have done. This part works.
However after doing this i want to output ten files of a string which contains the ten images after they have been averages so i can view them individually.
%reading all ten images
fileread = {'image001.png' 'image002.png' 'image003.png' 'image004.png' 'image005.png' 'image006.png' 'image007.png' 'image008.png' 'image009.png' 'image001.png'};
for i = 1:10
fileread2{i} = sprintf('scan %.f', i);
end
% Input of a numerical threshold value
threshold = input('Enter a threshold value to estimate active bloodflow: ');
%determining whether the threshold value lies between the parameters
while threshold > 255 || threshold < 0
disp('The threshold value is not a valid value')
threshold = input('Enter a threshold value to estimate active bloodflow: ' );
end
%Analysing images 1:10
pixels = zeros(1:10);
for i = 1:10
images = imread(fileread{i});
pixels(i) = length(find(images > threshold));
fprintf('scan %s has %.f pixels above the threshold \n', fileread2{i}, pixels(i))
end
for i = 1:10
images = images(1:10);
for x = 2:199;
for y = 2:199
avg = [images(x-1, y-1:y+1); images(x, y-1:y+1); images(x+1, y-1:y+1)];
images(x,y) = mean2(avg);
end
end
end
Any assistance would be greatly appreciated...

답변 (1개)

Sean de Wolski
Sean de Wolski 2011년 5월 12일

0 개 추천

pixels = zeros(1,10); % pixels(1:10) will create a 10D array with 10! elements.
Same with images
To save the images for viewing use a cell array:
the_images = cell(10,1);
for ii = 1:10
the_images{ii} = imread(...);
end
%to view image four
%imshow(the_images{4})

댓글 수: 2

Walter Roberson
Walter Roberson 2011년 5월 12일
I think Sean meant:
pixels = zeros(1,10); %zeros(1:10) will create a 10D array with 10! elements
Sean de Wolski
Sean de Wolski 2011년 5월 12일
Thanks Walter. Note to self: don't log online prior to at least five gulps of coffee.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Environment and Settings에 대해 자세히 알아보기

질문:

2011년 5월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by