Preview

Save the Girl Child

Good Essays
Open Document
Open Document
852 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Save the Girl Child
Flood-Fill Flood-fill
• Used in interactive paint systems. • The user specify a seed by pointing to the interior of the region to initiate a flood operation

Recursive Flood-Fill
• Fill a image-space region with some intensity (color) value • How to define the region? • Fill Until vs. Fill While • 4-connectivity vs. 8-connectivity

Flood-Fill from Seed
• Start from the seed and floods the region until a boundary is met.
A simple recursive algorithm can be used: void floodFill(int x, int y, int fill, int old) { if ((x < 0) || (x >= width)) return; if ((y < 0) || (y >= height)) return; if (getPixel(x, y) == old) { setPixel(fill, x, y); floodFill(x+1, y, fill, old); floodFill(x, y+1, fill, old); floodFill(x-1, y, fill, old); floodFill(x, y-1, fill, old); } }

8-connected vs. 4-connected

Recursive Flood-Fill Algorithm
The algorithm is very simple, however it is: • highly recursive - requiring a huge number of procedural calls; • can cause recursion stack to overflow • no mechanism to determine whether the visited pixels have been tested before

S

An 8-connected flood is able to flood through corners that a 4-connected flood cannot.

1

Fill Until vs. Fill While

Flood Until void floodUntil(int x, int y, int n_color, int B_color) { if ((x < 0) || (x >= width)) return; if ((y < 0) || (y >= height)) return; c = getPixel(x, y); if (c != n_color && c != B_color) { setPixel(new_color, x, y); floodFill(x+1, y, n_color B_color); floodFill(x, y+1, n_color B_color); floodFill(x-1, y, n_color B_color); floodFill(x, y-1, n_color B_color); } }

seed

Flood While void floodWhile(int x, int y, int n_color, int old) { if ((x < 0) || (x >= width)) return; if ((y < 0) || (y >= height)) return; if (getPixel(x, y) == old) { setPixel(fill, x, y); floodFill(x+1, y, n_color, old); floodFill(x, y+1, n_color, old); floodFill(x-1, y, n_color, old); floodFill(x, y-1, n_color, old); } }

With global variables void floodWhile(int x, int y) { if ((x < 0) || (x >=

You May Also Find These Documents Helpful

  • Good Essays

    1. Measure the width of the stream, using a tape measure. Make sure the tape is taught and 90˚ to the bank, avoiding the overhanging bank.…

    • 866 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Bierstadt created the perfect gradient of dark to light colors from opposite ends of his painting. Established on land, the hue of darkness swept into the lake, but the color was only to be amplified by the light created from the sky. This line amid the water plays a powerful role in the painting where the two opposites meet to form a single, unified harmony of colors in the middle. The disposition of the rays emitted by the sun, asserted a sense of depth as well as texture to the painting. Though the mountains created were of the same height, it was the existence of light that created saturation of…

    • 679 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    CEIS100 W5 ILab Report

    • 320 Words
    • 2 Pages

    Code—copy and paste (or type) your code below. You can also post a screenshot of the program working if you would like.…

    • 320 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Pt1420 Unit 7 Study Guide

    • 582 Words
    • 3 Pages

    Write a program to put the biggest one in CX and also display it. Page: 97…

    • 582 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Water Lilies, done by Mark Tansey in 1994, is a monochromatic oil painting of the flooding of Claude Monet’s water lily garden in Giverny, France in 1910. The painting depicts Monet's calm water lily pond being flooded by the rising waters of a nearby river. What immediately pulls you into this painting is the use of blue. Mark Tansey primarily paints in monochrome and can really reflect the mood of the color in the painting itself. On the right side of the painting the rough and turbulent waters of the river have broken through the wooden fence around the edge of the lily pond. The waters of the river are flowing through the broken fence and are beginning to stir up the calm pond. In the lily pond we of course see lilies but we can also see a clear reflection of the large, dark, full clouds in the sky. On the left of the painting ice is…

    • 605 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    Figure 13. The patterns created in a bubble film with the constructive and destructive interference of white light…

    • 2593 Words
    • 11 Pages
    Powerful Essays
  • Satisfactory Essays

    This segment taken from The Problem of the Color Line by Anna Quindlen is a good way to show what she is trying…

    • 301 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Cosmic Myth Worksheet

    • 692 Words
    • 6 Pages

    Flood Myth 1: Yao, and he people. Through the development of his “new technique of channeling passage to them to drain off to the sea.” –pg.54…

    • 692 Words
    • 6 Pages
    Good Essays
  • Good Essays

    The water is painted a very light shade of turquoise like something you would see on an island in Hawaii or Puerto Rico. The waves are small but painted white as if they are crashing hard onto the beach. In the background there are rocks and what appears to be a ridgeline that reaches as far as the eye can see. Everything up until the ridgeline is very clearly painted until you look up into the sky and it…

    • 974 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    answer. For example if the first rectangle W=2 and L=7 when seven is divided by two the…

    • 511 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    12

    • 389 Words
    • 2 Pages

    An image rendered in the Neoplastic style complies with the following rules: (Specific details can…

    • 389 Words
    • 2 Pages
    Good Essays
  • Good Essays

    There are mostly organic lines with varying lengths. The wave looks like one long curved line and then the smaller ripples in the ocean decrease in length as they come closer but are also wavy. This contrasts with the straight line in the trunk of the palm tree. You can also see the vertical lines from the surface of the cardboard. Despite cutting into the cardboard, there are only 2D shapes. I manipulated the positive and negative shapes through intuitive perspective. Occlusion is visible with the big wave and the palm tree covering the rest of the ocean. Texture gradient and relative height on ground plane are both seen in the ripples of the ocean. The wavelength of the ripples decrease the farther back it goes and they get higher on the ground plane the farther back they get in order to give the ocean distance. I chose to paint everything it’s local color, the ocean is blue, the sun is yellow, the palm fronds are green, and the cloud is white. There are various tints of the primary colors and a couple secondary colors. The ocean and wave is monochromatic but with multiple values. I made the value scale of blue on the wave to make it stand out from the rest of the ocean. The white on the crest puts emphasis on the wave because it is more saturated than the rest of the colors. I used analogous hues for the sun with the red, orange, and yellow. The…

    • 661 Words
    • 3 Pages
    Good Essays
  • Better Essays

    “And then, a number of centuries later, God said, ‘No, no. Everything is crap; I will send a flood down. I will send a flood down across the world, because it’s all crap.’ He decided to do the etch-a-sketch end of the world, I think.” (Izzard) And that, no matter which story of this particular flood story you look at, seems to be the main objective, to, like a etch-a-sketch, start all over with a clean slate. While there are several differences in how the story is told, there are quite a few similarities, enough to make you consider that there is some truth to this story, no matter which version you accept. And the fact of the matter is that, scientifically, there was flooding in these areas due to natural disasters. Whether or not a god or gods were the reason for these natural disasters is a matter of your faith and opinion.…

    • 1178 Words
    • 5 Pages
    Better Essays
  • Powerful Essays

    Five different coloured transparencies (red, green, yellow, blue, purple) are being used for changing the light’s colour. Within 5 minutes for each one of them, they will be used in order to see oxygen bubbles rising from a used water plant. The produced oxygen (in the form of bubbles) indicates the rate of photosynthesis and is being measured by counting bubbles.…

    • 1503 Words
    • 7 Pages
    Powerful Essays
  • Satisfactory Essays

    Laws of Exponent

    • 458 Words
    • 2 Pages

    To show how this one works, just think of re-arranging all the "x"s and "y" as in this example:…

    • 458 Words
    • 2 Pages
    Satisfactory Essays