Intersection of two cells arrays of 256 by 256 by 3 matrices

1 回表示 (過去 30 日間)
A. P. B.
A. P. B. 2017 年 6 月 20 日
コメント済み: A. P. B. 2017 年 6 月 23 日
I have two cells A and B. A and B has RGB images A={img1,img2,img3} A={img4,img2,img6} How can I find the intersection between two cells???
  2 件のコメント
KSSV
KSSV 2017 年 6 月 20 日
Does images have positions? I mean X and Y data?
A. P. B.
A. P. B. 2017 年 6 月 23 日
Yes for example img1=256 by 256 by 3

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

回答 (1 件)

Stephen Jue
Stephen Jue 2017 年 6 月 22 日
I do not know of a way to directly find the intersection between two cells, but you can recast your two cells A and B as matrices and use the "intersect" function, like so:
A = [img1(:), img2(:), img3(:)]';
B = [img4(:), img2(:), img6(:)]';
[~, indicesA, indicesB] = intersect(A, B, 'rows');
This flattens each image into a single row of a matrix, then uses "intersect" with the "rows" option to find the intersection of A and B by row. The variables "indicesA" and "indicesB" will contain the corresponding indices of A and B that are part of the intersection.

カテゴリ

Help Center および File ExchangeRead, Write, and Modify Image についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by