Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

About the matlab function of "roifill"

89 views
Skip to first unread message

joggi...@gmail.com

unread,
Apr 7, 2009, 10:53:48 PM4/7/09
to
Does anyone know what kind of algorithm used for the matlab function
of "roifill", and/or give the corresponding references?

Many thanks.

Steve Eddins

unread,
Apr 8, 2009, 12:53:47 PM4/8/09
to

Sure. I wrote roifill, way back when.

Let me briefly describe what roifill does, for the benefit of others who
might be interested in the topic. roifill is a function in the Image
Processing Toolbox (a MATLAB add-on product) that smoothly fills in a
user-specified region of a gray-scale image. This documentation page
shows an admittedly simplistic example:

http://www.mathworks.com/access/helpdesk/help/toolbox/images/roifill.html

My starting point was a hallway conversation, when a colleague suggested
to me that smoothly filling an image region could be viewed as a
"soap-film" problem. That is, imagine you that bend a loop of wire into
a particular shape, dip the loop into a soapy solution, and then see how
the resulting soap film smoothly fills in the region inside the loop.

My colleague's suggestion was to treat the image pixels surrounding the
region to be filled as the shape of the wire loop, and then calculate
the resulting soap film shape.

That set me off to learning about soap films, which led me to Laplace's
equation. The Web was new and search engines nonexistent, so I think I
actually had to look this stuff up in books. ;-)

roifill constructs a kind of discretized Laplace's equation, where the
filled interior pixels equal the average of their north, east, south,
and west neighbors, and boundary pixels (pixels on the "wire") are
constrained to be equal to the original image pixels.

The result is a sparse linear system, which roifill solves using the
MATLAB backslash operator.

I followed no particular reference, and I have no idea whether this
technique was ever described in the image processing literature.

---
Steve Eddins
http://blogs.mathworks.com/steve/


0 new messages