1 / 17

Multimedia Summer Camp

Learn how to replace colors, reduce red-eye, create sepia-toned pictures, and perform edge detection in this multimedia summer camp.

hcorona
Download Presentation

Multimedia Summer Camp

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Multimedia Summer Camp Replacing Colors: Red-Eye, Sepia Tones

  2. Outline • Replacing colors with another color broadly or just within a range • Reducing red-eye • Sepia-Toned Pictures • Edge detection

  3. Reducing Red-Eye • If you use a flash in a dark environment, you often get a red eye effect. This is because the light of the flash is reflecting from the retina, which is covered with tiny blood vessels.

  4. Reducing Red-Eye • Initial solution • Scan the picture pixel by pixel, replace each pixel whose color is close enough to red by black. • Problem • This will also change the color of the kid’s cloth.

  5. Reducing Red-Eye • Better solution • Find the range of where the eyes are red • Scan the range pixel by pixel, replace each pixel whose color is close enough to red by black

  6. Reducing Red-Eye • Find the range of where the eyes are red • Open the picture by typing the following command in the command area: openPictureTool( makePicture( pickAFile() ) ) • Click at the upper left corner of her eyes, the x- and y-coordinates will show up • x: 112, y: 87 • Click at the lower right corner of her eyes, the x- and y-coordinates will show up • x: 199, y: 106

  7. Reducing Red-Eye • How to check if a pixel’s color is close enough to red • distance(color1, color2) Takes two Color objects and returns a single number representing the distance between the colors.

  8. Reducing Red-Eye • We need a way to tell Jython to make decisions based on a test. • In this case, if “a pixel’s color is close enough to red”, ask Jython to “change its color to black”. • Jython provides if-statement for this purposes • syntax: if <test>: <actions_to_be_done> • meaning: if the test is true, perform the specified actions. if the test is false, ignore the specified actions. • We can test on: <. >, == (for equality), != (for inequality, not-equals) and even <=, >=.

  9. Reducing Red-Eye • The function takes a lot of inputs so that it can be useful for many different pictures. • Jython provides some color constants such as: red, black, green, yellow, blue. • We determine “close enough” by looking for a distance within a threshold value. We have tried different distances, and settled on 165.

  10. Reducing Red-Eye

  11. Sepia-Toned Pictures • Sepia tone used to be known as the natural process that overtook older photographs as they faded into the obscurity of age. • Just like a newspaper article left in archives, photographs go through a similar process over the years that give them a brownish hue.

  12. Sepia-Toned Pictures • Solution • Convert the picture to grayscale because older prints were in a grayscale, and it makes it a little easier to work with. • A better grayscale function will be used • Look for high and low ranges of color (really, luminance), and change them separately.

  13. Sepia-Toned Pictures • Why these particular values in this function? • Trial and error – tweaking them until we liked the effect

  14. Sepia-Toned Pictures Original Picture Sepia-Toned Picture Grayscaled Picture

  15. Edge Detection • Edge detection is a process to compare pixels to determine what to put in a given pixel, either black or white • Compare each pixel’s luminance to the pixel below it and to the right of it. • If there is a suitable difference, make the pixel black, otherwise, make it white. • The idea is to try to draw lines the way an artist might sketch a drawing with lines.

  16. Edge Detection

  17. Edge Detection

More Related