How to shade the intersection area between two overlay image?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
DGM
2024년 10월 27일
편집: DGM
2024년 10월 27일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!