Computer Science 111 Fundamentals of Programming I More Digital Image Processing.

Slides:



Advertisements
Similar presentations
Photoshop Lab colorspace A quick and easy 26 step process for enhancing your photos.
Advertisements

Chapter Eleven Digital Darkroom Expert Techniques.
Python: Modifying Pictures Using Loops. Review JES command area – program area Defining/using functions specifying a sequence of steps for what the function.
Grey Level Enhancement Contrast stretching Linear mapping Non-linear mapping Efficient implementation of mapping algorithms Design of classes to support.
Digital Imaging and Image Analysis
Chapter 4: Image Enhancement
Lecture 5 Sept 10 Goals: 2-d arrays Image representation Image processing examples Stack data structure.
HW 3: Problems 2&3. HW 3 Prob 2:Encipher encipher( S, n ) takes as input a string S and a non-negative integer n between 0 and 25. This function returns.
Fundamentals of Python: From First Programs Through Data Structures
Computer Science 111 Fundamentals of Programming I Introduction to Digital Image Processing.
Contains 16,777,216 Colors. My Car is red My Car is red How do I add colors to my web page? Notepad Browser Works with the “Standard” colors: Red, Green,
Photo Editing Basics Photojournalism. IMPORTANT! ALWAYS make a copy before editing. Never work on your original.
Image Processing & Perception Sec 9-11 Web Design.
Introduction to Computer Science – Chapter 9 CSc 2010 Spring 2011 Marco Valero.
Chapter 5 Using Classes and Objects in Media Computing
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 5 Working with Images Starting Out with Games & Graphics in.
Computer Science 111 Fundamentals of Programming I Introduction to Graphics.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
Computer Science 112 Fundamentals of Programming II Graphics Programming.
Two –Dimensional Arrays Mrs. C. Furman Java Programming November 19, 2008.
Team Babbage Charles Maingi Seph Newman Jon Rollman Nils Schlupp.
infinity-project.org Engineering education for today’s classroom 2 Outline How Can We Use Digital Images? A Digital Image is a Matrix Manipulating Images.
MULTIMEDIA TECHNOLOGY SMM 3001 MEDIA - IMAGES. Processing digital Images digital images are often processed using “digital filters” digital images are.
Taking Better Confocal Images Kim Peifley 2/09/15.
Digital Image Processing Part 1 Introduction. The eye.
TOPIC 6 MODIFYING PICTURES USING LOOPS 1 Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and.
Computer Science 111 Fundamentals of Programming I Introduction to Digital Image Processing.
Introduction to Image processing using processing.
Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location.
Comprehending List Comprehensions
# Red Green Blue Digital Color RGB to HEX.
Picture Lab. Manipulating Pictures Discussion and activities with java.awt.Color introduce students to megapixels, pixels, the RGB color model, binary.
Day 8: Fruit Loops: Color. Loop Review What does the following loop print? for (int i= 0; i
DIGITAL IMAGE. Basic Image Concepts An image is a spatial representation of an object An image can be thought of as a function with resulting values of.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Images and 2D Graphics COMP # 17.
Python Programming in Context Chapter 6. Objectives To understand pixel based image processing To use nested iteration To use and understand tuples To.
CSC1401 Using Decisions in Java - 1. Recall from Alice We only wanted to shoot a lightning bolt at a philosopher So, we used the If statement.
More digital reading explaining LUT RT 244 Perry Sprawls, Ph.D. Professor Emeritus Department of Radiology Emory University School of.
Lecture # 19 Image Processing II. 2 Classes of Digital Filters Global filters transform each pixel uniformly according to the function regardless of.
1 Arrays of Arrays An array can represent a collection of any type of object - including other arrays! The world is filled with examples Monthly magazine:
Copyright © Curt Hill Further Picture Manipulation Considering position.
More digital 244 wk 12 Perry Sprawls, Ph.D. Professor Emeritus Department of Radiology Emory University School of Medicine Atlanta, GA,
Instructor: Mircea Nicolescu Lecture 5 CS 485 / 685 Computer Vision.
1 Sections 5.1 – 5.2 Digital Image Processing Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Image Processing Intro2CS – week 6 1. Image Processing Many devices now have cameras on them Lots of image data recorded for computers to process. But.
Test 2 on Wed, 11/9 On image processing
Representation of image data
(Project) by:- ROHAN HIMANSHU ANUP 70282
Image Processing Objectives To understand pixel based image processing
David Meredith Aalborg University
Design Concepts: Module A: The Science of Color
Introduction to Python
Image Processing & Perception
Fundamentals of Programming I Introduction to Digital Image Processing
Histogram Histogram is a graph that shows frequency of anything. Histograms usually have bars that represent frequency of occuring of data. Histogram has.
4.14 GUI and Graphics Case Study: Creating Simple Drawings (Cont.)
CSc 110, Spring 2018 Lecture 9: Parameters, Graphics and Random
Georgia Institute of Technology
9th Lecture - Image Filters
Gray Scale picture def pixBW(pixel): # given a pixel, change to BW
Practice with loops! What is the output of each function below?
Fundamentals of Programming I Introduction to Digital Image Processing
Digital Image Processing
Python Practice !!!.
Colors Computers build colors from Red, Green, and Blue; not Red, Blue, and Yellow. RGB = Red Green Blue Creating Colors Red + Blue = Purple No Red, No.

Non-numeric Data Representation
CS 101 – Nov more major topics left: Image enhancement
Histogram The histogram of an image is a plot of the gray _levels values versus the number of pixels at that value. A histogram appears as a graph with.
DIGITAL IMAGE PROCESSING Elective 3 (5th Sem.)
Presentation transcript:

Computer Science 111 Fundamentals of Programming I More Digital Image Processing

Morph of the Day

Command Line Arguments $ python3 mondrian.py Allow users to specify data for a program at a terminal command prompt $ python3 mondrian.py 5 $ python3 ccurve.py 12

Command Line Arguments $ python3 mondrian.py 8 sys.argv is a list of strings The first string is the script file name, and any others are the arguments entered after the file name import sys def main(): # Get the level from the command line if len(sys.argv) == 1: level = 0 else: level = int(sys.argv[1])

Command Line Arguments $ python3 mondrian.py 8 Optional parameter to main allows you to run the program with an argument from the IDLE shell as well as from a terminal prompt import sys def main(level = 1): # Get the level from the command line or the shell if len(sys.argv) == 1: level = level else: level = int(sys.argv[1])

Lightening and Darkening Higher RGB values generally produce a brighter image, whereas lower RGB values produce a darker image Changing the RGB values of each pixel by the same amount will lighten or darken an image The functions lighten and darken expect an image and an integer factor as arguments and modify the brightness or darkness of the image by that amount lighten(image, 20)

Lightening and Darkening Higher RGB values generally produce a brighter image, whereas lower RGB values produce a darker image Changing the RGB values of each pixel by the same amount will lighten or darken an image The functions lighten and darken expect an image and an integer factor as arguments and modify the brightness or darkness of the image by that amount darken(image, 20)

Color Filtering Lightening and darkening are special cases of color filtering A color filter is a triple of RGB factors that is applied to each pixel to change the overall color of an image in a consistent way Thus, the triple (0, 0, 0) indicates no change, whereas the triple (22, -10, 100) adds those amounts to the RGB values of each pixel The image on the right shows the result of enhancing just the red value with the triple (20, 0, 0)

Using a Color Filter colorFilter(image, (20, 0, 0)) # Increase red colorFilter(image, (0, 0, -20)) # Decrease blue def lighten(image, amount): colorFilter(image, (amount, amount, amount)) def darken(image, amount): colorFilter(image, (-amount, -amount, -amount)) The functions lighten and darken also use colorFilter, where the amounts in the triples are equal

Defining colorFilter def colorFilter(image, colorAmount): def baseValue(value, offset): if offset == 0: return value elif offset < 0: return max(value + offset, 0) else: return min(value + offset, 255) (r, g, b) = colorAmount for … for … (red, green, blue) = image.getPixel(x, y) (red, green, blue) = (baseValue(red, r), baseValue(green, g), baseValue(blue, b)) image.setPixel(x, y, (red, green, blue)) The nested function baseValue keeps the result of the addition or subtraction within the allowable range (0-255)

Blurring an Image Helps to remove raggedy edges (pixelation) in some images by softening them Often used after an image is enlarged Build a new image in which each pixel contains the average of the RGB values of it and its neighboring pixels Begin with position (1, 1) and end with position (width - 2, height - 2) Won’t alter the pixels on the perimeter, but then we won’t have to check for the perimeter as we traverse the image

def blur(image): width = image.getWidth() - 1 height = image.getHeight() - 1 newImage = image.clone() for y in range(1, height): for x range(1, width): get the current pixel and its 4 neighbors from image create a new tuple with the averages of r, g, b set the pixel at (x, y) in newImage to the result return newImage The blur Function This function creates and returns a new image

Edge Detection Shows what a sketch of an image would look like Examine neighbors below and to the left of each pixel If the luminance of the pixel differs from either of these neighbors by a significant amount, we have detected an edge, so set its color to black Otherwise, set that pixel’s color to white Function detectEdges expects the image and a difference threshold as arguments and returns a new black and white image detectEdges(image, 20)

Shrinking an Image Make a copy whose width and height are a percentage of the width and height of the original image Transfer color values from the original to the copy, skipping rows and columns as needed shrink(image, 0.5)

For Wednesday Start Chapter 8