Error in imabsdiff of two images

2 ビュー (過去 30 日間)
swati mane
swati mane 2019 年 7 月 17 日
編集済み: madhan ravi 2019 年 7 月 19 日
I want to do the operation on two images.I have total 4 images ..first I want to use image 1 and image 2 and then image 3 and image 4. I am getting error in imabsdiff. I need your help.
My code is:
imgFiles=dir('*.jpg');
numFiles=length(imgFiles);
for n=1:numFiles
img=imgFiles(n).name;
compareimg=imgFiles(n+1).name;
P=imabsdiff(img,compareimg);
figure
imshow(P,[]);
end

採用された回答

Walter Roberson
Walter Roberson 2019 年 7 月 17 日
You are trying to take the image difference between file names. You need to read in the files and compare the contents.
  5 件のコメント
Jan
Jan 2019 年 7 月 17 日
@swati: I've formatted your code to make it readable. You can do this by your own also.
If n==numFiles the expression imgFiles(n+1).name must fail. So you can run the loop until numFile-1 only.
swati mane
swati mane 2019 年 7 月 19 日
編集済み: madhan ravi 2019 年 7 月 19 日
Thank you very much @ Walter Roberson and @ Jan.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by