set up an array containing the images

7 Ansichten (letzte 30 Tage)
sukam
sukam am 11 Apr. 2020
Bearbeitet: sukam am 12 Apr. 2020
Hello everyone ,i am trying to solve this exercice i am stuglling finding out the code for the first part of creating an erray of the images any help is appreciated
Use the sequence of cell images ( 'AT3 lm4 01.tif , 'AT3 lm4 02.tif, ..."
"'AT3 lln4 09.tif', 'AT3 lln4 10.tif') provided in cmnbination with the Matlab irnabsd if f() function and a Matlab for loop const ruct to display an ani1nation of the differences between i1nages in the sequence."
You may wish to use an additional enhancement approach to improve the dy namic range
of difference images that result from the irnabsd iff() function. What is result of this differencing operation? How could this be useful?
H int. You may wish to set up an array containing each of the image file names 01 to 10.
The animation effect can be achieved by updating the same figure for each set of differences (e.g. between the kth and ( k - l)th images in the sequence) or by investigating the Matlab
irnplay() function to play back an array of itnages.
this what i did please correct if it's false
for i=1:9
fn=strcat('AT3_1M4_0',num2str(i));
fn=strcat(fn,'.tif');
I(:,:,i)=imread(fn);
end
I(:,:,10)=imread('AT3_1M4_10.tif');
for i=1:9
subplot(3,3,i)
D=imabsdiff(I(:,:,i),I(:,:,i+1));
imshow(D);
end
  5 Kommentare
Image Analyst
Image Analyst am 11 Apr. 2020
Did you ever try my code below? It works.
sukam
sukam am 12 Apr. 2020
i tried it s not working

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 11 Apr. 2020
Bearbeitet: Image Analyst am 11 Apr. 2020
Looks like it should work but you might use [] in imshow() to enhance the dynamic range as it suggested, and don't use i (the imaginary variable) as a loop iterator:
% Find the folder with all the demo images that ship with the Image Processing Toolbox.
folder = fileparts(which('AT3_1M4_01.tif')) % Determine where demo folder is.
for k = 1 : 10
baseFileName = sprintf('AT3_1M4_%2.2d.tif', k);
fullFileName = fullfile(folder, baseFileName);
if isfile(fullFileName)
thisImage = imread(fullFileName);
if k == 1
% Instantiate the whole 3-D array once we know the size of the first image.
[rows, columns, numberOfColorChannels] = size(thisImage);
allImages = zeros(rows, columns, 10, class(thisImage));
end
allImages(:,:, k) = imread(fullFileName);
imshow(allImages(:,:, k), []);
title(baseFileName, 'FontSize', 15);
drawnow;
end
end
hFig = figure; % Bring up a new figure.
hFig.WindowState = 'maximized';
for k = 2 : 10
subplot(3, 3, k-1);
diffImage = imabsdiff(allImages(:,:, k), allImages(:,:, k-1));
imshow(diffImage, []);
caption = sprintf('Image %d - Image %d', k, k+1);
title(caption, 'FontSize', 15);
end
though I'd do it somewhat differently than that (single loop instead of 2 loops)

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by