Numerical Analysis of changes happening in subsequent image difference

1 Ansicht (letzte 30 Tage)
Suppose I have 25 images. Next, I subtract the 1st image from subsequent images. It means now I have (2nd-1st), (3rd-1st), (4th-1st).....(24th-1st) and (25th-1st) images. Suppose I name these differences asas T21, T31, T41,....,T241 and T251 respectively. I want to analyze the changes happening between these i.e. between T21 and T31, between T31 and T41 and so on. I am able to see these changes as an image but how can I visualize it numerically and quantitatively?
Can anyone please suggest some methods to analyze and visualize these changes?
In case my query is not clear, feel free to write.

Akzeptierte Antwort

Image Analyst
Image Analyst am 23 Jan. 2023
Try this:
% Specify the folder where the files live.
myFolder = 'C:\Users\yourUserName\Documents\My Pictures';
% Check to make sure that folder actually exists. Warn user if it doesn't.
if ~isfolder(myFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s\nPlease specify a new folder.', myFolder);
uiwait(warndlg(errorMessage));
myFolder = uigetdir(); % Ask for a new one.
if myFolder == 0
% User clicked Cancel
return;
end
end
% Get a list of all files in the folder with the desired file name pattern.
filePattern = fullfile(myFolder, '*.png'); % Change to whatever pattern you need.
theFiles = dir(filePattern);
% Read in first file
baseFileName = theFiles(k).name;
fullFileName = fullfile(theFiles(k).folder, baseFileName);
image1 = imread(fullFileName);
subplot(2, 2, 1);
imshow(imageArray); % Display image.
title(baseFileName);
theDifference = zeros(1, numel(theFiles));
for k = 2 : length(theFiles)
baseFileName = theFiles(k).name;
fullFileName = fullfile(theFiles(k).folder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
% Now read it in as an image array with imread()
imageArray = imread(fullFileName);
subplot(2, 2, 2);
imshow(imageArray); % Display image.
title(baseFileName);
% Now subtract first image from it
diffImage = imabsdiff(imageArray, image1);
theDifference(k) = mean(diffImage, 'all');
subplot(2, 2, 3);
imshow(diffImage, []);
caption = sprintf('Image #%d out of %d', k, numel(theFiles));
title(caption);
% Plot the difference
subplot(2, 2, 4);
plot(theDifference, 'b.', 'LineWidth', 2, 'MarkerSize', 15);
drawnow; % Force display to update immediately.
end

Weitere Antworten (1)

Avinash
Avinash am 12 Jan. 2023
As per my understanding , you are trying to subtract one image from many other images, and want to see the difference between the images in the form of numeric data
  1. First, you can read images using imread function
  2. Then using a for loop, you can subtract one image from other images using imsubtract function
  3. The output result of imsubtract function is a numeric value.
You can refer to the following links to know more about imread & imsubtract functions
Thanks
Avinash
  3 Kommentare
NAVNEET NAYAN
NAVNEET NAYAN am 24 Jan. 2023
I have already subtracted the 1st image from subsequent images. I wanted to visualize that differences of each current image and 1st image. Also, I wanted to compare these differences.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by