How do I darken a certain part of the image?

2 visualizaciones (últimos 30 días)
Özge Akbülbül
Özge Akbülbül el 22 de Mayo de 2018
Comentada: Rena Berman el 29 de Jun. de 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 comentarios
Rik
Rik el 8 de Jun. de 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 el 29 de Jun. de 2021
(Answers Dev) Restored edit

Iniciar sesión para comentar.

Respuesta aceptada

Akira Agata
Akira Agata el 24 de Mayo de 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')

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by