IMAGE PROCESSING LIBRARY (PIL) This is a package that you can import into python and it has quite a few methods that you can process image files with.

Slides:



Advertisements
Similar presentations
Editing In ImageJ John H. Krantz Hanover College.
Advertisements

Matlab Tutorial. Session 1 Basics, Filters, Color Space, Derivatives, Pyramids, Optical Flow Gonzalo Vaca-Castano.
1 USING FIREWORKS Cropping an Image Obtaining Information Changing Image Size Rotating an Image Adjusting the Color of an Image Drawing Tools Using the.
Screen Printing: Posterization of an Image using Adobe Photoshop Graphic Comm. II Mr. Jarrett.
Chapter 12 Using Clipping Masks, Paths, & Shapes.
Advanced Microsoft Word Hosted by Jared Hoffman Topics Keyboard Shortcuts Customizing Toolbars and Menus Auto Format & Auto Correct Tabs Inserting Pictures.
1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng.
1 Working with Web Graphics – About Web Graphics. File Formats. Image Resolution, Image Size – Creating Web Graphics. Getting Started, Paint Shop Pro 5.
Picture manipulation with photoshop. Free alternatives Gimp Versions for GNU/Linux, Windows, Mac, FreeBSD –Bit.
Adobe Photoshop CS Design Professional PATHS, & SHAPES USING CLIPPING MASKS,
Graphics and Still Images John H. Krantz Hanover College.
Lecture 6 Sept 15, 09 Goals: two-dimensional arrays matrix operations circuit analysis using Matlab image processing – simple examples.
1 Python Programming: An Introduction to Computer Science Chapter 3 Objects and Graphics.
Computer Science 111 Fundamentals of Programming I Introduction to Digital Image Processing.
Lesson One: The Beginning
Welcome! Part Two of how to be a Splash Magazine Superstar Welcome to…
Guide to Programming with Python
PYTHON PLOTTING CURVES CHAPTER 10_5 FROM THINK PYTHON HOW TO THINK LIKE A COMPUTER SCIENTIST.
Photoshop Backgrounds, Buttons, Banners & Animation In PowerPoint Presentations.
Public Computer Center, Moore Memorial Library, Greene, NY.
Image and Video Processing in MATLAB Partly based on slides by Dmitri Roduy.
1 After completing this lesson, you will be able to: Identify the key differences between analog and digital technologies. Define digital camera terms,
Computer Science 111 Fundamentals of Programming I Introduction to Graphics.
September 5, 2013Computer Vision Lecture 2: Digital Images 1 Computer Vision A simple two-stage model of computer vision: Image processing Scene analysis.
Team Babbage Charles Maingi Seph Newman Jon Rollman Nils Schlupp.
Processing Lab 3 – Header issues and trace editing Bryce Hutchinson Objectives: Fixing elevation issues Define an LMO function Pick first breaks Kill traces.
Chapter 9 Fireworks: Part I The Web Warrior Guide to Web Design Technologies.
My computer should look like this to display your scanner & digital camera drivers.
Cows Create Careers Using Microsoft Gif animator How to use Gif animator How to use Gif animator to create a simple (2-frame) animation Samples (linked.
Computer Science 111 Fundamentals of Programming I Introduction to Digital Image Processing.
Processing Workshop. What is processing? “Processing is an open source programming language and environment for people who want to program images, animation,
CSC/FAR 020, Computer Graphics, October 20, 2014 Dr. Dale E. Parson Outline for week 8, Type tools.
Compsci 101.2, Fall Plan for October l Review Catchup and Midterm and Future  Make sure everyone understand options l Review Assignment.
CS 101 – Sept. 14 Review Huffman code Image representation –B/W and color schemes –File size issues.
Chapter 3 Device Monitor Screen Otasuke GP-EX! Chapter 3 Device Monitor Screen Chapter 3 Device Monitor Screen.
Compsci 101.2, Fall Plan for October 22 l Images, tuples, RGB color model  Image processing by understanding API  Image processing with tuples.
© 2011 Delmar, Cengage Learning Chapter 12 Using Clipping Masks, Paths, & Shapes.
Practical Kinetics Exercise 0: Getting Started Objectives: 1.Install Python and IPython Notebook 2.print “Hello World!”
Digital Image Processing
Python & NetworkX Youn-Hee Han
Visual Plastic Surgery Editing Portraits with Photoshop.
Let’s Learn 3. Modules Saenthong School, January – February 2016
Sharpening Spatial Filters ( high pass)  Previously we have looked at smoothing filters which remove fine detail  Sharpening spatial filters seek to.
6.S093: Visual Recognition through Machine Learning Competition MATLAB tutorial.
Employee Prints Record of Personnel Action (form SF 50 or SF 52)
This is what we want to produce Import sketch dimensions Label angles Set the scale Add linear dimensions.
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.
CompSci 101 Introduction to Computer Science March 8, 2016 Prof. Rodger.
1© 2009 Autodesk Hardware Shade – Presenting Your Designs Hardware and Software Shading HW Shade Workflow Tessellation Quality Settings Lighting Settings.
Prepare Launch Spyder Open Spyder (C:/Anaconda2/Scripts/spyder) Or Open from launcher (C:/Anaconda2/Scripts/launcher) Download data
MET4750 Techniques for Earth System Modeling
Introduction to Python
Introducing OpenShot Library
Download JES Tool JES: Jython Environment for Students
Tools and techniques.
IPYTHON AND MATPLOTLIB Python for computational science
DIP 9 65 Original 210 Eye Zoomed.
Fundamentals of Programming I Introduction to Digital Image Processing
EE/CSE 576 HW 1 Notes.
Python plotting curves chapter 10_5
Matplotlib.
EE/CSE 576 HW 1 Notes.
Fundamentals of Programming I Introduction to Digital Image Processing
Hour of Code.
© Hugh McCabe 2000 Web Authoring Lecture 7
Programming for Engineers in Python
Matplotlib and Pandas
ECE/CSE 576 HW 1 Notes.
CMPT 120 Machine that can see! Lecture 21 – Unit 4 – Computer Vision
Python – May 25 Quiz Python’s imaging library Lab
Presentation transcript:

IMAGE PROCESSING LIBRARY (PIL) This is a package that you can import into python and it has quite a few methods that you can process image files with. There are loaders for the majority of the popular file formats The following import is required from PIL import Image The above works already in Anaconda. If you are building your own world using IDLE then you would need to download PIL and install in your environment. Auto generates x values here!

EXAMPLE COMMANDS IN PIL The Image module is quite useful. Here are some examplesImage module from PIL import Image im = Image.open("bride.jpg") #Read in the image im.rotate(45) #Returns a rotated image, 45 degrees im.crop(box) # Returns a copy of a rect. sub-region im.filter(filter) #Returns a copy of an image filtered by the given #filter. For a list of available filters, see the ImageFilter module.ImageFilter im.load() #Returns a high speed pixel access object. im.resize() # Returns the image resized. im.save(“Name”) #Save the image into file “Name”

STRUCTURE OF A 24 BIT IMAGE cols,rows=im.size rows=18 and cols=35 Contents=(R,G,B) tuple i.e. (255,34,128) (14,14) Location=(col,row)

LOOKING AT EVERY PIXEL In order to process each pixel in the image we need to use a double loop. Here is a simple example. for c in range(3): #col values for r in range(5): #row values print c,r col col col

ANTIALISING This is a process that is used in image production that smooths out hard edges with a visual trick. Here is an example. antialiased no antialising

PAINT.NET ANTIALISING Every image processing program has a button or icon to click to turn on/off antialising. The above is paint.nets method. Note you must be in one of the drawing tools, ie pen to see the control. Turn it off or on BEFORE you draw.

I CREATED THIS IMAGE WITHOUT ANTIALISING Lets turn this red to grey

CONVERT RED PIXELS TO GRAY BY LOOPING THRU EVERY PIXEL import matplotlib.pyplot as plt from PIL import Image im = Image.open('thingsnoanti.png') # read in image pix = im.load() #allows fast access for pixel access cols,rows=im.size #get dimensions from size tuple #look at every single pixel and if red turn it to gray. Capice?! for r in range(rows): for c in range(cols): if (pix[c,r] == (255,0,0)): #if pixel is red pix[c,r]=(220,220,220) #set it gray plt.imshow(im) plt.show() Note that you can do anything you want to every pixel using the above method. Just change the blue lines.

USING FILTERS The filter operations (BLUR, SMOOTH, SHARPEN etc) will loop thru the entire image for you. Here is the result of blur as applied to our original image.

AND HERE IS THE CODE import matplotlib.pyplot as plt from PIL import Image from PIL import ImageFilter im = Image.open('thingsnoanti.png') plt.figure(1) #work on figure 1 plt.imshow(im) #show original image plt.show() im1 = im.filter(ImageFilter.BLUR) #lets blur it plt.figure(2) #Work on figure 2 plt.imshow(im1) #show new image plt.show() From ImageFilter module BLUR CONTOUR DETAIL EDGE_ENHANCE EDGE_ENHANCE_MORE EMBOSS FIND_EDGES SMOOTH SMOOTH_MORE SHARPEN

PLOT A HISTOGRAM OF A GRAY-SCALE IMAGE import matplotlib.pyplot as plt from PIL import Image im = Image.open('sea.gif') plt.figure(1) plt.imshow(im) #show original image plt.show() hist = im.histogram() #note that the hist here is a list not an image plt.figure(2) plt.plot(hist) #So we must plot the list NOT imshow() plt.show()

HERE IS AN EXAMPLE