Top Banner
EECS490: Digital Image Processing Lecture #2 Image acquisition Images in the spatial domain Digital representation – Sampling – Quantization Spatial resolution Gray scale resolution – Resampling MATLAB ® image processing Reading and writing images – MATLAB ® classes: uint8 and double Adding and multiplying images
47

Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

Mar 17, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Lecture #2

• Image acquisition

• Images in the spatial domain– Digital representation

– Sampling

– Quantization

– Spatial resolution

– Gray scale resolution

– Resampling

• MATLAB® image processing– Reading and writing images

– MATLAB® classes: uint8 and double

– Adding and multiplying images

Page 2: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Image acquisition

• vidicons and other “tube”sensors

• CCD arrays

• CID arrays

• photodiode arrays

• specialized sensors, i.e., infrared,

document scanning

Page 3: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Chapter 2: Digital Image Fundamentals

We usually idealize sensors assquare but, in reality, they are notand manufacturers data needs to bechecked for critical applications.

© 2002 R. C. Gonzalez & R. E. Woods

Page 4: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Chapter 2: Digital Image Fundamentals

© 2002 R. C. Gonzalez & R. E. Woods

Page 5: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Chapter 2: Digital Image Fundamentals

© 2002 R. C. Gonzalez & R. E. Woods

Page 6: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Solid-State Image Sensors

Solid-state sensors require wiring(interconnects) to read out imagedata. The arrangement of thesensors and the manner and order inwhich they are read out can varyconsiderably among differentsensors.

Page 7: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Digitial arrays come in manyarrangements and sizes

You can get imaging sensors in many sizesand shapes for specializedapplications.

Page 8: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Comparing CCD and CID image sensors

• They are sensitive over a wide spectral range, from 450 to 1,600nanometers (corresponding to the range from blue light throughthe visible spectrum to the near infrared region)

• They operate on low voltages and consume only a small amountof power.

• They do not exhibit lag or memory, so that the traces of movingobjects are not smeared.

• They are not damaged by intense light. Present devices willoversaturate and “bloom” under intense light but are notpermanently damaged (as a vidicon tube might be, forexample).

• Their positioning accuracy and therefore measurement accuracyare very good because of the accurate photolithography processused to form them.

Page 9: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Camera/image sensor

Page 10: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Analog RS-170 video signals

Page 11: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Film

• Once dominating image recording,

digital techniques have replaced film for

most applications

Page 12: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Images in the spatial domain

Page 13: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Digital Image

a grid of squares,

each of which

contains a single

color

each square is

called a pixel (for

picture element)

Color images have 3 values per pixel; monochrome images

have 1 value per pixel.

1999-2007 by Richard Alan Peters II

Page 14: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

• A digital image, I, is a mapping from a 2D gridof uniformly spaced discrete points, {p = (r,c)},into a set of positive integer values, {I( p)}, or aset of vector values, e.g., {[R G B]T(p)}.

• At each column location in each row of I thereis a value.

• The pair ( p, I( p) ) is called a “pixel” (forpicture element).

1999-2007 by Richard Alan Peters II

Pixels

Page 15: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

• p = (r,c) is the pixel location indexed byrow, r, and column, c.

• I( p) = I(r,c) is the value of the pixel atlocation p.

• If I( p) is a single number then I ismonochrome.

• If I( p) is a vector (ordered list ofnumbers) then I has multiple bands (e.g.,a color image).

1999-2007 by Richard Alan Peters II

Digital Image

Page 16: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Pixel Location: p = (r , c)

Pixel Value: I(p) = I(r , c) Pixel : [ p, I(p)]

1999-2007 by Richard Alan Peters II

Pixels

Page 17: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

==

61

43

12

blue

green

red

)( pI

( )

( )

( )277,272

col,row

,

=

=

=

##

crp

Pixel : [ p, I(p)]

1999-2007 by Richard Alan Peters II

Digital Image

Page 18: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

sampledreal image quantized sampled &

quantized

1999-2007 by Richard Alan Peters II

Sampling & Quantization

p, space I(p), space

Page 19: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

sampledreal image quantized sampled &

quantized

pixel gridcolumn index

row

ind

ex

1999-2007 by Richard Alan Peters II

Sampling & Quantization

Page 20: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

),( crIS

( ),C

I

continuous image sampled image

1999-2007 by Richard Alan Peters II

Sampling

Page 21: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

),( crIS

( ),C

I

continuous image sampled image

1999-2007 by Richard Alan Peters II

SamplingTake the averagewithin each squareis the most commonmethod of sampling.

Page 22: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

),( crIS

( ),C

I

continuous image sampled image

A common assumption is that is the same for r and c. This is notalways true.

1999-2007 by Richard Alan Peters II

Sampling

Page 23: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Spatial Resolution

1024x1024

N=512

N=16

16x16

Page 24: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Gray Scale Resolution

N=256

N=2

Page 25: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Gray Scale Resolution

m=1 bit

m=8 bits

Page 26: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Subsampling

Page 27: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Resampling

Page 28: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Subsampling128x128 64x64 32x32

Nearest

neighbor

Bilinear

interpolation

1024x1024

1024x1024

Page 29: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

8 16

nearest neighbor nearest neighbor

bicubic interpolation bicubic interpolation

(resizing)

1999-2007 by Richard Alan Peters II

Resampling

Page 30: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

MATLAB® Image Types

indexed

intensity

RGBbinary

General matrix

rgb2ind

rgb2gray

mat2gray

ind2graygray2ind

ind2rgb

bw2ind

im2bw

im2bw

im2bw

Page 31: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Read a Truecolor Image into Matlab

A true color image does not use acolormap like an indexed colorimage; instead, the color values foreach pixel are stored directly asRGB triplets. In MATLAB , theCData property of a truecolor imageobject is a three-dimensional (m-by-n-by-3) array. This array consists ofthree m-by-n matrices(representing the red, green, andblue color planes) concatenatedalong the third dimension.

1999-2007 by Richard Alan Peters II

Page 32: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

1999-2007 by Richard Alan Peters II

Read a Truecolor Image into Matlab

Page 33: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

1999-2007 by Richard Alan Peters II

Read a Truecolor Image into Matlab

Page 34: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Mark Frauenfelder

Cory DoctorowDavid Pescovitz

John Battelle Xeni Jardin

http://boingboing.net/

1999-2007 by Richard Alan Peters II

Read a Truecolor Image into Matlab

Page 35: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Crop the Image

First, select aregion usingthe magnifier.

left click here and hold

drag to here and release

Cut out a region

from the image

1999-2007 by Richard Alan Peters II

Read a Truecolor Image into Matlab

Page 36: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Crop the Image

From this close-upwe can estimatethe coordinates ofthe region:

rows: about 125 to 425cols: about 700 to 1050

1999-2007 by Richard Alan Peters II

Read a Truecolor Image into Matlab

Page 37: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Crop the Image

Here it is:

Now close theother image

1999-2007 by Richard Alan Peters II

Read a Truecolor Image into Matlab

Page 38: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Crop the Image

Bring it to thefront using thefigure command,

1999-2007 by Richard Alan Peters II

Read a Truecolor Image into Matlab

Page 39: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

then type ‘close’at the prompt.

1999-2007 by Richard Alan Peters II

Crop the image

Page 40: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Jim Woodring - Bumperillo

Mark Rayden – The Ecstasy of Cecelia

Rayden Woodring – The Ecstasy of Bumperillo (?)

1999-2007 by Richard Alan Peters II

Double exposure: adding two images

Page 41: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

>> cd 'D:\Classes\EECE253\Fall 2006\Graphics\matlab intro'

>> JW = imread('Jim Woodring - Bumperillo.jpg','jpg');>> figure

>> image(JW)

>> truesize

>> title('Bumperillo')

>> xlabel('Jim Woodring')

>> MR = imread('Mark Ryden - The Ecstasy of Cecelia.jpg','jpg');

>> figure

>> image(MR)

>> truesize>> title('The Ecstasy of Cecelia')

>> xlabel('Mark Ryden')

>> [RMR,CMR,DMR] = size(MR);

>> [RJW,CJW,DJW] = size(JW);

>> rb = round((RJW-RMR)/2);

>> cb = round((CJW-CMR)/2);

>> JWplusMR = uint8((double(JW(rb:(rb+RMR-1),cb:(cb+CMR-1),:))+double(MR))/2);

>> figure

>> image(JWplusMR)

>> truesize>> title('The Ecstasy of Bumperillo')

>> xlabel('Jim Woodring + Mark Ryden')

ExampleMatlab Code

1999-2007 by Richard Alan Peters II

Double exposure: adding two images

Page 42: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

>> cd 'D:\Classes\EECE253\Fall 2006\Graphics\matlab intro'

>> JW = imread('Jim Woodring - Bumperillo.jpg','jpg');>> figure

>> image(JW)

>> truesize

>> title('Bumperillo')

>> xlabel('Jim Woodring')

>> MR = imread('Mark Ryden - The Ecstasy of Cecelia.jpg','jpg');

>> figure

>> image(MR)

>> truesize>> title('The Ecstasy of Cecelia')

>> xlabel('Mark Ryden')

>> [RMR,CMR,DMR] = size(MR);

>> [RJW,CJW,DJW] = size(JW);

>> rb = round((RJW-RMR)/2);

>> cb = round((CJW-CMR)/2);

>> JWplusMR = uint8((double(JW(rb:(rb+RMR-1),cb:(cb+CMR-1),:))+double(MR))/2);

>> figure

>> image(JWplusMR)

>> truesize>> title('The Ecstasy of Bumperillo')

>> xlabel('Jim Woodring + Mark Ryden')

ExampleMatlab Code

Cut a section out of the middle of the largerimage the same size as the smaller image.

1999-2007 by Richard Alan Peters II

Double exposure: adding two images

Page 43: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

>> cd 'D:\Classes\EECE253\Fall 2006\Graphics\matlab intro'

>> JW = imread('Jim Woodring - Bumperillo.jpg','jpg');>> figure

>> image(JW)

>> truesize

>> title('Bumperillo')

>> xlabel('Jim Woodring')

>> MR = imread('Mark Ryden - The Ecstasy of Cecelia.jpg','jpg');

>> figure

>> image(MR)

>> truesize>> title('The Ecstasy of Cecelia')

>> xlabel('Mark Ryden')

>> [RMR,CMR,DMR] = size(MR);

>> [RJW,CJW,DJW] = size(JW);

>> rb = round((RJW-RMR)/2);

>> cb = round((CJW-CMR)/2);

>> JWplusMR = uint8((double(JW(rb:(rb+RMR-1),cb:(cb+CMR-1),:))+double(MR))/2);

>> figure

>> image(JWplusMR)

>> truesize>> title('The Ecstasy of Bumperillo')

>> xlabel('Jim Woodring + Mark Ryden')

ExampleMatlab Code

Note that the images are averaged, pixel-wise.

1999-2007 by Richard Alan Peters II

Double exposure: adding two images

Page 44: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

>> cd 'D:\Classes\EECE253\Fall 2006\Graphics\matlab intro'

>> JW = imread('Jim Woodring - Bumperillo.jpg','jpg');>> figure

>> image(JW)

>> truesize

>> title('Bumperillo')

>> xlabel('Jim Woodring')

>> MR = imread('Mark Ryden - The Ecstasy of Cecelia.jpg','jpg');

>> figure

>> image(MR)

>> truesize>> title('The Ecstasy of Cecelia')

>> xlabel('Mark Ryden')

>> [RMR,CMR,DMR] = size(MR);

>> [RJW,CJW,DJW] = size(JW);

>> rb = round((RJW-RMR)/2);

>> cb = round((CJW-CMR)/2);

>> JWplusMR = uint8((double(JW(rb:(rb+RMR-1),cb:(cb+CMR-1),:))+double(MR))/2);

>> figure

>> image(JWplusMR)

>> truesize>> title('The Ecstasy of Bumperillo')

>> xlabel('Jim Woodring + Mark Ryden')

ExampleMatlab Code

Note the data classconversions.

Normalize

1999-2007 by Richard Alan Peters II

Double exposure: adding two images

Page 45: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

Jim Woodring - Bumperillo

Mark Rayden – The Ecstasy of Cecelia

Rayden Woodring – Bumperillo Ecstasy (?)

1999-2007 by Richard Alan Peters II

Intensity Masking: Multiplying Two Images

Page 46: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

>> JW = imread('Jim Woodring - Bumperillo.jpg','jpg');

>> MR = imread('Mark Ryden - The Ecstasy of Cecelia.jpg','jpg');

>> [RMR,CMR,DMR] = size(MR);>> [RJW,CJW,DJW] = size(JW);

>> rb = round((RJW-RMR)/2);

>> cb = round((CJW-CMR)/2);

>> JWplusMR = uint8((double(JW(rb:(rb+RMR-1),cb:(cb+CMR-1),:))+double(MR))/2);

>> figure

>> image(JWplusMR)

>> truesize

>> title('The Extacsy of Bumperillo')

>> xlabel('Jim Woodring + Mark Ryden')>> JWtimesMR = double(JW(rb:(rb+RMR-1),cb:(cb+CMR-1),:)).*double(MR);

>> M = max(JWtimesMR(:));

>> m = min(JWtimesMR(:));

>> JWtimesMR = uint8(255*(double(JWtimesMR)-m)/(M-m));

>> figure

>> image(JWtimesMR)

>> truesize

>> title('EcstasyBumperillo')

ExampleMatlab Code

1. Normalize to 12. Real number

3. Real number4. Back to integer

1999-2007 by Richard Alan Peters II

Intensity Masking: Multiplying Two Images

Page 47: Lecture #2 - Case Western Reserve Universityengr.case.edu/merat_francis/eecs490f07/Lectures/Lecture2.pdf · 2012-02-16 · EECS490: Digital Image Processing Comparing CCD and CID

EECS490: Digital Image Processing

>> JW = imread('Jim Woodring - Bumperillo.jpg','jpg');

>> MR = imread('Mark Ryden - The Ecstasy of Cecelia.jpg','jpg');

>> [RMR,CMR,DMR] = size(MR);>> [RJW,CJW,DJW] = size(JW);

>> rb = round((RJW-RMR)/2);

>> cb = round((CJW-CMR)/2);

>> JWplusMR = uint8((double(JW(rb:(rb+RMR-1),cb:(cb+CMR-1),:))+double(MR))/2);

>> figure

>> image(JWplusMR)

>> truesize

>> title('The Extacsy of Bumperillo')

>> xlabel('Jim Woodring + Mark Ryden')>> JWtimesMR = double(JW(rb:(rb+RMR-1),cb:(cb+CMR-1),:)).*double(MR);

>> M = max(JWtimesMR(:));

>> m = min(JWtimesMR(:));

>> JWtimesMR = uint8(255*(double(JWtimesMR)-m)/(M-m));

>> figure

>> image(JWtimesMR)

>> truesize

>> title('EcstasyBumperillo')

ExampleMatlab Code

Note that the images are multiplied, pixelwise.

Note how the image intensities arescaled back into the range 0-255.

1999-2007 by Richard Alan Peters II

Intensity Masking: Multiplying Two Images