How do I darken a certain part of the image?

4 Ansichten (letzte 30 Tage)
Özge Akbülbül
Özge Akbülbül am 22 Mai 2018
Kommentiert: Rena Berman am 29 Jun. 2021
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 Kommentare
Rik
Rik am 8 Jun. 2021
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 am 29 Jun. 2021
(Answers Dev) Restored edit

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Akira Agata
Akira Agata am 24 Mai 2018
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')

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by