How to fill BLACK a region in an image?
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Steven
am 12 Dez. 2013
Bearbeitet: Steven
am 26 Apr. 2016
I have an image (no matter gray or binary). I want to fill several regions (that are selected by the user through interface) in BLACK!
imfill and roifill cannot do this, because they fill in white!
(I think roifill is exactly what I need, but it fills them white not black!)
Does anybody know how I can resolve my problem?
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 12 Dez. 2013
It does matter if they're grayscale or binary. You will probably have to use morphology. For example you might need to erode or dilate your binary image so that you don't fill with white. Or you might be able to use logical indexing. Can you post your image so I can recommend a method?
0 Kommentare
Weitere Antworten (2)
Steven
am 12 Dez. 2013
Bearbeitet: Steven
am 18 Dez. 2013
1 Kommentar
Image Analyst
am 12 Dez. 2013
That looks like a binary image. So why is imfill() not working?
filledImage = imfill(binaryImage, 'holes');
Walter Roberson
am 13 Dez. 2013
Why not just assign 0 to the roi regions? If they are defined as polygons, then poly2mask() to get the bitmap.
8 Kommentare
Image Analyst
am 14 Dez. 2013
Like this???
% Find the binary image
binaryImage = grayImage > thresholdValue; % say 200 or something.
% Make those pixels black.
grayImage(binaryImage) = 0;
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!