Improve change detection from subtracting 2 images

10 visualizzazioni (ultimi 30 giorni)
I created 2 normalized images ('start' and 'last') by taking the average over 1 week.
I'd like to detect the change over time by subtracting the images from each other.
Visually, it is clear that there is some movement of rocks in the bottom left corner.
How can I improve the change detection of the images by focusing more on the movement of the rocks?
Ultimately, we would like to detect how much the rocks moved.
% Choose reference image
reference_image = imread(Timex_l_com(1).name);
reference_image = rgb2gray(im2double(reference_image));
for kl = 1:3(Timex_l_com)
Timex_end = imread(Timex_l_com(kl).name);
% apply histogram equalization to each channel (R, G, B) separately
for i = 1:3
Timex_end(:,:,i) = histeq(Timex_end(:,:,i));
end
% RGB to gray for image registration
Timex_end = rgb2gray(Timex_end);
% Perform image registration
[optimizer, metric] = imregconfig('multimodal'); % Define optimizer and metric
Timex_end_reg = imregister(Timex_end, reference_image, 'rigid', optimizer, metric);
% Convert back to RGB image
map = hsv(256);
Timex_end_reg = ind2rgb(Timex_end_reg, map);
Timex_end_reg = im2double(Timex_end_reg); % Normalize the image from 0 to 1
Timex_end_reg = Timex_end_reg./max(Timex_end_reg(:));
% Crop image
Timex_end_reg(:,[1:a1min],:)=[];
Timex_end_reg([1:a2min],:,:)=[];
Timex_end_reg(:,[uint64(a1max-a1min+1):end],:)=[];
Timex_end_reg([uint64(a2max-a2min+1):end],:,:)=[];
% Create average
if kl == 1
sumTimex_end = Timex_end_reg;
else
sumTimex_end = sumTimex_end + Timex_end_reg;
end
end
sumTimex_end = sumTimex_end / numel(Timex_l_com); % Calculate the average
movement = imabsdiff(sumTimex_end, sumTimex_start);
figure;
imshow(movement,[]);
colormap(autumn);
colorbar;
  7 Commenti
prasanth s
prasanth s il 8 Feb 2023
lightning conditions and colors are different in two images. try preprocessing to correct that then apply 'imabsdiff'.
https://in.mathworks.com/matlabcentral/answers/520327-color-normalization-algorithm-under-various-lighting-conditions

Accedi per commentare.

Risposte (1)

Mandar
Mandar il 8 Feb 2023
The simple subtraction of two images might generate lot of false positives for several reason such as registration error, pixel movement etc. There many changes detection algorithms are available which process RGB images to identify the change between two images. You may find some pointers in the article ‘New Results in Change Detection Using Optical and Multispectral Images’ article to begin with.
  2 Commenti
Siegmund
Siegmund il 8 Feb 2023
Thanks Mandar, I'll take a look at the paper.
I thought is was going to be a lot more straightforward when I started :-)
Would the above code (with some improvements) at least give a good approximation of regions of change or is it just faulty to do this?
Mandar
Mandar il 8 Feb 2023
If you want to test the efficacy of the code, try out publicly available databases which includes image pairs and ground truth. You can do a fair comparison between change map generated by the code and the ground truth. This exercise will help you to identify how efficient your approach is. However, not sure about the availability of image pairs and ground truth that has similarity to images in above code. Hence, you may need to make some changes to get the expected results.

Accedi per commentare.

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by