26.09.2015 Views

Digital Image Processing

Digital Image Processing - ISCAS 2007

Digital Image Processing - ISCAS 2007

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Digital</strong> <strong>Image</strong> <strong>Processing</strong>


<strong>Digital</strong> <strong>Image</strong><br />

For every point in a 2D region,<br />

the image has a pixel value.<br />

Pixel value is an integer<br />

between 0 and 255<br />

Pixel value is a triplet of<br />

integers, each of which is<br />

between 0 and 255


<strong>Digital</strong> <strong>Image</strong><br />

• <strong>Image</strong><br />

– An image is a two-dimensional signal<br />

<strong>Digital</strong> images<br />

f<br />

:{0,1,<br />

,3007}<br />

{0,1,<br />

,2047}<br />

{0,1,<br />

,255}<br />

f<br />

:{0,1,<br />

,3007}<br />

{0,1,<br />

,2047}<br />

{0,1,<br />

,255}<br />

3


<strong>Digital</strong> <strong>Image</strong><br />

f<br />

:{0,1,<br />

,3007}<br />

{0,1,<br />

,2047}<br />

{0,1,<br />

,255}<br />

Domain of the image;<br />

also called the support<br />

Range of the<br />

image<br />

For every point in the domain, the image f assigns a<br />

value from the range<br />

When both the domain and the range are integer<br />

values, f is a digital image


<strong>Digital</strong> <strong>Image</strong><br />

The set of all possible pixel<br />

values is the range of the<br />

image<br />

Range =<br />

{ 0,1, ,255}<br />

Range =<br />

{ 0,1, ,255}<br />

3


<strong>Digital</strong> <strong>Image</strong><br />

The set of all possible pixel<br />

values is the range of the<br />

image<br />

{ 0,1, ,255}<br />

Can be represented by an 8-bit number; the<br />

image is therefore referred to as an 8-bit<br />

image; the bit-depth of the image is 8.


<strong>Digital</strong> <strong>Image</strong><br />

The set of all possible pixel<br />

values is the range of the<br />

image<br />

{ 0,1, ,255}<br />

3<br />

Can be represented by three 8-bit numbers; the<br />

image is therefore referred to as a 24-bit color<br />

image; the bit-depth of the image is 24.


<strong>Digital</strong> <strong>Image</strong>s: 90 years ago<br />

Range has 5 values!<br />

15-tone


<strong>Digital</strong> <strong>Image</strong>s<br />

Not all images are recorded in the visible range


X-ray Imaging


Visible Range


Visible Range<br />

In the visible<br />

range does<br />

not mean<br />

visible to the<br />

naked eye


Visible Range


Lafayette, Louisiana; August 1992


Imaging Process


<strong>Digital</strong> Camera<br />

• Sensor size<br />

15.6mm by 23.6mm<br />

• resolution<br />

49283264 pixels<br />

• each pixel can see only one<br />

color<br />

Bayer<br />

matrix


Imaging Process<br />

<strong>Digital</strong> <strong>Image</strong>


Imaging Process: Color <strong>Image</strong><br />

A block of pixels; each<br />

has 1 (of 3) colors<br />

Demosaicking<br />

A block of<br />

color pixels<br />

Bayer filter<br />

The red and blue<br />

components of this<br />

pixel are estimated<br />

from the neighbors


Imaging Process


Imaging Process<br />

Sampling and Quantization


Pixel Size<br />

Also called “pixel pitch”<br />

Pixel width and height are not always<br />

the same; ie the pixel is not always<br />

square<br />

EXAMPLE<br />

sensor size<br />

15.6mm by 23.6mm<br />

resolution<br />

49283264 pixels<br />

Pixel width = 23.6/4928mm = 4.79μm<br />

Pixel height = 15.6/3264mm = 4.78μm


Imaging Process<br />

Sampling and Quantization<br />

Sampling is rounding<br />

off in the spatial<br />

domain of the image<br />

Quantization is<br />

rounding off in the<br />

range of the image<br />

Is a sensor with higher spatial resolution always better?


<strong>Digital</strong> <strong>Image</strong>s<br />

A digital image is a two-dimensional signal with a countable<br />

domain and a countable range<br />

f<br />

:{0,1,...,59}<br />

{0,1,...,59}<br />

{0,1,...,255}


<strong>Digital</strong> <strong>Image</strong>s<br />

A digital image is a two-dimensional signal with a countable<br />

domain and a countable range<br />

In other words, we work with integers (with no<br />

units), not with volts, microns, etc.<br />

Example<br />

f :{0,1,...,59}<br />

{0,1,...,59}<br />

{0,1,...,255}<br />

f (5,8) = 151<br />

By convention, (row, column)


<strong>Image</strong> Representation


<strong>Digital</strong> <strong>Image</strong><br />

“m” indexes row;<br />

“n” indexes column<br />

Origin;<br />

row=0, column=0


<strong>Digital</strong> <strong>Image</strong> <strong>Processing</strong><br />

• <strong>Digital</strong> <strong>Image</strong><br />

f<br />

0,1,<br />

,639<br />

0,1,<br />

,479<br />

012<br />

, , , 255<br />

: ,<br />

Which of these pictures does the above expression<br />

refer to?


<strong>Image</strong> Size<br />

• How big is an image?<br />

• Number of pixels =<br />

M N<br />

• Number of gray levels =<br />

2<br />

L<br />

Is a higher spatial<br />

resolution sensor always<br />

better?<br />

• Total number of bits =<br />

M<br />

<br />

N<br />

<br />

L<br />

Color image<br />

Number of color channels = 3<br />

Total number of bits =<br />

3M<br />

<br />

N<br />

<br />

L


<strong>Digital</strong> <strong>Image</strong> <strong>Processing</strong><br />

• <strong>Digital</strong> <strong>Image</strong><br />

f<br />

:{0,1,...,639}<br />

{0,1,...,479}<br />

{0,<br />

1<br />

255<br />

,<br />

2<br />

...,1}<br />

255<br />

How many bits does it<br />

take to represent the<br />

range of this image?<br />

Sometimes the domain and the range values are not<br />

always integers; as long as they are countable, we<br />

consider it a digital image.


Spatial Resolution


Spatial Resolution


Spatial Resolution


Changing the Domain<br />

• When the scale or resolution of an image is changed,<br />

we are forming a new image with a different domain<br />

set<br />

• Related problems<br />

– Interpolation<br />

– Scale change<br />

– Rotation


Pixel Depth Resolution


Pixel Depth Resolution


Changing the Range<br />

• When we change the number of gray levels or the<br />

number of colors, we are forming a new image with<br />

a new range set<br />

• Related problems<br />

– <strong>Image</strong> quantization<br />

– Halftoning<br />

– Tone-mapping<br />

Mapping the number of<br />

}<br />

levels of intensities to the<br />

capability of the image<br />

display device


Pixel Depth Resolution<br />

• How many levels of<br />

gray level can we<br />

see?<br />

256 gray levels


Pixel Depth Resolution<br />

• Clearing (or setting) the least significant bit of each<br />

pixel amounts to halving the number of levels


Pixel Depth Resolution<br />

65


Pixel Depth Resolution<br />

33


Pixel Depth Resolution<br />

17


Pixel Depth Resolution<br />

9


Pixel Depth Resolution<br />

5


Pixel Depth Resolution<br />

2


<strong>Image</strong> <strong>Processing</strong> Programming


<strong>Image</strong> <strong>Processing</strong> Programming<br />

• <strong>Image</strong> data stored as an array of bytes<br />

Range =<br />

{ 0,1, ,255}<br />

unsigned char gbuffer[HEIGHT][WIDTH];


<strong>Image</strong> <strong>Processing</strong> Programming<br />

• <strong>Image</strong> data stored as arrays of bytes<br />

Range =<br />

{ 0,1, ,255}<br />

3<br />

unsigned char cbuffer[3][HEIGHT][WIDTH];<br />

unsigned char cbuffer[HEIGHT][WIDTH][3];


<strong>Image</strong> Storage<br />

unsigned char cbuffer[3][HEIGHT][WIDTH];<br />

Conceptually:<br />

3 consecutive<br />

planes


<strong>Image</strong> Storage<br />

unsigned char cbuffer[HEIGHT][WIDTH][3];<br />

Conceptually: 3 values<br />

for each pixel location;<br />

also known as<br />

interlaced<br />

Values for one pixel


<strong>Image</strong> <strong>Processing</strong> Programming<br />

• Simple code fragments<br />

(++‏i for (i=0; i


<strong>Image</strong> <strong>Processing</strong> Programming<br />

• Unless the method is very simple, avoid working in<br />

“unsigned char” since it is easy to overflow or<br />

underflow<br />

• Convert to integer or float first, then do the<br />

computation, then convert back to unsigned<br />

char for display<br />

– Scale<br />

– Clip


<strong>Image</strong> <strong>Processing</strong> Programming<br />

• Input/Output<br />

• <strong>Image</strong> data stored in binary format, usually one row<br />

at a time<br />

– Top to bottom: most formats<br />

– Bottom to top: Microsoft’s BMP format<br />

• The program needs to know the dimensions of an<br />

image, among other information


ead/fread<br />

• read(0, buffer, 640*480);<br />

• fread(buffer, 640*480, 1, fp);


<strong>Image</strong> File Formats<br />

• Many file formats<br />

– Jpg, gif, tiff, bmp<br />

– Jbig, png, rast, rle<br />

• Many formats compress the image data


<strong>Image</strong> File Formats<br />

• Have an environment that opens file for the<br />

programmer<br />

– Matlab<br />

– Photoshop<br />

– libnetpbm

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!