EELE 5110 Digital Image Processing Lab 02: Image Processing with MATLAB

Similar documents
MATLAB Image Processing Toolbox

Digital Image processing Lab

EGR 111 Image Processing

Image processing in MATLAB. Linguaggio Programmazione Matlab-Simulink (2017/2018)

Transform. Processed original image. Processed transformed image. Inverse transform. Figure 2.1: Schema for transform processing

MATLAB 6.5 Image Processing Toolbox Tutorial

DSP First Lab 06: Digital Images: A/D and D/A

A PROPOSED ALGORITHM FOR DIGITAL WATERMARKING

Lab 1. Basic Image Processing Algorithms Fall 2017

Brief Introduction to Vision and Images

Matlab for CS6320 Beginners

5.1 Image Files and Formats

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

Image Processing. Chapter(3) Part 2:Intensity Transformation and spatial filters. Prepared by: Hanan Hardan. Hanan Hardan 1

6.098/6.882 Computational Photography 1. Problem Set 1. Assigned: Feb 9, 2006 Due: Feb 23, 2006

TDI2131 Digital Image Processing (Week 4) Tutorial 3

Getting Started With The MATLAB Image Processing Toolbox

Image representation, sampling and quantization

Previous Lecture: Today s Lecture: Announcements: 2-d array examples. Image processing

ECE 619: Computer Vision Lab 1: Basics of Image Processing (Using Matlab image processing toolbox Issued Thursday 1/10 Due 1/24)

L2. Image processing in MATLAB

Lab P-8: Digital Images: A/D and D/A

EP375 Computational Physics

COURSE ECE-411 IMAGE PROCESSING. Er. DEEPAK SHARMA Asstt. Prof., ECE department. MMEC, MM University, Mullana.

Play with image files 2-dimensional array matrix

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

CS/NEUR125 Brains, Minds, and Machines. Due: Wednesday, February 8

We are IntechOpen, the world s leading publisher of Open Access books Built by scientists, for scientists. International authors and editors

Index of Command Functions

Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates

Previous Lecture: Today s Lecture: Announcements: 2-d array examples. Working with images

Computer Vision using MatLAB and the Toolbox of Image Processing. Technical Report B Abstract

Computer Assisted Image Analysis 1 GW 1, Filip Malmberg Centre for Image Analysis Deptartment of Information Technology Uppsala University

Lecture 1: Introduction to Matlab Programming

INTRODUCTION TO IMAGE PROCESSING

Modular arithmetic Math 2320

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

Chapter 3 Image Enhancement in the Spatial Domain. Chapter 3 Image Enhancement in the Spatial Domain

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

An Introduction to Digital Image Processing with Matlab Notes for SCM2511 Image Processing 1 Semester 1, 2004

The Use of Non-Local Means to Reduce Image Noise

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

Installation. Binary images. EE 454 Image Processing Project. In this section you will learn

Digital Image Processing 3/e

Mech 296: Vision for Robotic Applications. Vision for Robotic Applications

INTRODUCTION TO MATLAB

Image and Multidimensional Signal Processing

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

Digital Image Processing

2. Picture Window Tutorial

Image restoration and color image processing

Image Enhancement using Histogram Equalization and Spatial Filtering

Digital Image Fundamentals. Digital Image Processing. Human Visual System. Contents. Structure Of The Human Eye (cont.) Structure Of The Human Eye

Digital Image Fundamentals. Digital Image Processing. Human Visual System. Contents. Structure Of The Human Eye (cont.) Structure Of The Human Eye

PHOTO 11: INTRODUCTION TO DIGITAL IMAGING

Computers and Imaging

Princeton ELE 201, Spring 2014 Laboratory No. 2 Shazam

Digital Image Processing

Pixilation and Resolution name:

Reading instructions: Chapter 6

Computer Vision & Digital Image Processing

Image Processing for Mechatronics Engineering For senior undergraduate students Academic Year 2017/2018, Winter Semester

Oversubscription. Sorry, not fixed yet. We ll let you know as soon as we can.

Waitlist. We ll let you know as soon as we can. Biggest issue is TAs

Image Processing Toolbox: Functions by Category

LINEAR AND NONLINEAR FILTER FOR IMAGE PROCESSING USING MATLAB S IMAGE PROCESSING TOOLBOX

MEANS OF EXTENDING VISION FROM VISIBLE TO INFRARED SPECTRUM AND PRACTICAL IMPLEMENTATION

Image optimization guide

How to use filters Adobe Systems Incorporated How to use filters 1

Table of Contents 1. Image processing Measurements System Tools...10

Photoshop Elements Week 1 - Photoshop Elements Work Environment

Digital Image Processing. Lecture # 8 Color Processing

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

CS 484, Fall 2018 Homework Assignment 1: Binary Image Analysis

Panoramas and the Info Palette By: Martin Kesselman 5/25/09

ImagesPlus Basic Interface Operation

Signals and Systems Edward A. Lee Pravin Varaiya University of California at Berkeley

Images and Displays. Lecture Steve Marschner 1

Experiment # 4. Binary Addition & Subtraction. Eng. Waleed Y. Mousa

RGB COLORS. Connecting with Computer Science cs.ubc.ca/~hoos/cpsc101

Digital Photographs and Matrices

Indexed Color. A browser may support only a certain number of specific colors, creating a palette from which to choose

Visual Media Processing Using MATLAB Beginner's Guide

Photoshop 01. Introduction to Computer Graphics UIC / AA/ AD / AD 205 / F05/ Sauter.../documents/photoshop_01.pdf

EE/GP140-The Earth From Space- Winter 2008 Handout #16 Lab Exercise #3

ANALYSIS OF IMAGE ENHANCEMENT TECHNIQUES USING MATLAB

Digital Photography 1

DIGITAL IMAGE PROCESSING (COM-3371) Week 2 - January 14, 2002

Lecture #2. Image acquisition Images in the spatial domain. MATLAB image processing. EECS490: Digital Image Processing

GRAPHICAL USER INTERFACE FOR DATA PROCESSING IN MEDICAL IMAGING A THESIS SUBMITTED TO THE FACULTY OF ACHITECTURE AND ENGINEERING OF EPOKA UNIVERSITY

Applying mathematics to digital image processing using a spreadsheet

IMAGE PROCESSING: POINT PROCESSES

Color, Resolution, & Other Image Essentials

MGM's Jawaharlal Nehru Engineering College N-6, Cidco, Aurangabad, Maharashtra Department of Instrumentation & Control Engineering

Video Process Gallery.

Eight Queens Puzzle Solution Using MATLAB EE2013 Project

Image Extraction using Image Mining Technique

Lesson 16 Text, Layer Effects, & Filters

ME 6406 MACHINE VISION. Georgia Institute of Technology

Color and More. Color basics

Transcription:

Prepared by: Eng. AbdAllah M. ElSheikh EELE 5110 Digital Image Processing Lab 02: Image Processing with MATLAB Welcome to the labs for EELE 5110 Image Processing Lab. This lab will get you started with using MATLAB and the Image Processing Toolbox (IPT) to accomplish numerous basic image processing tasks. It prepares students for more specialized topics and techniques in the subsequent weeks. 1 Getting Started 1.1 Images as Matrices In MATLAB, most images are stored as two-dimensional matrices, in which each element of the matrix corresponds to a single pixel in the image. For example, an image composed of 200 rows and 300 columns of pixels would be stored in MATLAB as an M-by-N matrix of 200-by-300 matrix elements. Fig.1 : [Left] the usual image coordinates. [Right] the matrix coordinates of Matlab. However we note that unlike the coordinate convention used in many textbooks, the matrix coordinates in MATLAB originate at (r,c) = (1,1) instead of (x,y) = (0,0). Furthermore, some images, such as truecolor RGB images, require a three-dimensional matrix, where the first component matrix in the third dimension represents the red pixel intensities, the second component matrix represents the green pixel intensities, and the third component matrix represents the blue pixel intensities. 1.2 IPT Basics IPT extends MATLAB with almost 200 functions for processing digital images. These functions include routines for inputting (outputting) images from (to) files such as: imread and imwrite; displaying images on the monitor such as imshow; geometric transformation such as: imresize and imrotate; and many other image processing operations. To start with, let us read an image into a matrix and then have it displayed onto the monitor: >> f = imread( rose.tif ); >> imshow(f) You should see a grayscale or intensity image of a rose pop up in the figure window. By default, imshow attempts to display the image at 100% magnification (one screen pixel for each image pixel).

However, if an image is too large to fit in a figure window, imshow scales the image to fit onto the screen and issues a warning message. >> figure, imshow(imrotate(f,180)) >> imwrite(imrotate(f,180), rose-upside-down.tif ) Now, the rose image should appear upside down in a new figure window and you have also created a new file for the rotated rose image. To see the information of your new image file: >> imfinfo( rose-upside-down.tif ) Next we will use colormap to tweak the colormap property of a figure. A colormap is an Mby-3 matrix of RGB-tuples, where each tuple specifies a color by the red, green and blue component values in the RGB color model. False colormap can be used to enhance the presentation of an image. In this example, we will make use of it to investigate the uniformity of the image background. Estimating and subtracting an image background are two preliminary steps often used for object detection processing. >> g = imread( rice.tif ); >> imshow(g), colormap( JET ), figure, imshow(g) >> pixval on Fig.2 : the rice.tif image. the image with the JET colormap. In the rice.tif image, the background illumination is brighter in the center of the image than at the bottom. This variation can be clearly visualized by changing the colormap property as illustrated in Fig.2. Meanwhile, the pixval command installs a bar at the bottom of the figure which interactively displays the pixel coordinates and value for whichever pixel the cursor is currently over. If you are able to resolve all the hitches so far, Congratulations! You are likely to reward yourself with many more roses by the weekend. Otherwise, contact your tutor.

1.3 Arithmetic Operations Image arithmetic deals with standard arithmetic operations, such as addition, subtraction, multiplication, and division, on image pixels. Image arithmetic has many uses in image processing both as a preliminary step in complex operations and by itself. Addition: I(x,y) = min[i1(x,y)+i2(x,y), Imax] Subtraction: I(x,y) = max[i1(x,y)-i2(x,y), Imin] Division: I(x,y) = I1(x,y)/I2(x,y) where I2(x,y)<>0 Sensibly I2(x,y) may take the form of a constant: Addition: I(x,y) = min[i1(x,y)+ C, Imax] Subtraction: I(x,y) = max[i1(x,y)- C, Imin] Division: I(x,y) = I 1 (x,y)/c where C<>0 The formulation can also be extended to obtain the negative of an image: Complement: I(x,y) = I max - I 1 (x,y) Note I(x,y) are in the range of values permitted by its datatype. For example if I(x,y) is an 8-bit image, the pixel values are mapped only to the range of 0-255. Overflow values i.e. I(x,y)>255 and I(x,y)<0 will be clipped at 255 and 0 respectively. IPT offers support for several arithmetic operations. To browse the list of IPT functions, type: >> help images Among others, you should notice the following arithmetic functions: Note that these functions have been written to observe various range requirements e.g. uint8 and uint16 datatypes frequently used to represent images in MATLAB. To add two images: >> f = imread( rose.tif ); >> g = imread( rice.tif ); >> figure, imshow(imadd(f,g)) [c] Fig.3 : the rose.tif image. the rice.tif image. [c] the image obtained by adding and.

The result is illustrated in Fig.3. In this example, pixels in y are computed by adding corresponding pixels in f and g: y = f + g Suppose the output image is of 8-bit unsigned integer datatype, so the following range requirement applies: y = f + g y = 255 if (f + g) > 255 and y = 0 if (f + g) < 0. 1.4 Exercises Exercise 1.1: Read the rose.tif and rice.tif images into variables f and g. a) Try various false colormaps on the two images. b) Checking pixel values with pixval on the two images with and without the false colormaps. Any changes? c) Using imrotate, rotate f by 45 counter clockwise. Save the result as f11c.tif. d) Using imresize, reduce f by half, then enlarge the result by double, write the result using imwrite as f11d.tif. Compare the original image with the result obtained, what happened? e) Compute grayslice(image,n) where n=2,4,16, and 32 for the two images. Comments? f) Write the two images as jpeg files. Exercise 1.2: Using f and g in Exercise 1.1, compare and comment the following: a) Compute a = f g and b = g f using imsubtract. b) Compute c = f+g using imadd, where c is of uint16. Compare the result with image illustrated in Fig.3 [c]. c) Compute d = (f+g)/2 and e = imlincomb(.5,f,.5,g). d) Compute i = imcomplement(f). Exercise 1.3: Using f and g in Exercise 1.1, create a black and white {0,1} mask image of the same size. Crop f and g with the mask. (Hint: using AND operator).

2 Creating Image Effects In Exercise 1.3, we create a mask image and use it along with a Boolean operator to crop the rose image. Suppose a mask of the keyhole shape is chosen, the result image shall somewhat look stylistic. In fact many image editing effects can be created by simple image arithmetic and straightforward matrix manipulations. 2.1 Solarization Effects Solarization is a photographic effect in which the image appears partly positive and partly negative. A simple solarization effect can be created by taking the complement of pixels in an image whose intensity values are less than 128. I(x,y)= I(x,y) if I(x,y)>128, I(x,y)= 255-I(x,y) if I(x,y) 128. 2.2 Ripple Effects Fig.4 : Two solarization effects on the rose image. Ripple effects which simulate the reflection of an object on the surface of a pond or an object seen through wavy glasses can be created by pixilated effects obtained by adding and subtracting moduli. >> x = 1:16; >> x+mod(x,4) ans = 2 4 6 4 6 8 10 8 10 12 14 12 14 16 18 16 Fig.5 : The pond ripple effect. The wavy glass effect.

2.3 Oil-Painting Effects An oil-painting effect can be created by taking the pixel values most frequently occurred in a small pixel neighborhood. Fig.6 : The oil-painting effects. 2.4 Exercises Exercise 2.1: By using the equations in Section 2.1, write a function that produces the solarization effect in Fig.4. Exercise 2.2: Try out the M-Files for the oil-paint effect and the ripple effect. Based on the image effects at hands, create your own image effect(s). Explain how it is done. 4 Conclusions Now everyone should have more than a dozen of roses to take home and hopefully each of you is now more comfortable with processing images with IPT and MATLAB. 5 References [1] (Textbook) Chapter 2 of the Digital Image Processing using MATLAB, Gonzalez et. al, 2004. [2] Introduction to Image Processing Toolbox, MATLAB Documentation. [3] Introduction to Digital Image Processing with MATLAB, A. McAndrew, 2004. [4] Beyond Photography: The Digital Darkroom, Holtzmann, Now Accessible Online.