필터 지우기
필터 지우기

How can I color the specific region of the image?

조회 수: 4 (최근 30일)
Junaid Qadir
Junaid Qadir 2020년 4월 10일
댓글: DGM 2024년 6월 13일
Hi!
I want to change the color of specific region in an image. The background color should be different from the eyes color of the image shown below. Thanks
img = imread('C:\Users\Junaid Khan\Desktop\jun.png');
bn=im2bw(img);
imshow(bn)
bn=bwareaopen(bn,100);
imshow(bn)
[L,n]=bwlabel(bn);
imshow(label2rgb(L));
prop=regionprops(L);
The above is the input image and while I run this code the output is like this.
I want to change the eyes and mouth color and also the background color should not be same.
Thanks
  댓글 수: 1
DGM
DGM 2024년 6월 13일
You've said that you want regions to be different things, but you haven't really said what you actually want them to be. It's fairly clear that using label2rgb() is inappropriate for whatever you're trying to do, but it's not clear whether bwlabel(), etc are either.
I've posted a number of demos involving masked image adjustment, blending, and composition. For anything more tailored, you're going to have to be specific.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by