필터 지우기
필터 지우기

Need help to mask the image.

조회 수: 2 (최근 30일)
Sachal Hussain
Sachal Hussain 2021년 4월 9일
편집: Walter Roberson 2021년 4월 9일
Hi,
I need help to mask this attached image. I just want the black background to be white and other image remains the same.
Please guide, thank you.

답변 (1개)

Walter Roberson
Walter Roberson 2021년 4월 9일
편집: Walter Roberson 2021년 4월 9일
img = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/578172/untitled.jpg');
grimg = rgb2gray(img);
black = grimg < 10;
background = bwareafilt(black, 1);
grimg(background) = 255;
imshow(img); title('original')
imshow(grimg); title('filtered')

Community Treasure Hunt

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

Start Hunting!

Translated by