EE 168 Handout #32 Introduction to Digital Image Processing March 7, 2012 HOMEWORK 7 SOLUTIONS

Similar documents
University of Waterloo CS240 Winter 2018 Assignment 4 Due Date: Wednesday, Mar. 14th, at 5pm

(a, b) x y r. For this problem, is a point in the - coordinate plane and is a positive number.

Lecture # 04. Image Enhancement in Spatial Domain

Statistics of Images. Ioannis Rekleitis

a Not yet implemented in current version SPARK: Research Kit Pointer Analysis Parameters Soot Pointer analysis. Objectives

Journal of World s Electrical Engineering and Technology J. World. Elect. Eng. Tech. 1(1): 12-16, 2012

Two Illuminant Estimation and User Correction Preference

Image Enhancement in the Spatial Domain. Spatial Domain

Coordinate Systems. Ioannis Rekleitis

1 N-Queen Problem as a CSP (23 points + 5 bonus)

A Novel Automatic White Balance Method For Digital Still Cameras

Topic -3 Image Enhancement

1 N-Queen Problem as a CSP (23 points + 5 bonus)

Efficient ACC using Binary Coding Stream for Color Descriptor

Gravitational Shift for Beginners

A Memory Efficient Array Architecture for Real-Time Motion Estimation

COMPARISON OF THREE COLOUR SPACES IN SKIN DETECTION. Chelsia Amy Doukim, Jamal Ahmed Dargham & Ali Chekima

Satellite Image Analysis

User Specified non-bonded potentials in gromacs

4.2. Co-terminal and Related Angles. Investigate

Controlled Information Maximization for SOM Knowledge Induced Learning

A Two-stage and Parameter-free Binarization Method for Degraded Document Images

Massachusetts Institute of Technology Department of Mechanical Engineering

Survey of Various Image Enhancement Techniques in Spatial Domain Using MATLAB

Detection and Recognition of Alert Traffic Signs

17/5/2009. Introduction

ISyE 4256 Industrial Robotic Applications

CS 450: COMPUTER GRAPHICS RASTERIZING CONICS SPRING 2016 DR. MICHAEL J. REALE

High Performance Computing on GPU for Electromagnetic Logging

t [ Background removed

Module 6 STILL IMAGE COMPRESSION STANDARDS

SORTING IN SPACE HANAN SAMET

A Mathematical Implementation of a Global Human Walking Model with Real-Time Kinematic Personification by Boulic, Thalmann and Thalmann.

Cardiac C-Arm CT. SNR Enhancement by Combining Multiple Retrospectively Motion Corrected FDK-Like Reconstructions

A ROI Focusing Mechanism for Digital Cameras

Color Correction Using 3D Multiview Geometry

A Shape-preserving Affine Takagi-Sugeno Model Based on a Piecewise Constant Nonuniform Fuzzification Transform

Directional Stiffness of Electronic Component Lead

5. Geometric Transformations and Projections

DISTRIBUTION MIXTURES

Improved Fourier-transform profilometry

BLUEPRINTS. Getting Ready. The Activity. Overview. Introducing

5 4 THE BERNOULLI EQUATION

SURVEY OF VARIOUS IMAGE ENHANCEMENT TECHNIQUES IN SPATIAL DOMAIN USING MATLAB

A Consistent, User Friendly Interface for Running a Variety of Underwater Acoustic Propagation Codes

ISSUES IN SPATIAL DATABASES AND GEOGRAPHIC INFORMATION SYSTEMS (GIS) HANAN SAMET

Keywords: multibody simulation, wheel-rail contact, real time simulations

HISTOGRAMS are an important statistic reflecting the

Approximating Euclidean Distance Transform with Simple Operations in Cellular Processor Arrays

Collaborative Filtering & Content-Based Recommending. CS 293S. T. Yang Slides based on R. Mooney at UT Austin

arxiv: v5 [cs.cv] 29 Sep 2018

Elastohydrodynamic Lubrication Analysis of Journal Bearings Using CAD

IP Network Design by Modified Branch Exchange Method

An Extension to the Local Binary Patterns for Image Retrieval

GARBAGE COLLECTION METHODS. Hanan Samet

RANDOM IRREGULAR BLOCK-HIERARCHICAL NETWORKS: ALGORITHMS FOR COMPUTATION OF MAIN PROPERTIES

Lecture 9: Other Applications of CNNs

ADDING REALISM TO SOURCE CHARACTERIZATION USING A GENETIC ALGORITHM

2. PROPELLER GEOMETRY

Frequency Domain Approach for Face Recognition Using Optical Vanderlugt Filters

Collision Detection with Swept Spheres and Ellipsoids

Illumination methods for optical wear detection

AUTOMATED LOCATION OF ICE REGIONS IN RADARSAT SAR IMAGERY

COLOR EDGE DETECTION IN RGB USING JOINTLY EUCLIDEAN DISTANCE AND VECTOR ANGLE

Pipes, connections, channels and multiplexors

Three-Dimensional Aerodynamic Design Optimization of a Turbine Blade by Using an Adjoint Method

Lecture Topics ECE 341. Lecture # 12. Control Signals. Control Signals for Datapath. Basic Processing Unit. Pipelining

SOCIAL COMPUTING: AN INTELLIGENT AND RESPONSIVE SYSTEM

Any modern computer system will incorporate (at least) two levels of storage:

XFVHDL: A Tool for the Synthesis of Fuzzy Logic Controllers

Prof. Feng Liu. Fall /17/2016

Conservation Law of Centrifugal Force and Mechanism of Energy Transfer Caused in Turbomachinery

What is a Radian? The side that remains fixed is called the initial side

CALCULUS III Surface Integrals. Paul Dawkins

Obstacle Avoidance of Autonomous Mobile Robot using Stereo Vision Sensor

Comparisons of Transient Analytical Methods for Determining Hydraulic Conductivity Using Disc Permeameters

And Ph.D. Candidate of Computer Science, University of Putra Malaysia 2 Faculty of Computer Science and Information Technology,

Conversion Functions for Symmetric Key Ciphers

Fifth Wheel Modelling and Testing

MULTI-TEMPORAL AND MULTI-SENSOR IMAGE MATCHING BASED ON LOCAL FREQUENCY INFORMATION

Extract Object Boundaries in Noisy Images using Level Set. Final Report

Experimental and numerical simulation of the flow over a spillway

On Error Estimation in Runge-Kutta Methods

IP Multicast Simulation in OPNET

Introduction To Robotics (Kinematics, Dynamics, and Design)

Adaptation of TDMA Parameters Based on Network Conditions

A Minutiae-based Fingerprint Matching Algorithm Using Phase Correlation

Towards Adaptive Information Merging Using Selected XML Fragments

3D Hand Trajectory Segmentation by Curvatures and Hand Orientation for Classification through a Probabilistic Approach

Positioning of a robot based on binocular vision for hand / foot fusion Long Han

A modal estimation based multitype sensor placement method


DYNAMIC STORAGE ALLOCATION. Hanan Samet

Drag Optimization on Rear Box of a Simplified Car Model by Robust Parameter Design

A Neural Network Model for Storing and Retrieving 2D Images of Rotated 3D Object Using Principal Components

Point-Biserial Correlation Analysis of Fuzzy Attributes

Monte Carlo Simulation for the ECAT HRRT using GATE

Reader & ReaderT Monad (11A) Young Won Lim 8/20/18

Assessment of Track Sequence Optimization based on Recorded Field Operations

E-OPTIMAL SEMI-REGULAR GRAPH DESIGNS AND PARTIALLY EFFICIENCY BALANCED DESIGNS

Transcription:

EE 168 Handout #32 Intoduction to Diital Imae Pocessin Mach 7, 2012 HOMEWORK 7 SOLUTIONS Polem 1: Colo Wheels We can epesent an N x N colo imae y a thee-dimensional aay such that the fist two dimensions ae of size N each, and the thid dimension has size 3. The fist two dimensions of the aay ae used to epesent the location of pixels, while the thid is used to stoe the ensities of the thee pimay colos (ed, een, and lue). Fo instance, usin Matla notation, we can wite: a(i, j, 1) = w 1 ; a(i, j, 2) = w 2 ; a(i, j, 3) = w 3 ; This means that the elative ensities of the ed, een, lue components in the i th ow, j th column of the imae a ae w 1, w 2 and w 3, espectively. Accodinly, fo the equal-ensity colo wheel, each cicle in the colo wheel has a weiht of 1 fo only one of the thee colos and a weiht of 0 fo the othe two. By vayin the weihts, we can modify the colo values in the wheel. In the non-ovelappin eions, the chane of weihts causes only an ensity chane, while fo the ovelappin eions, a colo chane is also oseved. These esults ae shown in Fiue 1-1. Note that the RGB colo space is not the only way to epesent colo imaes. One can, altenatively, use othe colo spaces, one of them ein the HSB space. In HSB, H epesents hue, S epesents the satuation, and B epesents the ihtness. The hue dimension povides a compaison of the thee pimay colos (ed, een, and lue) and thei weihted mixtues (usin at most two of the ed, een, o lue at a time). Note that ensities ae assumed to e equal fo all colos in the hue dimension. This is illustated in Fiue 1-2. The Colo Wheel with Equal Intensities The Colo Wheel with Lowe Red Intensity The Colo Wheel with Lowe Geen Intensity The Colo Wheel with Lowe Blue Intensity Fiue 1-1: The Colo Wheel and Weihtin Colos 1

A Hue Map 20 40 60 80 120 140 20 40 60 80 120 140 Fiue 1-2: The Hue Map Polem 2: RGB Imaes We can stetch a colo imae fo a nume of easons, one of them ein that the oveall imae contast is too low to ceate a pleasin display. The colo imae can e stetched y takin the ensity values of the imae as a efeence. The total ensity at location (n, can e computed fom the (ed), (een), and (lue) components like so: I n, m 2 n, m 2 n, m 3 2 n, m We can then stetch the individual colo ensity values of the imae to otain an imae that has a total ensity with a mean of 160 and a standad deviation of 80. We ceate this tansfomation y fist calculatin the mean and standad deviation of the oiinal imae s total ensity. Then the linea tansfomation equation fo the total ensity stetch can e applied to each of the thee colo components, esultin in a pleasin colo imae. Fiue 2-1 compaes the oiinal low-contast imae and the ensity-stetched imae. Fo this paticula imae, the oiinal imae s total ensity has a mean of 47.9 and a standad deviation of 26.3. Hence, the tansfomation equations ae: 80 160 47.9 26.3 80 160 47.9 26.3 80 160 47.9 26.3 2

The oiinal low-contast imae The total-esity stetched imae Fiue 2-1: Usin the Total Intensity to stetch Colo Imaes Polem 3: False Colo Imaes We can stetch a colo imae in two diffeent ways: i) All thee colo components can e stetched usin a common linea tansfomation equation. The common equation may e otained y applyin a stetch on the total ensity values of the imae, as done in the pevious polem. Denotin the mean and the standad deviation of the total ensity imae y m and, espectively, we can otain the colo components usin the followin colo channel tansfomations, whee m and denote the desied mean and standad deviation: m m m m m m ii) Each colo component can e indepently stetched usin a diffeent linea tansfomation equation. This method will maximize the colo space, ut will not peseve the colo alance and will not epesent the tue physical colos. The output colos will now equally eveal the details contained in each colo channel. So featues oiinally hidden in minoity colos will now e enhanced. In this case, each equation is otained y applyin a stetch only on that paticula colo ensity component. Denotin the means and standad deviations of the ed, een, and lue components of the imae as m,, m,, m,, espectively, one can otain the colo components usin the followin linea tansfomations: 3

m m m m m m The Oiinal Imae 700 800 900 0 800 0 Stetchin y a Common Tansfomation Stetchin y Indepent Tansfomations 700 700 800 800 900 900 0 800 0 0 800 0 Fiue 3-1: Convolvin two ectanles of diffeent widths in space and in special-fequency domains 4

Polem 4: Indexed Colo We can use indexin to compess colo infomation in imaes. Fo instance, if a paticula application needs colo imaes that ae shades of only lue, then all its should e used to encode only ensities of lue, and no its should e used to code the ed and een colo components. Fiue 4-1 shows a ay scale imae and its vesion in shades of lue. The fiue also displays the imae with a diffeent colo tale that exts fom lack to white thouh shades and mixtues of een and yellow. The colo map, descied in the polem, can e fomed y: - Vayin the ensity of een fom 0 to 1 as the index inceases fom 0 to, with the ensities of ed and lue held constant at 0. - Vayin the ensity of ed fom 0 to 1 as the index inceases fom to, with the ensity of een held at a constant of 1, and the ensity of lue held at 0. - Vayin the ensity of lue fom 0 to 1 as the index inceases fom to 255, with the ensities of ed and een held constant at 1. The Oiinal B/W Imae 4 5 Fiue 4-1: The Oiinal Black & White Imae The Imae in shades of Blue The Imae usin a Colo Tale Fiue 4-2: Imae Displayed usin diffeent Colo Tales 5

MATLAB code: M=256; Polem 1: Colo Wheels cicle=ones(m+1,m+1); % fom a cicle of diamete M fo i=1:(m+1) fo j=1:(m+1) if((sqt((i-((m/2)+1))^2+(j-((m/2)+1))^2))>m/2) cicle(i,j)=0; % each of the thee dimensions is fo a paticula colo component a=zeos(,,3); % loop thouh vaious weihts on the colo ensities w1 = [1 0.5 1 1]; w2 = [1 1 0.5 1]; w3 = [1 1 1 0.5]; titles = {'Equal Intensities'; 'Lowe Red Intensity'; 'Lowe Geen Intensity'; 'Lowe Blue Intensity'}; count = 1; fiue; fo ind=1:lenth(w1), fo i=1:(m+1) fo j=1:(m+1) a(i+,j+,1)=w1(ind)*cicle(i,j); a(i+,j+,2)=w2(ind)*cicle(i,j); a(i+,j+,3)=w3(ind)*cicle(i,j); suplot(2,2,count); imaesc(a); axis('imae') title(spf('the Colo Wheel with %s', cha(titles(ind)))) count = count+1; % The hue map wheel_adius = 75; fo i=-wheel_adius:wheel_adius fo j=-wheel_adius:wheel_adius [v1,v2]=cat2pol(i,j); a(i+76,j+76)=v1; %theta (i+76,j+76)=ound(v2); %adius % hue vaies with the anle of otation wheel_diam = wheel_adius*2; %= m1 = zeos(wheel_diam,wheel_dia; fo i=1:wheel_diam fo j=1:wheel_diam % nomalize theta to e etween 0 and 1 % all values on wheel with same theta ae set to the same value, theta m1(i,j)=(1/(2*pi))*(a(i,j)+pi); % convesion to the space m2 = zeos(wheel_diam,wheel_diam,3); fo i=1:wheel_diam fo j=1:wheel_diam if((i,j)<wheel_adius), %only fill in wheel cicle 6

% set satuation and ensity to 1 % flip hue ove x-axis so that ed (theta=0) is at top of wheel m2(i,j,:)=hsv2([m1(i,wheel_diam+1-j),1,1]); fiue; imaesc(m2); axis('imae'); title('a Hue Map') Polem 2: RGB Imaes nows = 435; ncols = 580; % ead the imaes f=fopen('la7po2',''); a_ed=fead(f,[ncols nows],'u8'); a_ed=a_ed'; f=fopen('la7po2',''); a_een=fead(f,[ncols nows],'u8'); a_een=a_een'; f=fopen('la7po2',''); a_lue=fead(f,[ncols nows],'u8'); a_lue=a_lue'; a_oi(:,:,1)=a_ed; a_oi(:,:,2)=a_een; a_oi(:,:,3)=a_lue; % compute imae ensity i=(((a_ed.^2)+(a_een.^2)+(a_lue.^2))/3).^.5; % compute the ensity mean and standad deviation fo the stetch mean_i=mean(mean(i)) va_i=(mean((eshape(i,ncols*nows,1)-mean_i).^2)); _i=va_i^.5 % stetch each colo component usin a common tansfomation ased on the total ensity mean_desied = 160; _desied = 80; a = zeos(nows, ncols, 3); a(:,:,1)=(_desied/_i)*(a_ed-mean_i)+mean_desied; a(:,:,2)=(_desied/_i)*(a_een-mean_i)+mean_desied; a(:,:,3)=(_desied/_i)*(a_lue-mean_i)+mean_desied; % check the ensity mean and standad deviation afte the stetch i=(((a(:,:,1).^2)+(a(:,:,2).^2)+(a(:,:,3).^2))/3).^.5; mean_i=mean(mean(i)) va_i=(mean((eshape(i,ncols*nows,1)-mean_i).^2)); _i=va_i^.5 fiue; suplot(1,2,1); imaesc(u8(a_oi)); axis('imae') title('the oiinal low-contast imae') suplot(1,2,2); imaesc(u8(a)); axis('imae') title('the total-esity stetched imae') Polem 3: False Colo Imaes % ead the imaes f=fopen('la7po3',''); 7

a_ed=fead(f,[1024 1024],'u8'); a_ed=a_ed'; f=fopen('la7po3',''); a_een=fead(f,[1024 1024],'u8'); a_een=a_een'; f=fopen('la7po3',''); a_lue=fead(f,[1024 1024],'u8'); a_lue=a_lue'; a_oi(:,:,1)=a_ed; a_oi(:,:,2)=a_een; a_oi(:,:,3)=a_lue; % compute the ensity i=(((a_ed.^2)+(a_een.^2)+(a_lue.^2))/3).^.5; % compute the ensity mean and standad deviation fo the stetch mean_i=mean(mean(i)) va_i=(mean((eshape(i,1024*1024,1)-mean_i).^2)); _i=va_i^.5; mean_desied = 160; _desied = 80; % stetch each colo component usin a common tansfomation a(:,:,1)=(_desied/_i)*(a_ed-mean_i)+mean_desied; a(:,:,2)=(_desied/_i)*(a_een-mean_i)+mean_desied; a(:,:,3)=(_desied/_i)*(a_lue-mean_i)+mean_desied; mean_ed=mean(mean(a_ed)) va_ed=(mean((eshape(a_ed,1024*1024,1)-mean_ed).^2)) _ed=va_ed^.5; mean_een=mean(mean(a_een)) va_een=(mean((eshape(a_een,1024*1024,1)-mean_een).^2)) _een=va_een^.5; mean_lue=mean(mean(a_lue)) va_lue=(mean((eshape(a_lue,1024*1024,1)-mean_lue).^2)) _lue=va_lue^.5; % stetch each colo component usin a diffeent tansfomation (:,:,1)=(_desied/_ed)*(a_ed-mean_ed)+mean_desied; (:,:,2)=(_desied/_een)*(a_een-mean_een)+mean_desied; (:,:,3)=(_desied/_lue)*(a_lue-mean_lue)+mean_desied; fiue; suplot(1,2,1); imaesc(u8(a_oi)); axis('imae') title('the Oiinal Imae') fiue; suplot(1,2,1); imaesc(u8(a)); axis('imae') title('stetchin y a Common Tansfomation') suplot(1,2,2); imaesc(u8()); axis('imae') title('stetchin y Indepent Tansfomations') Polem 4: Indexed Colo nows = 435; ncols = 580; f=fopen('la7po4data',''); im_oi=fead(f,[ncols nows],'u8'); im_oi=im_oi'; im_luish(1:nows,1:ncols,1)=zeos(nows,ncols); im_luish(1:nows,1:ncols,2)=zeos(nows,ncols); im_luish(1:nows,1:ncols,3)=im_oi/255; im_=zeos(nows,ncols,3); % fom a colo tale 8

fo i=1:nows, fo j=1:ncols, if im_oi(i,j)<= im_(i,j,2)=(1/)*im_oi(i,j); if (im_oi(i,j)>)&(im_oi(i,j)<=) im_(i,j,1)=(1/)*(im_oi(i,j)-); im_(i,j,2)=1; if (im_oi(i,j)>=) im_(i,j,1)=1; im_(i,j,2)=1; im_(i,j,3)=(1/55)*(im_oi(i,j)-); fiue; colomap(ay); imaesc(u8(im_oi)); axis('imae') title('the Oiinal B/W Imae') fiue; suplot(1,2,1); imaesc((im_luish)); axis('imae') title('the Imae in shades of Blue') suplot(1,2,2); imaesc((im_)); axis('imae') title('the Imae usin a Colo Tale'); 9