Skip to content

An implementation on flood fill algorithm on images

Notifications You must be signed in to change notification settings

KaiTaiTong/floodfill

Repository files navigation

Flood Fill

This is an implementation of flood fill on a PNG image using both breadth-first-search (BFS) and depth-first-search (DFS). A point on the image is first selected as our starting point, then a pattern will fill its adjacent regions that share similar color. A demo of borderColorPicker (1) and transformColorPicker (2) is presented below.

Demo

BFS border DFS border
bfsborder dfsborder
BFS transform DFS transform
bfstransform dfstransform

(1) borderColorPicker - borders around the edges of regions will be colored, leaving internal pixels unchanged.
(2) transformColorPicker - patterns from another PNG image get transformed into regions in the current PNG image.

Reference

Skeleton code and structures are provided by Prof. Cinda K. Heeren as part of a course on data structure and algorithm in University of British Columbia (UBC).

Raw source images are cited here:
pikachu image
dog image
rainbow image

Releases

No releases published

Packages

No packages published