Removing overlapping pixels in black and white images

조회 수: 5 (최근 30일)
AMIRA
AMIRA 2019년 3월 21일
답변: KSSV 2019년 3월 21일
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.

답변 (1개)

KSSV
KSSV 2019년 3월 21일
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.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by