differece image of 2 images

조회 수: 33 (최근 30일)
Sajitha K.N.
Sajitha K.N. 2019년 8월 28일
편집: Subhadeep Koley 2019년 9월 3일
How to calculate difference image of 2 images read from different folders?
  댓글 수: 2
Rik
Rik 2019년 8월 28일
If they are the same size you can just subtract one from the other. What have you tried so far?
Bjorn Gustavsson
Bjorn Gustavsson 2019년 8월 28일
And just to be clear, subtraction between data of for example uint8 might give you unwanted results, cast the images to doubles before subtracting:
diff_img1 = img1 - img2;
diff_img2 = double(img1) - double(img2);
% compare the two as you see fit

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

채택된 답변

Subhadeep Koley
Subhadeep Koley 2019년 9월 3일
편집: Subhadeep Koley 2019년 9월 3일
MATLAB provides imabsdiff function to find the absolute difference of two images. The following code might help you.
% read image from folder 1
image1=imread('yourImage1.png');
% read image from folder 2
image2=imread('yourImage2.png');
% calculate the absolute difference
absDiffImage=imabsdiff(image1,image2);
% plot the absolute difference image
figure;
imshow(absDiffImage,[]);
colormap(jet);
colorbar;

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by