Counting overlapping pixels between two images

30 ビュー (過去 30 日間)
Matthew Alston
Matthew Alston 2014 年 7 月 18 日
編集済み: Image Analyst 2020 年 12 月 29 日
I'm looking to find the number of overlapping shaded pixels between two images. The two images are attached. How could I count the overlapping shaded red pixels between the two images? Any assistance would be much appreciated. If possible an easily repeatable process, as I have to run it with 64 images.

採用された回答

Image Analyst
Image Analyst 2014 年 7 月 18 日
Call imregister to align them. Then use min() to take the min values of the two images.
By the way, I'll be soon leaving for canoe camping over the weekend so good luck. I'll be back Sunday afternoon.
  11 件のコメント
mohamed seliga
mohamed seliga 2020 年 12 月 28 日
I want the code that defines the green points on the mask, and calculates the overlap between the area that is common to both the green and red outlines regions, the code that I have specifies the red line only on the image
Image Analyst
Image Analyst 2020 年 12 月 29 日
編集済み: Image Analyst 2020 年 12 月 29 日
Well just do something similar to get the green line. I'm not sure what is different - maybe a different parameter at some point in your algorithm. Then you can get the mask for each and AND them:
[rows, columns, numberOfColorChannels] = size(yourImage);
redMask = poly2mask(xRed, yRed, rows, columns];
greenMask = poly2mask(xGreen, yGreen, rows, columns];
overlap = redMask & greenMask;
overlapArea = nnz(overlap);
Again, let's take this to a different thread, so we don't keep sending Matthew emails about new activity in his 6 year old question. You can reply here ONCE again, ONLY to put the link to your new question.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by