Removing overlapping pixels in black and white images

4 views (last 30 days)
I have two black and white images, let say A and B, I would like to remove overlapped pixel between image A and B and maintain the pixels from image A only after removing the overlapped pixels? How can I do this?
As shown in the following image, I would like to remove the green and black part and keep the pink part of the image.

Answers (1)

KSSV
KSSV on 21 Mar 2019
I = imread('image.jpeg') ;
R = I(:,:,1) ;
G = I(:,:,2) ;
B = I(:,:,3) ;
% Get black region
I1 = rgb2gray(I) ;
idx = I1 < 50 ;
R(idx) = 255 ;
G(idx) = 255 ;
B(idx) = 255 ;
% remove green part
idx = G<=255 ;
R(idx) = 255 ;
B(idx) = 255 ;
% Remove Black
I2 = cat(3,R,G,B) ;
imshow(I2)
There could be more elegant solution.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!