Working with Images: Global vs. Local Operations

Similar documents
Review of concepts. What is a variable? Storage space to keep data used in our programs Variables have a name And also a type Example:

Working with Images: Special Effects

Modifying pictures with loops

Picture Encoding and Manipulation. We perceive light different from how it actually is

CS 100 Introduction to Computer Science Solutions to Final Sample Questions, Fall 2015

Chapter 5: Picture Techniques with Selection

CS 100 Introduction to Computer Science Final Sample Questions, Fall 2015

CS 376A Digital Image Processing

Removing Red Eye. Removing Red Eye

Image Processing & Perception

Tutorial: Correcting images

Computer Science 1 (1021) -- Spring 2013 Lab 2 & Homework 1 Image Manipulation I. Topics covered: Loops, Color, Brightness, and Contrast

from: Point Operations (Single Operands)

4/9/2015. Simple Graphics and Image Processing. Simple Graphics. Overview of Turtle Graphics (continued) Overview of Turtle Graphics

Opposite page: Mars Rover. Photo courtesy of NASA/JPL Caltech

Sampling Rate = Resolution Quantization Level = Color Depth = Bit Depth = Number of Colors

CS 445 HW#2 Solutions

IMAGE PROCESSING: POINT PROCESSES

Title goes Shadows and here Highlights

Introduction to Programming. My first red-eye removal

CS 547 Digital Imaging Lecture 2

PHOTOSHOP & ILLUSTRATOR BOOTCAMP

CoE4TN4 Image Processing. Chapter 3: Intensity Transformation and Spatial Filtering

UWCSE BRIDGE. August 4-5, 2008

How to Create a Landscape Wallpaper for your Desktop

An Introduction to Photoshop 6. Photoshop. retouching applications. images, Lightweight version: Photoshop Elements

>>> from numpy import random as r >>> I = r.rand(256,256);

Do photographic techniques reinforce message? Will a crop help content, composition?

Adobe Photoshop. Levels

Black (and White) Magic

Photoshop Lab Colour Demonstrations. Imaginary Colours.

Photoshop Elements 3 Photo Restoration

Image Processing Computer Graphics I Lecture 20. Display Color Models Filters Dithering Image Compression

1. Brightness/Contrast

PHOTOSHOP COLOR CORRECTION: EXTREME COLOR CAST

Adobe Studio on Adobe Photoshop CS2 Enhance scientific and medical images. 2 Hide the original layer.

BCC Glow Filter Glow Channels menu RGB Channels, Luminance, Lightness, Brightness, Red Green Blue Alpha RGB Channels

Image Editor Project

>>> from numpy import random as r >>> I = r.rand(256,256);

Advanced Masking Tutorial

Digital Image Processing. Lecture # 8 Color Processing

Color and More. Color basics

Digital Image Processing Lec.(3) 4 th class

Image Processing. 2. Point Processes. Computer Engineering, Sejong University Dongil Han. Spatial domain processing

Images and Graphics. 4. Images and Graphics - Copyright Denis Hamelin - Ryerson University

Step 5) Split the red data using the Multi Scale Decomposition tool into a detail and residual background image.

Applying mathematics to digital image processing using a spreadsheet

User s Guide. Windows Lucis Pro Plug-in for Photoshop and Photoshop Elements

Image Processing COS 426

Image Processing. Michael Kazhdan ( /657) HB Ch FvDFH Ch. 13.1

Tablet overrides: overrides current settings for opacity and size based on pen pressure.

Activity Graphics: Image Processing

Color Correction and Enhancement

Fireworks Bitmap Graphics Hands on practice notes. Basic Panels to note in Fireworks (Review)

Add Photoshop Masks and Adjustments to RAW Images

A Division of Sun Chemical Corporation. Unsharp Masking How to Make Your Images Pop!

RGB colours: Display onscreen = RGB

Adobe Lightroom CC Tutorial

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

40 Digital Photo Retouching Techniques COPYRIGHTED MATERIAL

How to use advanced color techniques

Basic Digital Dark Room

Kent Messamore 3/6/2010

Digital Image Processing. Digital Image Fundamentals II 12 th June, 2017

Recovering highlight detail in over exposed NEF images

32 Float v2 Quick Start Guide. AUTHORED BY ANTHONY HERNANDEZ - (415)

Solution for Image & Video Processing

Photoshop Elements 3 Selections and Paint Tools

Colors in Images & Video

Image processing. Image formation. Brightness images. Pre-digitization image. Subhransu Maji. CMPSCI 670: Computer Vision. September 22, 2016

4. Measuring Area in Digital Images

CSC 320 H1S CSC320 Exam Study Guide (Last updated: April 2, 2015) Winter 2015

Image Processing. Adam Finkelstein Princeton University COS 426, Spring 2019

An Introduction to Layers, Masks and Channels in Photoshop

Exercise NMCGJ: Image Processing

Use of the built-in Camera Raw plug-in to take your RAW/JPEG/TIFF file and apply basic changes

Image analysis. CS/CME/BIOPHYS/BMI 279 Fall 2015 Ron Dror

MassArt Studio Foundation: Visual Language Digital Media Cookbook, Fall 2013

Image Enhancement contd. An example of low pass filters is:

Objective Explain design concepts used to create digital graphics.

Create a Surreal Out of Bounds Photo Manipulation in Photoshop

Introduction to Color Theory

A Basic Guide to Photoshop CS Adjustment Layers

Fundamentals of Multimedia

MATLAB Image Processing Toolbox

Improve your photos and rescue old pictures

Editing Using Photoshop CS5

NON UNIFORM BACKGROUND REMOVAL FOR PARTICLE ANALYSIS BASED ON MORPHOLOGICAL STRUCTURING ELEMENT:

EE299 Midterm Winter 2007 Solutions

Lane Detection in Automotive

Liquid Camera PROJECT REPORT STUDY WEEK FASCINATING INFORMATICS. N. Ionescu, L. Kauflin & F. Rickenbach

CS534 Introduction to Computer Vision. Linear Filters. Ahmed Elgammal Dept. of Computer Science Rutgers University

COLORIZING IMAGES WITH GRADIENT MAPS

Optimizing Images and Video for an LED Display

Adobe Fireworks CS4 Kalamazoo Valley Community College February 25, 2010

Histogram Equalization

CS 591 S1 Midterm Exam Solution

HISTOGRAMS. These notes are a basic introduction to using histograms to guide image capture and image processing.

Scratch LED Rainbow Matrix. Teacher Guide. Product Code: EL Scratch LED Rainbow Matrix - Teacher Guide

Digital Image Processing. Lecture # 4 Image Enhancement (Histogram)

Transcription:

Processing Digital Images Working with Images: Global vs. Local Operations CSC121, Introduction to Computer Programming ORIGINAL IMAGE DIGITAL FILTER digital images are often processed using digital filters digital filters are mathematical functions that operate on the pixels of the image FILTERED IMAGE Global vs. Local Image Processing global operations (filters) perform (potentially) the same basic process on all pixels in the image regardless of their position local operations (filters) perform some process on a pixel based on its features, position, and relations to other pixels Global Image Operations What kind of image operations are global? brightening, darkening contrast, increasing/decreasing ranges of light and dark color corrections, adjustments equalization, expanding proportionally the range of light and dark pixels pseudocoloring, mapping colors to pixel values 1

Color Corrections Equalization original (left) has a color cast that is removed for finished version (right) inset is equalized to reveal an enhanced image with improved contrast Pseudocoloring Global vs. Local Image Processing def changered(picture, amount): for pixel in getpixels(picture): value = getred(pixel) setred(pixel, value * amount) >>>changered(pict, 0.25) original (left) is pseudo- colored (right) to reveal floodplains and agricultural plots along the Mississippi River 2

Global Operations The basic template for a global operation can be written in Python this way def basicglobalfilter(pic): for pixel in getpixels(pic): r = getred(pixel) g = getgreen(pixel) b = getblue(pixel) # DO SOMETHING TO r,g,b HERE setred(pixel,r) setgreen(pixel,g) setblue(pixel,b) Global vs. Local Image Processing What kind of practical applications involve local operations? Global Operations Here is an example converting color to a grayscale version def grayfilter(pic): for pixel in getpixels(pic): r = getred(pixel) g = getgreen(pixel) b = getblue(pixel) lum = (r + g + b) / 3 setred(pixel,lum) setgreen(pixel,lum) setblue(pixel,lum) Example: Image Compositing Problem: Copy top half of a picture to its bottom half sharpening, blurring color replacements, e.g., eliminating red- eye special color effects, e.g., posterizing, sepia tones image compositing, e.g., object removal or addition, cloning objects edge detection etc. 3

Problem: Copy top half of a picture to its bottom half Problem: Copy top half of a picture to its bottom half let s walkthrough the process with a small example imagine a 2D array of pixels with integer values produces an one- dimensional array of pixels in row- order start = 0 stop = 8 counting sequence = 0 7 each pixel from pixels[8] pixels[15] is reassigned the value from pixels[1] pixels[7], respectively 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 4

the copied array back in 2D format Image Processing with Selection global and local image operations may involve selection Python makes choices with the if statement if (some_test): #This Python statement will execute if test is true print This is true! print This will print, either way. Problem: Changing Colors Problem: Changing Colors Suppose that we wanted to change the color of the CS truck from orange to purple Suppose that we wanted to change the color of the CS truck from orange to purple Considerations: standard orange in Python = Color(255, 200, 0) using explore( ), we find that the burnt orange pixels are closer to Color(185, 75, 45) a bright purple = Color(127, 0, 255) 5

Suppose that we wanted to change the color of the CS truck from orange to purple Considerations: the distance( ) function gives us the Euclidean distance between 2 colors in color space, i.e., we look for pixels that are relatively close to burnt orange and change them to purple def turnpurple(): file="/users/jtallen/desktop/cstruck1.jpg" burnt = makecolor(185, 75, 45) # burnt orange color picture = makepicture(file) # make new purple color r = 127 b = 255 g = 0 for px in getpixels(picture): color = getcolor(px) if distance(color, burnt) <75.0: setcolor(px, makecolor(r,g,b)) show(picture) return picture def turnpurple(): file="/users/jtallen/desktop/cstruck1.jpg" burnt = makecolor(185, 75, 45) # burnt orange color picture = makepicture(file) # make new purple color r = 127 b = 255 Python comments g = 0 are signified by the for px in getpixels(picture): # character color = getcolor(px) if distance(color, burnt) <75.0: setcolor(px, makecolor(r,g,b)) show(picture) return picture 6

okay, but, we have a small problem NOTE: the target pixels are in rows lower than 200 other parts of the image are also affected, Local Version def turnpurpleinrange(): burnt = makecolor(185, 75, 45) file="/users/jtallen/desktop/cstruck1.jpg" picture = makepicture(file) # new purple r = 127 b = 255 g = 0 for px in getpixels(picture): y = gety(px) if y >= 200: # pixels lower than row 200 color = getcolor(px) if distance(color, burnt)<75.0: setcolor(px, makecolor(r,g,b)) show(picture) return picture 7