How do I darken a certain part of the image?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ö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
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?
Respuesta aceptada
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')
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!