How to shade the intersection area between two overlay image?

5 Ansichten (letzte 30 Tage)
hanif
hanif am 28 Jan. 2015
Bearbeitet: DGM am 27 Okt. 2024 um 0: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);

Antworten (1)

DGM
DGM am 27 Okt. 2024 um 0:28
Bearbeitet: DGM am 27 Okt. 2024 um 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)
areaA = 179677
areaB = nnz(B)
areaB = 179677
areaC = nnz(C)
areaC = 168860
% compare the images
imshow([A B C])

Community Treasure Hunt

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

Start Hunting!

Translated by