How to find locations of intersection of 2 matrices?

1 次查看(过去 30 天)
Hi,
So I have 2 3D matrices. One matrix is a 3D labeled matrix - so each island is labeled a different value (let's call it matrix A). The other matrix is a 3D matrix of circled islands that have been filled using the imfill function (let's call it matrix B). I need to use these 2 matrices to find which labels from matrix A correspond to the islands on matrix B. How would I go about finding which ones intersect?

回答(1 个)

Aaron Greenbaum
Aaron Greenbaum 2016-7-28
I've never worked with 3-D data, but it seems like you might be doing something sorta similar to me. One way you can do it is to use regionprops. It takes two matrices and calculates things for the things in common with them.
stats = regionprops(Islands,Labels, 'Centroid'); %Creates structure with location of centroid.
You can also look into the intersect function in matlab or ismember. Its possible that youtube tutorials for watershedding and finding centroids with bwlabel will also be helpful
https://www.mathworks.com/matlabcentral/answers/28996-centroid-of-an-image
I'm not a pro at matlab but I hope this helped a little.

Community Treasure Hunt

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

Start Hunting!

Translated by