06PictureManipulations2009

06PictureManipulations2009 - CS1315: Introduction to Media...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS1315: Introduction to Media Computation Programming picture manipulations Admin Does everyone have JES 4.2.1 installed now? New version that allows you to save your pictures How "close" are two colors? Sometimes you need to find the distance between two colors, e.g., when deciding if something is a "close enough" match How do we measure distance? Pretend its Cartesian coordinate system Distance between two points: Distance between two colors: Demo: Manipulating Colors >>> pixel = getPixel(pic, 1, 1) >>> print getRed(pixel) 168 >>> setRed(pixel, 255) >>> print getRed(pixel) 255 >>> color = getColor(pixel) >>> print color color r=255 g=131 b=105 >>> setColor(pixel, color) >>> newColor = makeColor(0, 100, 0) >>> print newColor color r=0 g=100 b=0 >>> setColor(pixel, newColor) >>> print getColor(pixel) color r=0 g=100 b=0 >>> print color color r=81 g=63 b=51 >>> print newcolor color r=255 g=51 b=51 >>> print distance(color, newcolor) 174.41330224498358 >>> print color color r=168 g=131 b=105 >>> print makeDarker(color) color r=117 g=91 b=73 >>> print color color r=117 g=91 b=73 >>> newcolor = pickAColor() >>> print newcolor color r=255 g=51 b=51 We can change pixels directly >>> file = "/Users/monica/MediaSources/barbara.jpg" >>> pict = makePicture(file) >>> show(pict) >>> setColor(getPixel(pict, 10, 100), yellow) >>> setColor(getPixel(pict, 11, 100), yellow) >>> setColor(getPixel(pict, 12, 100), yellow) >>> setColor(getPixel(pict, 13, 100), yellow) >>> repaint(pict) But thats really tedious Manipulating pictures more cleverly is the next topic How do you find out what RGB values you have? And where?...
View Full Document

Page1 / 25

06PictureManipulations2009 - CS1315: Introduction to Media...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online