How do I compare two images?
이전 댓글 표시
Hi
I have two images.

.jpg)
One was manually segmented and the other used an automated method. Both images segments the same interface, but the automated is cropped for faster computation.
I am looking for a method, to compare the two images, so I can estimate the accuracy of the automated segmentation. How can I compare them? E.g. how can I find whether the red pixels locations at both images are the same. If not, how do I define their differences?
Any ideas?
Thank you
답변 (2개)
Walter Roberson
2019년 3월 18일
1 개 추천
In the case where the two images are to the same scale, then use xcorr2 to find the place where the second image best fits into the first, after which you can do whatever comparisons using indexing.
If the images are not the same scale (e.g., the second one looks like it might be higher resolution) then you would need to do image registration in order to find the best match.
댓글 수: 5
Stelios Fanourakis
2019년 3월 18일
Walter Roberson
2019년 3월 19일
You probably need to crop down to the central area and then rgb2gray to get a 2D array that can be put through xcorr2. However I do not think that xcorr2 is suitable for operating on different scales.
Image Analyst
2019년 3월 19일
I also don't think xcorr2() is needed. You know where your automated algorithm cropped it, so you can simply use that information to extract the same rectangular ROI from your original, full-sized image, and THEN do the comparison. However I recommend using the method I mentioned rather than trying to find the red lines from each of the two images. I mean, you already have the coordinates of the red lines anyway since you used something like plot() to put them up there. You just need to subtract the cropping offset from the first one. You can use the (x,y) coordinates of the red lines with poly2mask() to create a binary image from which you compute the Sørensen–Dice simlarity index. I think I have a demo if you want it.
Stelios Fanourakis
2019년 3월 19일
Stelios Fanourakis
2019년 3월 19일
Image Analyst
2019년 3월 18일
0 개 추천
You have two ways of computing the segmentation. Which do YOU consider to be more accurate? If you want to compute accuracy, you must have some ground truth - some segmentation that YOU DEFINE to be the absolutely 100% correct answer. I'm assuming you think the manually traced one is the ground truth and want to see how well the automatic algorithm matches the manual one. To do that, you first need to crop out the regions so that both images have the same field of view (all corners point to the same physical points in the subject/sample in both images). Now you can crop the segmented (binary) images the same way and compare them with a similarity index, for example, the Sørensen–Dice coefficient or friends. See this link.
댓글 수: 4
Stelios Fanourakis
2019년 3월 19일
Stelios Fanourakis
2019년 3월 19일
편집: Stelios Fanourakis
2019년 3월 19일
Stelios Fanourakis
2019년 3월 19일
Stelios Fanourakis
2019년 3월 19일
카테고리
도움말 센터 및 File Exchange에서 Template Matching에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!