Image Manipulation: Filters and Convolutions

Similar documents
CSE 564: Scientific Visualization

Medical Images. Digtial Image Processing, Spring

Obamicon. Histogram Equalization 3/29/2012. Thresholding for Image Segmentation

Thresholding for Image Segmentation

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

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

IMAGE PROCESSING: AREA OPERATIONS (FILTERING)

Image Filtering. Median Filtering

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

Creative Image Processing - Cat made of glyphs

Image Processing COS 426

EMGU CV. Prof. Gordon Stein Spring Lawrence Technological University Computer Science Robofest

Motion illusion, rotating snakes

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

Digital Image Processing

CSE 564: Visualization. Image Operations. Motivation. Provide the user (scientist, t doctor, ) with some means to: Global operations:

1. Exercises in simple sketches. All use the default 100 x 100 canvas.

Image Processing for feature extraction

CATEGORY SKILL SET REF. TASK ITEM

קורס גרפיקה ממוחשבת 2008 סמסטר ב' Image Processing 1 חלק מהשקפים מעובדים משקפים של פרדו דוראנד, טומס פנקהאוסר ודניאל כהן-אור

Vision Review: Image Processing. Course web page:

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

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

Image Processing. What is an image? קורס גרפיקה ממוחשבת 2008 סמסטר ב' Converting to digital form. Sampling and Reconstruction.

Image Enhancement in the Spatial Domain Low and High Pass Filtering

HOW TO CREATE A SUPER SHINY PENCIL ICON

Color Space 1: RGB Color Space. Color Space 2: HSV. RGB Cube Easy for devices But not perceptual Where do the grays live? Where is hue and saturation?

Images and Filters. EE/CSE 576 Linda Shapiro

Improving digital images with the GNU Image Manipulation Program PHOTO FIX

Multimedia Systems Image II (Image Enhancement) Mahdi Amiri April 2012 Sharif University of Technology

General Workflow for Processing L, Ha, R, G, and B Components in ImagesPlus

02/02/10. Image Filtering. Computer Vision CS 543 / ECE 549 University of Illinois. Derek Hoiem

The Unique Role of Lucis Differential Hysteresis Processing (DHP) in Digital Image Enhancement

BCC Film Damage Filter

Image Processing and Computer Graphics

PICTURE AS PAINT. Most magazine articles written. Creating a seamless, tileable texture in GIMP KNOW-HOW. Brightness. From Photo to Tile

Preparing Remote Sensing Data for Natural Resources Mapping (image enhancement, rectifications )

Image Capture and Problems

A Basic Guide to Photoshop Adjustment Layers

Image enhancement. Introduction to Photogrammetry and Remote Sensing (SGHG 1473) Dr. Muhammad Zulkarnain Abdul Rahman

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

PLazeR. a planar laser rangefinder. Robert Ying (ry2242) Derek Xingzhou He (xh2187) Peiqian Li (pl2521) Minh Trang Nguyen (mnn2108)

Table of contents. Vision industrielle 2002/2003. Local and semi-local smoothing. Linear noise filtering: example. Convolution: introduction

Last Lecture. photomatix.com

June 30 th, 2008 Lesson notes taken from professor Hongmei Zhu class.

Computer Graphics (Fall 2011) Outline. CS 184 Guest Lecture: Sampling and Reconstruction Ravi Ramamoorthi

Video Process Gallery.

Add Photoshop Masks and Adjustments to RAW Images

Digital Image Processing

CS 4501: Introduction to Computer Vision. Filtering and Edge Detection

A Basic Guide to Photoshop CS Adjustment Layers

Exercise NMCGJ: Image Processing

Tutorial: Correcting images

Adobe Photoshop Chapter 5 Study Questions /50 Total Points

Image filtering, image operations. Jana Kosecka

2Click the Symbol XX

Computer Graphics Fundamentals

Creating Pastel Images and other effects in Photoshop

Image Perception & 2D Images

Stretching Your Photons

Additive Color Synthesis

Chapter 4. Incorporating Color Techniques

Chapter 8. Working with Transparency, Effects, and Graphic Styles and Recoloring Artwork Delmar, Cengage Learning

Midterm Examination CS 534: Computational Photography

Practical Image and Video Processing Using MATLAB

CEE598 - Visual Sensing for Civil Infrastructure Eng. & Mgmt.

Mahdi Amiri. March Sharif University of Technology

Basic Digital Dark Room

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

CS6670: Computer Vision Noah Snavely. Administrivia. Administrivia. Reading. Last time: Convolution. Last time: Cross correlation 9/8/2009

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

SECTION I - CHAPTER 2 DIGITAL IMAGING PROCESSING CONCEPTS

Design of background and characters in mobile game by using image-processing methods

Enhancement Techniques for True Color Images in Spatial Domain

EE482: Digital Signal Processing Applications

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

Performance Evaluation of Edge Detection Techniques for Square Pixel and Hexagon Pixel images

Color Transformations

Using Curves and Histograms

Filters. Motivating Example. Tracking a fly, oh my! Moving Weighted Average Filter. General Picture

Achim J. Lilienthal Mobile Robotics and Olfaction Lab, AASS, Örebro University

Last Lecture. photomatix.com

Image Filtering in Spatial domain. Computer Vision Jia-Bin Huang, Virginia Tech

Matlab (see Homework 1: Intro to Matlab) Linear Filters (Reading: 7.1, ) Correlation. Convolution. Linear Filtering (warm-up slide) R ij

Prof. Feng Liu. Winter /10/2019

in association with Getting to Grips with Printing

Introduction to Color Theory

CIS581: Computer Vision and Computational Photography Homework: Cameras and Convolution Due: Sept. 14, 2017 at 3:00 pm

A quick note: We hope that you will find something from the Tips and Tricks that will add a little pizazz to your yearbook pages!

How to Control Tone and Contrast in BW Conversion

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

Lecture Topic: Image, Imaging, Image Capturing

Filip Malmberg 1TD396 fall 2018 Today s lecture

Image Processing. Image Processing. What is an Image? Image Resolution. Overview. Sources of Error. Filtering Blur Detect edges

Photoshop Filters. Applying Filters from the Filter Menu

Project Final Report. Combining Sketch and Tone for Pencil Drawing Rendering

Digital Image Processing

GE 113 REMOTE SENSING. Topic 7. Image Enhancement

CSCI 1290: Comp Photo

ENGG1015 Digital Images

Transcription:

Dr. Sarah Abraham University of Texas at Austin Computer Science Department Image Manipulation: Filters and Convolutions Elements of Graphics CS324e Fall 2017

Student Presentation

Per-Pixel Manipulation Individual pixels do not influence neighboring pixels Possible modifications include shifts in: Color Brightness Opacity

Grayscale RGB channels of pixel have the same value Content of image expressed through color value rather than hue or saturation How might we find a single value that captures the information of three color channels?

High Contrast Increase or decrease value of RGB channels based on pixel brightness Changes in value across image further emphasized How might we make some pixels darker and some pixels brighter?

HSV/HSB Hue-Saturation-Value commonly used in digital color pickers Hue: pure color Saturation: amount of color Value (Brightness): darkness or lightness of color

Setting Color Mode colormode(model, range1, range2, range3) Examples: colormode(rgb, 255, 255, 255); colormode(hsb, 360, 100, 100); colormode(rgb, 1.0, 1.0, 1.0); colormode(hsb, 100);

RGB Methods Extract red, green, and blue channels from a pixel: red(color c) green(color c) blue(color c)

HSB Methods Extract hue, saturation and brightness from a pixel: hue(color c) saturation(color c) brightness(color c)

Consider colormode(rgb, 255, 255, 255); fill(50, 100, 100); rect(0, 0, 50, 50); //Rect1 colormode(hsb, 360, 100, 100); fill(50, 100, 100); rect(50, 50, 50, 50); //Rect2

Image Kernels Also called convolution matrix or mask Matrix used to convolve kernel values with image values Square and small (3x3, 5x5 etc) The larger the matrix, the more local information is lost Allows for area effects such as blur, sharpening and edge-detection

Convolution Matrix convolution 1. Multiplication of corresponding cells 2. Summation of these values

Kernel Application Each pixel has the convolution matrix applied to it Value is stored at corresponding location

Question What is the convolution output for the highlighted 3x3 cells?

Hands-on: Understanding Convolutions Today s activities: 1. Complete your tint method if it s not finished 2. Experiment with colormode, switching between RGB and HSB 3. Use RGB and HSB methods 4. Construct this kernel in Processing:

Student Presentation

Applying Convolutions Sharpened Image Original Image

Kernel Traversal How can we traverse both the image pixels and the cells of the kernel?

Accessing pixel neighborhoods Consider the call: int index = (x + i - 1) + img.width*(y + j - 1); Provides an offset to the target pixel Based on i and j values, offset reaches certain number of neighboring pixels in the x and y directions

Sharpen Example Code float[][] matrix = {{0, -1, 0}, {-1, 5, -1}, {0, -1, 0}}; float red, green, blue; //Code to access individual pixel location (x, y) for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { int index = (x + i - 1) + img.width*(y + j - 1); red += red(img.pixels[index]) * matrix[i][j]; //Perform convolution on green and blue color channels } } red = constrain(abs(red), 0, 255); //Clamp green and blue values

Revisiting the Convolution Matrix Each pixel has the convolution matrix applied to it Value is stored at corresponding location What happens if we store values in existing image?

Intermediate Buffer Array of pixels that matches the size of the image Provides safe location for storing image data Allows program to preserve original image data if necessary Buffering is also a common trick to increase speed of rendering (aka double buffering)

Creating a Buffer Can create a duplicate image: loadimage(image_file); Can create a blank image: createimage(width, height, ARGB); Can copy pixel values from one buffer to another copy(img, x, y, width, height, x, y, width, height);

Copying an Image Shallow copy: PImage img1; PImage img2 = img1; Deep copy*: img2.copy(img1, 0, 0, img1.width, img1.height, 0, 0, img2.width, img2.height); * Note that img2 must be initialized (either loaded from image or created as a blank image) before a deep copy will work!

Question What s the difference between a deep copy and a shallow copy?

Box Blur Pixel value is based on average of its neighborhood: 1/9 * {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}} or {{0.11, 0.11, 0.11}, {0.11, 0.11, 0.11}, {0.11, 0.11, 0.11}}

Gaussian Blur Use of Gaussian function for convolution: Low-pass filter that reduces high frequency features including noise Weighted average better preserves features 1D Gaussian distribution

Edge Detection Determines sharp discontinuities in value (i.e. edges) Provides information about scene: Depth Illumination Material Important filter for computer vision/feature extraction

Sobel Operator Two 3x3 kernels that approximate horizontal and vertical derivatives (i.e. changes in light intensity) Horizontal and vertical convolutions performed independently Gradient magnitude calculated from results

Edge Cases What happens when we try to convolve the edge pixels of our image? How can we handle this missing data? Leave edges untouched Fill in missing pixels with 0 or 255 Wrap missing pixels Mirror missing pixels How do these choices affect the image appearance?

Hands-on: Using Convolutions Today s activities: 1. Create a 3x3 2D array in Processing to hold the sharpen image kernel 2. Create an image buffer to store the convolved image data 3. Apply the sharpen kernel to your image and store the convolutions into your secondary image buffer (which displays to the screen)