Removing overlapping pixels in black and white images
4 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
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.
0 Comments
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!