flood fill

From DavinciWiki
Jump to: navigation, search


Description

Used to flood fill an image from one value to another. Takes an input value and position and fills all pixels with the same value that touch the given pixel to a new value

Arguments and Return Values

Inputs: a byte picture, value and position, and a new value

Outputs: a byte picture, with values changed

Usage

Syntax: flood_fill(data = BYTE, ypos=INT, xpos=INT, fill=BYTE, value=BYTE)

 'data'         is the input picture
 'ypos'         is the y starting position
 'xpos'         is the x starting position
 'fill'         is new value to be filled
 'value'        is the old value which is searched forq

Examples

Perform the flood fill on sstretched data

dv> a
577x951x1 array of float, bsq format [2,194,908 bytes]
dv> b=sstretch(a,ignore=-32768)
577x951x1 array of byte, bip format [548,727 bytes]
dv> c=flood_fill(b,xpos=497,ypos=792,fill=127,value=0)
577x951x1 array of byte, bsq format [548,727 bytes]

Now Display the result

dv> display(b)
Writing /tmp/dv_21154/ytcDNZ: 577x951x1 PNG file.
dv> display(c)
Writing /tmp/dv_21154/FA3mpn: 577x951x1 PNG file.

Images

Before and After images

flood fill before.png flood fill after.png

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Related Functions

Recent Core Changes

Modified On: 02-04-2008

Personal tools