Computer Science 111 Fundamentals of Programming I Introduction to Digital Image Processing.

Slides:



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

Numbers in Images GCNU 1025 Numbers Save the Day.
Objectives Define photo editing software
HISTOGRAM TRANSFORMATION IN IMAGE PROCESSING AND ITS APPLICATIONS Attila Kuba University of Szeged.
HISTOGRAM TRANSFORMATION IN IMAGE PROCESSING SHINTA P TEKNIK INFORMATIKA STMIK MDP 2011.
Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.
Capturing and optimising digital images for research Gilles Couzin.
School of Computing Science Simon Fraser University
Lecture 5 Sept 10 Goals: 2-d arrays Image representation Image processing examples Stack data structure.
Color Mixing There are two ways to control how much red, green, and blue light reaches the eye: “Additive Mixing” Starting with black, the right amount.
IAT 3551 Computer Graphics Overview Color Displays Drawing Pipeline.
Digital Audio, Image and Video Hao Jiang Computer Science Department Sept. 6, 2007.
Fundamentals of Python: From First Programs Through Data Structures
Computer Science 111 Fundamentals of Programming I Introduction to Digital Image Processing.
1 JPEG Compression CSC361/661 Burg/Wong. 2 Fact about JPEG Compression JPEG stands for Joint Photographic Experts Group JPEG compression is used with.jpg.
Dye Sublimation Color Management
Digital Images. Scanned or digitally captured image Image created on computer using graphics software.
Image Processing.  a typical image is simply a 2D array of color or gray values  i.e., a texture  image processing takes as input an image and outputs.
Fundamentals of Photoshop
Introduction to JPEG Alireza Shafaei ( ) Fall 2005.
IDL GUI for Digital Halftoning Final Project for SIMG-726 Computing For Imaging Science Changmeng Liu
© 1999 Rochester Institute of Technology Color. Imaging Science Workshop for Teachers ©Chester F. Carlson Center for Imaging Science at RIT Color Images.
Lab #5-6 Follow-Up: More Python; Images Images ● A signal (e.g. sound, temperature infrared sensor reading) is a single (one- dimensional) quantity that.
TOPIC 4 INTRODUCTION TO MEDIA COMPUTATION: DIGITAL PICTURES Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach.
Objective Understand concepts used to create digital graphics. Course Weight : 15% Part Three : Concepts of Digital Graphics.
Chapter 5 Using Classes and Objects in Media Computing
I-1 Steps of Image Generation –Create a model of the objects –Create a model for the illumination of the objects –Create an image (render) the result I.
Colours and Computer Jimmy Lam The Hong Kong Polytechnic University.
© 1999 Rochester Institute of Technology Introduction to Digital Imaging.
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.
Computer Science 112 Fundamentals of Programming II Graphics Programming.
September 5, 2013Computer Vision Lecture 2: Digital Images 1 Computer Vision A simple two-stage model of computer vision: Image processing Scene analysis.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Image Representation. Digital Cameras Scanned Film & Photographs Digitized TV Signals Computer Graphics Radar & Sonar Medical Imaging Devices (X-Ray,
Digital Image Processing Part 1 Introduction. The eye.
Introduction to Image processing using processing.
Computer Graphics An Introduction Jimmy Lam The Hong Kong Polytechnic University.
Computer Vision Introduction to Digital Images.
How digital cameras work The Exposure The big difference between traditional film cameras and digital cameras is how they capture the image. Instead of.
Ch 6 Color Image processing CS446 Instructor: Nada ALZaben.
Adobe Photoshop CS5 – Illustrated Unit A: Getting Started with Photoshop CS5.
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.
Digital Imaging Fundamentals Ms. Hema C.R. School of Mechatronic Engineering.
Python Programming in Context Chapter 6. Objectives To understand pixel based image processing To use nested iteration To use and understand tuples To.
Compsci 101.2, Fall Plan for October l Review Catchup and Midterm and Future  Make sure everyone understand options l Review Assignment.
Visual Computing Computer Vision 2 INFO410 & INFO350 S2 2015
Digital Image Processing Introduction to MATLAB. Background on MATLAB (Definition) MATLAB is a high-performance language for technical computing. The.
Computer Science 121 Scientific Computing Winter 2014 Chapter 14 Images.
PART TWO Electronic Color & RGB values 1. Electronic Color Computer Monitors: Use light in 3 colors to create images on the screen Monitors use RED, GREEN,
Digital Image Processing
HOW SCANNERS WORK A scanner is a device that uses a light source to electronically convert an image into binary data (0s and 1s). This binary data can.
Scanner Scanner Introduction: Scanner is an input device. It reads the graphical images or line art or text from the source and converts.
Adobe Photoshop CS4 – Illustrated Unit A: Getting Started with Photoshop CS4.
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.
Photoshop CS6 – Nelson Unit 3: Photoshop CS6. Objectives Define photo editing software Start Photoshop and view the workspace Use the Zoom tool and the.
Fundamentals of Programming I Introduction to Graphics
Getting Started with Adobe Photoshop CS6
Image Processing Objectives To understand pixel based image processing
Sampling, Quantization, Color Models & Indexed Color
Processing the image with Python
Fundamentals of Programming I Introduction to Digital Image Processing
Fundamentals of Programming I Introduction to Graphics
Chapter I Digital Imaging Fundamentals
Fundamentals of Programming I Introduction to Digital Image Processing
Digital Image Processing
Non-numeric Data Representation
Fundamentals of Python: First Programs Second Edition
Python – May 25 Quiz Python’s imaging library Lab
Presentation transcript:

Computer Science 111 Fundamentals of Programming I Introduction to Digital Image Processing

Digital Images Input devices: –scanners –cameras –camcorders Output devices: –display screens –printers Processing: –file compression –various transformations

Transformations Convert from color to grayscale Adjust the brightness Adjust the contrast Adjust the size Rotate Morph into another image

Morph of the Day

Representing Images An image can be represented as a two-dimensional grid of RGB values (pixels) To capture an image (via camera or scanner), a continuous range of color info is sampled as a set of discrete color values All processing works with the grid of RGB values Output maps the grid to a display or a printer

The images Module A non-standard, open source module that includes a set of classes and methods for processing images Can edit scripts in IDLE, then run them from IDLE or a terminal prompt python testimages.py

The Image Class Image(fileName) Image(width, height) draw() clone() getWidth() getHeight() getPixel(x, y) setPixel(x, y, (r, g, b)) save( ) Represents a grid of pixels Methods for display, examining the dimensions, examining or resetting pixels, and saving changes to a file A pixel is just a tuple of 3 integers

A Simple Session Uses a terminal prompt to launch python Import the relevant class from the module The images library must be in the current working directory >>> from images import Image

A Simple Session The image file must be in the current working directory >>> from images import Image >>> image = Image('smokey.gif')

A Simple Session draw must be run to display the image >>> from images import Image >>> image = Image('smokey.gif') >>> image.draw()

A Simple Session >>> from images import Image >>> image = Image('smokey.gif') >>> image.draw() >>> image.getWidth(), image.getHeight() (300, 225) The image window must be closed to continue testing The comma creates a tuple of results

A Simple Session > python >>> from images import Image >>> image = Image('smokey.gif') >>> image.draw() >>> image.getWidth(), image.getHeight() (300, 225) >>> image.getPixel(0, 0) (206, 224, 122)

Transformations: Black and White Compute the average of the three color components in a pixel If the average is less than 128, then set the pixel’s three color components to 0s (black) Otherwise, set them to 255s (white)

blackPixel = (0, 0, 0) whitePixel = (255, 255, 255) for y in xrange(image.getHeight()): for x in xrange(image.getWidth()): (r, g, b) = image.getPixel(x, y) average = (r + g + b) / 3 if average < 128: image.setPixel(x, y, blackPixel) else: image.setPixel(x, y, whitePixel) Transformations: Black and White

Transformations: Inversion Should turn black into white or white into black Reset each color component of a pixel to 255 minus that component’s value

for each pixel in the image: subtract each color component from 255 Transformations: Inversion

Transformations: Grayscale Compute the average of the three color components in a pixel Reset each color component of the pixel to this average value

Transformations: Grayscale for y in xrange(image.getHeight ()) for x in xrange(image.getWidth()): (r, g, b) = image.getPixel(x, y) ave = (r + g + b) / 3 image.setPixel(x, y, (ave, ave, ave))

A Better Grayscale Algorithm The simple average of the RGB values does not take account of the human retina’s different sensitivities to the luminance of those values The human eye is more sensitive to green, then red, and finally blue Psychologists have determined the exact sensitivities Multiply each value by a weight factor and then add them up

A Better Grayscale Algorithm red = int(red * 0.299) green = int(green * 0.587) blue = int(blue * 0.114) gray = red + green + blue image.setPixel(x, y, (gray, gray, gray)) Old New

Package Code in a Function def grayScale(image): for y in xrange(image.getHeight ()): for x in xrange(image.getWidth()): (r, g, b) = image.getPixel(x, y) ave = (r + g + b) / 3 image.setPixel(x, y, (ave, ave, ave)) Note that this function does not return a new image, but modifies its argument Until now, functions did not modify arguments This is the most efficient way of modifying large data objects

For Wednesday Finish the reading the handout on image processing