How do I darken a certain part of the image?

조회 수: 4 (최근 30일)
Özge Akbülbül
Özge Akbülbül 2018년 5월 22일
댓글: Rena Berman 2021년 6월 29일
Hello
I wanna do darken circle's around .Circle and its inside must stay like the way it is.How can i do that with simple way?Firstly i think about the nested for loops. i and j (row and cloumns) pixel values must be 1 or 0 respectively.Is this idea true?Can someone give me an advice for this?
  댓글 수: 3
Rik
Rik 2021년 6월 8일
Unfortunately, the image Stephen added seems to be missing from the Google cache, but the rest of the question is still there:
How do I darken a certain part of the image?
Hello
I wanna do darken circle's around .Circle and its inside must stay like the way it is.How can i do that with simple way?Firstly i think about the nested for loops. i and j (row and cloumns) pixel values must be 1 or 0 respectively.Is this idea true?Can someone give me an advice for this?
Rena Berman
Rena Berman 2021년 6월 29일
(Answers Dev) Restored edit

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

채택된 답변

Akira Agata
Akira Agata 2018년 5월 24일
One possible solution would be like this:
% Read the file and convert to gray-scale image
I = imread('b.jpg');
Igray = rgb2gray(I);
% Extract the circle by selecting the region with maximum bounding box
BW = imbinarize(Igray);
s = regionprops('table',~BW,'BoundingBox','PixelIdxList');
[~,idx] = max(s.BoundingBox(:,3).*s.BoundingBox(:,4));
% Make the mask image by filling the circle with 'true'
BWmask = false(size(BW));
BWmask(s.PixelIdxList{idx}) = true;
BWmask = imfill(BWmask,'holes');
% Mask the image
Iresult = Igray;
Iresult(~BWmask) = 0;
% Show the reusult
imshowpair(Igray,Iresult,'montage')

추가 답변 (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