How to read a subplot as an image and find correlation for two images?
Show older comments
Hi, I am writing a code for image segmentation where it takes multiple images as input and the output is as follow for each images.

The relevent code is:
figure(k);
subplot(1,2,1);
imshow(imageArray,[]);
title('Image');
subplot(1,2,2);
imshow(imageArray,[]);
hold on
for i=1:length(B)
plot(B{i}(:,2),B{i}(:,1), 'y' ,'linewidth',1.45);
end
title('Segmented Tumor');
hold off;
Where B is defined in the code. My goal is to find the correlation of two images (Chosen by the user), and correlation value is shown for the second subplot of the selected images, that is "Segmented Tumor" . How can I do it?
4 Comments
DGM
on 28 Jun 2021
I don't understand what you're actually asking. Are you trying to find the correlation coefficient between two different images? That would make sense, but your question and code seems to be asking how to find correlation between an image and the same image with a plot drawn on it -- which doesn't seem like it would be useful to know.
Either way, you can use corr2() to find the correlation coefficient, but I'd recommend against trying to operate on plotted copies of images. Imshow() resizes and does nearest-neighbor interpolation on images. You'd likely be operating on a severely degraded copy of your data. Plots should generally be considered for viewing purposes only.
Tawsif Mostafiz
on 28 Jun 2021
Edited: Tawsif Mostafiz
on 28 Jun 2021
DGM
on 28 Jun 2021
But just to be clear, you're trying to find the correlation coeff between an image and the image with the plot line drawn on it, right?
Tawsif Mostafiz
on 28 Jun 2021
Edited: Tawsif Mostafiz
on 28 Jun 2021
Accepted Answer
More Answers (0)
Categories
Find more on Images in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!