SlideServe
Menu
Préférences
© SlideServe · v2026

Understanding Image Processing Techniques

simone-randall avatar
9 diapositives · 207 Views · Nov 28, 2014

Explore rotating, blurring, and scaling concepts in image processing. Learn to implement blurring algorithms and understand pixel manipulation methods. Ideal for beginners in computing education.

Understanding Image Processing Techniques - slide 1
01 / 9Understanding Image Processing Techniques
1 / 17

Télécharger la présentation

Understanding Image Processing Techniques
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. CS 101: Introduction to Computing Rotating and Blurring Developed by Mark Guzdial, Georgia Institute of Technology, 2003–2004; modified by Robert H. Sloan, University of Illinois at Chicago, 2005, for educational use.

  2. Rotating the copy def copyTonksSideways(): # Set up the source and target pictures tonksFile=getMediaPath("tonks.jpg") tonks = makePicture(tonksFile) canvasf = getMediaPath("7inX95in.jpg") canvas = makePicture(canvasf) # Now, do the actual copying--swap X & Y! targetX = 1 for sourceX in range(1,getWidth(tonks)): targetY = 1 for sourceY in range(1,getHeight(tonks)): color = getColor(getPixel(tonks,sourceX,sourceY)) setColor(getPixel(canvas, targetY, targetX), color) targetY = targetY + 1 targetX = targetX + 1 show(tonks) show(canvas) return canvas

  3. Rotating: How it works • We increment the same, but we use targetX for the Ycoordinateand targetY for the X coordinate

  4. Rotating: How it works 2 • We increment sourceY and targetY just the same.

  5. Rotate: How it ends • Same amount of increment, even same values in the variables, but a different result.

  6. What to do about scaling? • How do we clear up the degradation of scaling up? • Variety of techniques, but mostly following the same basic idea: • Use the pixels around to figure out what color a new pixel should be, then somehow (e.g., by averaging) compute the right color. • Different techniques look at different pixels and compute different averages in different ways.

  7. A blurring program def blur(pic,nNeighbors): original = makeDuplicate(pic) for pixel in getPixels(pic): currentX = getX(pixel) currentY = getY(pixel) r = 0 g = 0 b = 0 count = 0 for x in range(currentX - nNeighbors, currentX + nNeighbors +1): for y in range(currentY - nNeighbors, currentY + nNeighbors + 1): if (x<0) or (y<0) or (x >= getWidth(pic)) or (y >= getHeight(pic)): pass # Skip if we go off the edge else: r = r + getRed(getPixel(original, x, y)) g = g + getGreen(getPixel(original, x, y)) b = b + getBlue(getPixel(original, x, y)) count = count + 1 newColor = makeColor(r/count,g/count,b/count) setColor(pixel,newColor) def makeDuplicate(pic): #creates new picture object identical to old and returns it duplicate = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic)): for y in range(1,getHeight(pic)): color = getColor(getPixel(pic, x, y)) setColor(getPixel(duplicate, x, y), color) return duplicate Need to go to JES and look at this and ask lots of questions about it.

  8. Bean: Pixelated, then smooth

  9. Questions about Blur • What’s with the + 1 at the end of the range? • Explain construct else: and pass • Explain exact test in the if for when to pass • Explain why we need makeDuplicate!