Digital Image Processing Programming Exercise 2012 Part 2

Similar documents
Digital Image Processing 3/e

Anna University, Chennai B.E./B.TECH DEGREE EXAMINATION, MAY/JUNE 2013 Seventh Semester

CSE 564: Scientific Visualization

MATLAB 6.5 Image Processing Toolbox Tutorial

Lecture 3: Linear Filters

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad

Image Enhancement in the Spatial Domain Low and High Pass Filtering

LAB MANUAL SUBJECT: IMAGE PROCESSING BE (COMPUTER) SEM VII

1. (a) Explain the process of Image acquisition. (b) Discuss different elements used in digital image processing system. [8+8]

Image Deblurring. This chapter describes how to deblur an image using the toolbox deblurring functions.

Solution for Image & Video Processing

IMAGE PROCESSING PROJECT REPORT NUCLEUS CLASIFICATION

8.2 IMAGE PROCESSING VERSUS IMAGE ANALYSIS Image processing: The collection of routines and

This content has been downloaded from IOPscience. Please scroll down to see the full text.

Keywords: Image segmentation, pixels, threshold, histograms, MATLAB

Digital Image Processing

SYLLABUS CHAPTER - 2 : INTENSITY TRANSFORMATIONS. Some Basic Intensity Transformation Functions, Histogram Processing.

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

PRACTICAL IMAGE AND VIDEO PROCESSING USING MATLAB

Prof. Vidya Manian Dept. of Electrical and Comptuer Engineering

Chapter 6. [6]Preprocessing

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

from: Point Operations (Single Operands)

DENOISING DIGITAL IMAGE USING WAVELET TRANSFORM AND MEAN FILTERING

SRI VENKATESWARA COLLEGE OF ENGINEERING. COURSE DELIVERY PLAN - THEORY Page 1 of 6

Image restoration and color image processing

Fourier Transform. Any signal can be expressed as a linear combination of a bunch of sine gratings of different frequency Amplitude Phase

SECTION I - CHAPTER 2 DIGITAL IMAGING PROCESSING CONCEPTS

INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET

TDI2131 Digital Image Processing

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

Digital Image Processing

Image acquisition. Midterm Review. Digitization, line of image. Digitization, whole image. Geometric transformations. Interpolation 10/26/2016

Digital Image Processing. Lecture # 6 Corner Detection & Color Processing

Non Linear Image Enhancement

1.Discuss the frequency domain techniques of image enhancement in detail.

Image Processing for feature extraction

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

An Efficient Color Image Segmentation using Edge Detection and Thresholding Methods

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

BASIC OPERATIONS IN IMAGE PROCESSING USING MATLAB

ABSTRACT I. INTRODUCTION

On Fusion Algorithm of Infrared and Radar Target Detection and Recognition of Unmanned Surface Vehicle

Paper Sobel Operated Edge Detection Scheme using Image Processing for Detection of Metal Cracks

Digital Image Processing. Lecture # 3 Image Enhancement

Vision Review: Image Processing. Course web page:

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

Digital Image Processing Question Bank UNIT -I

DIGITAL IMAGE PROCESSING Quiz exercises preparation for the midterm exam

Image Enhancement in the Spatial Domain (Part 1)

Implementing Sobel & Canny Edge Detection Algorithms

Computation Pre-Processing Techniques for Image Restoration

Digital Image Processing

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

Applications of Image Enhancement Techniques An Overview

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

Introduction to MATLAB and the DIPimage toolbox 1

Student: Nizar Cherkaoui. Advisor: Dr. Chia-Ling Tsai (Computer Science Dept.) Advisor: Dr. Eric Muller (Biology Dept.)

Image Processing Lecture 4

Circular averaging filter (pillbox) Approximates the two-dimensional Laplacian operator. Laplacian of Gaussian filter

Digital Image Processing

ENEE408G Multimedia Signal Processing

Midterm Examination CS 534: Computational Photography

Contrast Enhancement in Digital Images Using an Adaptive Unsharp Masking Method

Image Processing Of Oct Glaucoma Images And Information Theory Analysis

MatLab for biologists

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?

Motion illusion, rotating snakes

Enhancement. Degradation model H and noise must be known/predicted first before restoration. Noise model Degradation Model

Carmen Alonso Montes 23rd-27th November 2015

Postprocessing of nonuniform MRI

Computing for Engineers in Python

Image Processing Final Test

IMAGE ENHANCEMENT - POINT PROCESSING

Lane Detection in Automotive

Comparison of Two Pixel based Segmentation Algorithms of Color Images by Histogram

Transforms and Frequency Filtering

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

Introduction to Wavelet Transform. Chapter 7 Instructor: Hossein Pourghassem

Image Enhancement using Histogram Equalization and Spatial Filtering

Practical Image and Video Processing Using MATLAB

Defocusing and Deblurring by Using with Fourier Transfer

IDENTIFICATION OF FISSION GAS VOIDS. Ryan Collette

GE 113 REMOTE SENSING. Topic 7. Image Enhancement

Visual Perception. Overview. The Eye. Information Processing by Human Observer

Blind Single-Image Super Resolution Reconstruction with Defocus Blur

Image Deblurring and Noise Reduction in Python TJHSST Senior Research Project Computer Systems Lab

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

Visual Media Processing Using MATLAB Beginner's Guide

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

Restoration of Motion Blurred Document Images

Midterm is on Thursday!

What is image enhancement? Point operation

Lane Detection in Automotive

Digital Image Processing

Introduction to Wavelets. For sensor data processing

Midterm Review. Image Processing CSE 166 Lecture 10

Syllabus of the course Methods for Image Processing a.y. 2016/17

Image filtering, image operations. Jana Kosecka

International Journal of Advance Engineering and Research Development

Transcription:

Digital Image Processing Programming Exercise 2012 Part 2 Part 2 of the Digital Image Processing programming exercise has the same format as the first part. Check the web page http://www.ee.oulu.fi/research/imag/courses/dkk/pexercise/ occasionally since updates and errata of these instructions will be published on that page. If you experience problems that cannot be solved using the course material and Matlab help files, contact the programming exercise assistant at email address dkk-staff@ee.oulu.fi or by visiting the office TS315. Write your solutions and answers into an exercise report which must then be printed out, stapled together with the requested attachments and filled cover page (download the cover page from the web address mentioned above). You are encouraged to seek information in other places than the course book and lecture material but list all the sources you used in the report. When you have completed all the questions, 1. Return the exercise report (consisting of cover page, actual text and requested attachments) on paper to the mail box with sign Digital image processing on the 3 rd floor of Tietotalo 2. Send all the requested Matlab scripts by e-mail to dkk-staff@ee.oulu.fi. Put your student id number and your name to the subject of the email. The e-mail should contain the following files as attachments: 1) script2_1.m, 2) script2_2.m, 3) script2_3.m, 4) result2_4.jpg, 5) script2_4.m, 6) script2_5.m, 7) script2_6.m, 8) script2_7.m, 9) findgraythresh function. All the Matlab scripts must be attached also to the printed exercise report. The deadline for returning the report and sending the scripts by e-mail is 30.11.2012 15:45. Image restoration 1. The gray-scale images noise1.tif and noise2.tif and the binary image noise3.tif contain different types of noise. Utilizing your knowledge about image restoration in the presence of the noise, write a Matlab script script2_1.m that reduces the noise from the images and plots the resulting images into one figure. Save this figure and include it into the exercise report. Attach script2_1.m to the exercise report and e-mail. Note that there is different kind of noise in the images, so remember to choose a filter which is appropriate for each noise type. Hint: you can compare the results between different methods visually or numerically, e.g. by computing the root mean square error before and after filtering the image (original image for noise1.tif and noise2.tif is available).

2. The image periodic.tif contains a periodic (i.e. sinusoidal) perturbation. Write a Matlab script script2_2.m that loads the image, removes the perturbation as well as possible and displays the resulting image and its Fourier transform in same figure. Save this figure, and include it into the exercise report and explain your solution briefly. Attach script2_2.m to the exercise report and e-mail. Hint: compute the Fourier Transform of the noisy image and plot the magnitude of it using logarithmic scale and imagesc (like in the Programming Assignment 1) or in 3D using mesh function. You should see sharp peaks in the spectral image which should be filtered out. You can easily modify the ideal lowpass filter code example (from PA1) to implement a narrow band-reject filter when you have found the relative frequency that need to be filtered out. 3. Read the part of course material concerning Wiener filtering. Now create a noisy and motion blurred version of jetplane.png: I = imread('jetplane.png'); I = im2double(i); PSF = fspecial('motion', 13, 45); I_blurred = imfilter(i, PSF, 'circular'); I_blurredNoisy = imnoise(i_blurred, 'gaussian', 0, 0.0005); Your task is to write script script2_3.m that restores the image I_blurredNoisy to original as well as possible using the deconvwnr function and plots the original and the restored image into one figure. Note, however, that you will not get a perfect restoration because of the Gaussian noise! A good choice of the NSR parameter of deconvwnr function is important for a successful result because the result is dominated by the effects of noise, which can be easily seen if value NSR=0 is used. Try finding the value that gives the visually good result (e.g. how well you can distinguish the plane type written on the vertical stabilizer). Hint: you get a good estimate of the point spread function (PSF) of the blurring transformation (needed in Wiener filtering) when you take a look at how the image was created. Which value did you chose? What does the parameter NSR represent? Theoretically, what would the correct choice in stead of a scalar value? Plot the restored images obtained using values NSR=0 and your choice of NSR into one image an attach it to the report. Attach script2_3.m to the exercise report and e- mail. Color image processing 4. The colors in the image mandril.png appear too bright and the contrast is too low. As you know from the previous part of this exercise, this type of a problem can be corrected by doing contrast stretching using the imadjust function. Furthermore, the image is slightly

blurry, which can be corrected using a sharpening filter. When processing color images, the things are bit more tricky than in the first programming exercise, because the image now contains three channels. Your task is to write a script script2_4.m which loads the image mandril.png, applies first contrast stretching using the imadjust function followed by a sharpening filter and plots the original image and the enhanced image into one figure. Note that you need to convert the image to HSV (HSI) color space for contrast stretching and do the stretching only to the V channel and then convert the processed image back to RGB color space. You can access the individual channels using e.g. RGB(:,:,1) which gives first channel (red channel) of the RGB image. Why is the contrast stretching performed only to the V channel of the image? Plot the histograms of the V channel before and after contrast stretching into one figure and attach it into the exercise report. Save the processed color image as result2_4.jpg, and attach files script2_4.m and result2_4.jpg to the e-mail. Attach the file script2_4.m to your exercise report. You do not need to print out the color image! Segmentation 5. The course book introduces the following algorithm for finding a threshold T for global thresholding: 1. Select an initial estimate for T. (In this exercise, select T to be the mean gray value of the image to be segmented) 2. Segment the image using T. This will produce two groups of pixels: G1 consists of all pixels with gray level values >T and G2 consisting of pixels with values <= T. 3. Compute the average gray level values u1 and u2 for the pixels in regions G1 and G2. 4. Compute a new threshold value T=0.5 (u1 + u2) 5. Repeat steps 2 through 4 until the difference in T in successive iterations is smaller than a predefined parameter T0. (In this exercise, T0=1). Write a Matlab function findgraythresh that implements this algorithm. Test your function with the image eight.tif. Using the settings given above, you should obtain a threshold of 165.47. Segment the image using this threshold with function im2bw value and plot the resulting black-and-white image (Image 1.) As you can see, the resulting image contains unwanted noise (white dots in the coin area). Use morphological operators (function bwmorph) to remove the noise. Plot the resulting image from which noise has been removed (Image 2.). Which morphological operator did you use?

Another way of removing the noise is to process the image before segmentation. Use the fspecial function to create a convolution mask of a Gaussian filter and filter the image using this mask: >> h=fspecial('gaussian',7,2); >> eight2=imfilter(eight,h); % where eight = original image Plot the filtered image (Image 3.), find a threshold for this new image using findgraythresh and segment the filtered image with im2bw. What is the gray-level threshold that you got for the filtered image? Plot the resulting black-and-white image (Image 4.). Use morphological boundary extraction (see course book or lecture material) to the binary image to find the pixels on the boundary of the coins. Superimpose the result on the original image, assuming that the variable boundary contains the result of boundary extraction: eight3=eight; eight3(boundary==1)=0; and plot the resulting image (Image 5.). Plot images 1, 2, 3 and 4 in one figure and the Image 5 into one separate figure. Put all your Matlab code performing the required tasks into script2_5.m. Attach the figures and script2_5.m and findgraythresh.m to the exercise report and attach script2_5.m and findgraythresh.m to the e-mail. Watersheds 6. If the imaging conditions are not optimal or the image is cluttered, thresholding does not produce acceptable segmentation. Here we simulate difficult lighting conditions by multiplying the image with a lighting component : I=imread('eight.tif'); I=double(I); load('light.mat'); I2=I.*light; imshow(uint8(i2)); The resulting image cannot be segmented with a simple thresholding method. Try, what happens. Attach the resulting image to your report and explain the results. Instead, we compute the gradient magnitude and apply watershed segmentation. Read the part concerning watersheds in the lecture material and do the following: h=fspecial('sobel'); gx=imfilter( I2, h, 'replicate' ); gy=imfilter( I2, h', 'replicate' ); g=sqrt(gx.^2 + gy.^2); L=watershed(g); imshow(l==0); % horizontal % and vertical gradients % combined magnitudes

As you can see, watershed segmentation causes severe over-segmentation. This is because watersheds create an image segment around every local minimum in the input image. To see the locations of the local minima in the gradient image, try: imshow(imregionalmin(g)); To overcome this problem, we use so called markers. Make a set of internal markers, i.e. set of pixels that are certain to belong into foreground objects: im=zeros(size(g)); im(50,125)=1; im(150,75)=1; im(75,250)=1; im(200,200)=1; Note that the set of internal markers can also be obtained automatically using, e.g. texture, size or shape of the objects but here we placed the markers by hand for clarity. We also need external markers that are certain to belong to background. Here we choose to mark to background those pixels that lie exactly midway between internal markers. This is done by solving another watershed problem: Lim=watershed(bwdist(im)); %bwdist computes distance transform for each pixel - em=lim==0; %larger value means longer distance from marker points markers=em im; %(i.e. nearest nonzero pixel) imshow(markers); Next we use the function imimposemin to modify the input image so that local minima occur only at marked locations: g2=imimposemin(g,markers); L2=watershed(g2); I3=I2; I3(L2==0)=0; imshow(uint8(i3)); You should get a rather good segmentation between the coins and background. Attach the resulting image to your report, and your Matlab code as script2_6.m to the report and e-mail (script2_6.m should contain all the different phases of this segmentation task, i.e. the simple tresholding experiment and the watershed part). Wavelets and image compression 7. Load the image lena.tif into matrix I, plot it and convert it to double type. Now use the wavelet toolbox of Matlab (installed on the workstations of the Department of Electrical and Information Engineering) to create a 3-level decomposition of the image using Haar wavelets:

[C,S]=wavedec2(I,3,'haar'); Plot the coefficients with the function plotwaveletcoeff (from the zip-file): plotwaveletcoeff(c,s); Now, we demonstrate image compression with wavelets by setting most detail coefficients to zero (this is a very simple quantization method - in a real compression systems more sophisticated quantization would be used): % Approximation coefficients: a=c(1:s(1,1)*s(1,2)); % Detail coefficients: d=c(s(1,1)*s(1,2)+1:size(c,2)); % 90% of absolute values of detail coefficients are smaller than this threshold value thresh=qtile(abs(d),0.90) % Set these these detail coefficients to zero and plot the resulting coefficients: d(abs(d)<thresh)=0; C2=[a d]; plotwaveletcoeff(c2,s); % Reconstruct image: I2=waverec2(C2,S,'haar'); imshow(uint8(i2)); Now do the same steps using Daubechies 2 wavelet (use 'db2' instead of 'haar') in wavedec2 and waverec2. Which wavelets produce a better visual quality? To get some numerical evidence on your observations, compute the root mean square errors resulting from Daubechies 2 and Haar based compression (images in double type!). Attach your Matlab code as script2_7.m to the e-mail and report. Aftermath 8. How much time did you need to complete this exercise? 9. Did you experience any problems with the exercise? Was there enough help available? Should this document be more detailed?