I want to find difference between two images.

1 回表示 (過去 30 日間)
faheem ifti
faheem ifti 2019 年 4 月 8 日
コメント済み: Image Analyst 2019 年 4 月 11 日
One is a partial image of the other. Size is same. How get rid of black border. Tried XOR after binarizing(some processing applied in between but general idea is XOR). Fine results in image area but unwanted results on and outside border
Test.png
  1 件のコメント
Walter Roberson
Walter Roberson 2019 年 4 月 8 日
What black border are you trying to get rid of?
I see a white border in the binary test image: are you referring to that ?

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

回答 (1 件)

Image Analyst
Image Analyst 2019 年 4 月 8 日
You can get the bounding box of the small image by doing
[rows, columns] = find(binaryImage);
row1 = min(rows);
row2 = max(rows);
col1 = min(columns);
col2 = max(columns);
% Now crop the image to remove black frame
croppedImage = binaryImage(row1:row2, col1:col2);
% Resize it
binaryImage = imresize(binaryImage, size(otherImage));
Now you can compare the images by subtraction or xor() or whatever.
  2 件のコメント
faheem ifti
faheem ifti 2019 年 4 月 10 日
Thanks sir
It works fine for the Test Image 2 against Reference image. But fails if the image is rotated as in image "Test Image 1". What can be an efficient method to restrict matching area of the two images only at the overlap of two images.
ask2.png
Image Analyst
Image Analyst 2019 年 4 月 11 日
Use a rotationally and scale invariant matching technique: Hu's image moments. See this link from the University of Arizona

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

Community Treasure Hunt

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

Start Hunting!

Translated by