How to shade the intersection area between two overlay image?
5 views (last 30 days)
Show older comments
I have two overlay image that intersect at two points,my aim is to calculate the area between this two curve.I don't know how to shade the area that is between two curve.this is my program:
RGB=imread('DETECTOR1.PNG');
A=imread('DETECTOR2.PNG');
F=imfuse(RGB,A,'blend','Scaling','Joint');
imwrite(RGB,'Detectors.PNG');
imtool(F);
0 Comments
Answers (1)
DGM
on 27 Oct 2024 at 0:28
Edited: DGM
on 27 Oct 2024 at 0:30
JPG screenshots of the ambiguous superposition of working images are not working images.
% the only given image is a screenshot
% it's impossible to tell what the original shapes were
% the claim of 2 intersection points appears to be plainly false
% i'm just going to guess and make my own example images
A = imread('shape_a.png');
B = imread('shape_b.png');
% binarize both images somehow
% i'm already working with single-channel images
A = imbinarize(A);
B = imbinarize(B);
% what is the area of interest?
% is it inside the perimiter or outside?
% does it include the perimeter?
% does it exclude the perimeter?
% i assume it's the interior region including the perimeter
% and that both perimeters are closed paths
A = imfill(~A,'holes'); % fill the perimeters
B = imfill(~B,'holes');
% now both images are binary masks
% unambiguously describing two regions
% assuming that the two images are already registered
% find their intersection
C = A & B;
% area of the images and intersection in px
% convert to whatever units are relevant
areaA = nnz(A)
areaB = nnz(B)
areaC = nnz(C)
% compare the images
imshow([A B C])
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!