How to find locations of intersection of 2 matrices?

3 views (last 30 days)
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?

Answers (1)

Aaron Greenbaum
Aaron Greenbaum on 28 Jul 2016
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.

Categories

Find more on MATLAB 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!