Fill a circle enclosed by it's circumference (of type double) with white.
Show older comments
I want to fill a specific region on an image with white (value 255). The specific region forms a circle. (whose co-ordinates of centre and circumference are calculated)
1. I used imfill but the co-ordinates of circle are of type double. Hence I got an error. When I convert the co-ordinates to to uint16, the co-ordinates don't form a contour (closed figure). Hence I can't use imfill.
2. I used roifill which accepts circumference co-ordinates of type double. It fills the values with a grey shade and not exactly 255.
Is there a way by which I can use roifill but fill it with white (instead of smoothing and filling with a shade of gray)? Or can I use the imfill command itself so that it accepts input of type double? Or is there anything else I can do?
I have attached the co-ordinates of circle's circumference which I have calculated and the centre of circle. I have also attached the image on which I am plotting the circle (if required). I want to make the pixels which lie inside this circle white and the others black.
Accepted Answer
More Answers (1)
Image Analyst
on 14 Mar 2015
0 votes
Depends on exactly what you want to do. Do you want to fill the words and logo on the cap with the surrounding gray levels "smeared in"? Or is replacing those pixels with the average gray level of the entire cap good enough? And do you have the latest MATLAB R2015a - the roifill command has been improved. Prior to this version you'll have to dilate the binary image of the letters a little bit before you call roifill(), so that the outer perimeter of the mask actually lies on the white surround rather than on the letters, otherwise you'll get the gray like you said.
1 Comment
Meghana Dinesh
on 14 Mar 2015
Edited: Meghana Dinesh
on 14 Mar 2015
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

