Sei sulla pagina 1di 28

Contents

1. What is an Image sensor


2. CCD Image Sensors
3. CMOS Image Sensors
4. Main Advantages/Disadvantages
between CMOS and CCD
5. Matlab Image processing toolbox
What is an Image Sensor?
 An Image Sensor is a photosensitive
device that converts light signals into
digital signals (colours/RGB data).

 Typically, the two main types in common


use are CCD and CMOS sensors and are
mainly used in digital cameras and other
imaging devices.

 CCD stands for Charged-Coupled Device


and CMOS stands for Complementary
Metal–Oxide–Semiconductor
Uses: imaging-spectroscopy
 Image sensors are
not only limited to
digital cameras.

 Image sensors are


used in other fields
such as:
• Machine
vision/sensing
• UV Spectroscopy
• Etc.
How CCDs Record Colour
 Each CCD cell in the CCD array
produces a single value
independent of colour.

 To make colour images, CCD cells


are organized in groups of four
cells (making one pixel) and a
Bayer Filter is placed on top of
the group to allow only red light
to hit one of the four cells, blue
light to hit another and green
light to hit the remaining two.

 The reasoning behind the two


green cells is because the human
eye is more sensitive to green
light and it is more convenient to
use a 4 pixel filter than a 3 pixel
filter (harder to implement) and
can be compensated after a
image capture with something
called white balance.

 Ex. A Bayer filter applied to the


underlying CCD pixel
Dichroic Prism
Blue Imager

Green Imager
White Light

Red Imager

Filter wheel (microscopy astronomy)


CCD
 A CCD, or a Charged-Coupled Device, is a
photosensitive analog device that records light as a
small electrical charge in each of its pixels or cells.
In essence a CCD is an collection of CCD cells.

 The signal captured by the CCD requires additional


circuitry to convert the analog light data into a
readable digital signal.

 This is mainly layers of capacitors called Stages


which act as a way to transport the analog signal to
an array of flip-flops which store the data all
controlled by a clock signal.

 This is the definition of an Analog Shift Register.


CCDs

 Digital Oscilloscopes use CCDs


CMOS
 A CMOS, or Complementary Metal Oxide
Semiconductor, each pixel has
neighboring transistors which locally
perform the analog to digital conversion.
 This difference in readout has many
implications in the overall organization
and capability of the camera.
 Each one of these pixel sensors are called
an Active Pixel Sensor (APS).
CMOS Image Sensor
Pixel Amplifier Photo Sensor (b)
(a) (y) (Light-sensitive Region)
Light
Signal

ON ON Charge O
N
Pixel-select Switch (e)

Pixel Row (j)

Column Signal Wire (f)


(Micro Wire)

Column-select Switch
(g) Column Row Signal Wire (i)
Circuit (h) (Micro Wire)
ON
Output
CMOS
 The imaging logic is integrated on a CMOS
chip, where a CCD is a modular imager
that can be replaced.
 Because of this, design of a new CMOS
chip is more expensive.
 However, APSs are transistor-based,
which means that CMOS chips can be
cheaply manufactured on any standard
silicon production line.
Pros and Cons
 CCD  CMOS
 Capacitor->charge  Transistor->voltage

 High sensitivity dynamic  Active pixel (independent)


range of lighting  Lower complexity on the
 Less noise due to less on- sensor leading to faster
chip circuitry image capture
 Uniform  Antiblooming (pixel can
saturate->multi exposure)

 Needs extra circuitry to  On-chip analog-to-digital


convert to digital signal conversion
 Reduced power
consumption
What is the Image Processing Toolbox?

• The Image Processing Toolbox is a collection of


functions that extend the capabilities of the MATLAB’s
numeric computing environment. The toolbox supports a
wide range of image processing operations, including:
– Geometric operations
– Neighborhood and block operations
– Linear filtering and filter design
– Transforms
– Image analysis and enhancement
– Binary image operations
– Region of interest operations
Images in MATLAB
• MATLAB can import/export • Data types in MATLAB
several image formats: – Double (64-bit double-precision
– BMP (Microsoft Windows Bitmap) floating point)
– GIF (Graphics Interchange Files) – Single (32-bit single-precision
floating point)
– HDF (Hierarchical Data Format)
– Int32 (32-bit signed integer)
– JPEG (Joint Photographic
Experts Group) – Int16 (16-bit signed integer)
– PCX (Paintbrush) – Int8 (8-bit signed integer)
– PNG (Portable Network – Uint32 (32-bit unsigned integer)
Graphics) – Uint16 (16-bit unsigned integer)
– TIFF (Tagged Image File Format) – Uint8 (8-bit unsigned integer)
– XWD (X Window Dump)
– raw-data and other types of
image data
Images in MATLAB
• Binary images : {0,1}
• Intensity images : [0,1] or uint8, double etc.
• RGB images : m × n × 3
• Multidimensional images: m × n × p (p is the number of layers)
Image Import and Export
• Read and write images in Matlab
img = imread('apple.jpg');
dim = size(img);
figure;
imshow(img);
imwrite(img, 'output.bmp', 'bmp');

• Alternatives to imshow
imagesc(I)
imtool(I)
image(I)
Images and Matrices
[0, 0]
How to build a matrix
(or image)? o
Intensity Image:

Row 1 to 256
row = 256;
col = 256;
img = zeros(row, col);
img(100:105, :) = 0.5;
img(:, 100:105) = 1;
figure;
o
imshow(img);
Column 1 to 256
[256, 256]
Matlab Image Display
 image - create and display image
object
 imagesc - scale and display as image

 imshow - display image

 colorbar - display colorbar

 getimage- get image data from axes

 truesize - adjust display size of


image
Image Display
 image - create and display image object
 imagesc - scale and display as image
 imshow - display image
 colorbar - display colorbar
 getimage- get image data from axes
 truesize - adjust display size of image
 zoom - zoom in and zoom out of 2D plot
Image Conversion
 gray2ind - intensity image to index image
 im2bw - image to binary
 im2double - image to double precision
 im2uint8 - image to 8-bit unsigned integers
 im2uint16 - image to 16-bit unsigned integers
 ind2gray - indexed image to intensity image
 mat2gray - matrix to intensity image
 rgb2gray - RGB image to grayscale
 rgb2ind - RGB image to indexed image
Geometric Operations
Image resizing: imresize(I,[x y],’method’).
Method is bilinear, bicubic or nearest
neighbours.
Image rotation: imrotate(I,angle,’method’)
method is same as before. Zero padding
in the rotated image.
Image cropping: J=imcrop;
Neighbourhood
Processing
 To speed up neighbourhood processing transform every
neighbourhood to column vector and perform vector
operations.

 The borders are usually padded with zeros for the


computations of the edges neighborhoods.
 Linear filtering can be done with convolution
- conv2(Img, h) or correlation
- filter2(Img, h).
 Nonlinear filtering: nlfilter(I,[sx sy],’func’) where func is a
function that receives the windows and returns scalars.

23
Transforms
 Fourier and inverse Fourier transform:

F=fftshift(fft2(f)); F is a complex matrix


Freal=real(F);Fimag=imag(F);Fabs=abs(F);Fphs=angle(F);
imshow(Freal)
f=ifft2(F);

 DCT and compression


I=imread(‘cameraman.tif’);
I=im2double(I);
T=dctmtx(8);
B=blkproc(I,[8 8], ‘P1*x*P2’,T,T’);
mask=[1 1 1 0 0 …];
B2=blkproc(B,[8 8],’P1*x’,mask);
I2=blkproc(B2,[8 8],’P1*x*P2,T’,T);
It is also possible to use dct2 and idct2.
24
Analyzing and Enhancing
Images
pixval returns the value of a pointed pixel and the distance
between two pointed pixels.

impixel returns the data value for a selected set of pixels. The
set can be pointed by the mouse or by coordinates.

imcontour plots the contours of the image.

imhist(I,n) plots the histogram of I with n bins.

25
 Edge detection:
edge(I,’sobel’);
edge(I,’canny’);
Or by fspecial(‘sobel’) and conv2.
 Image Enhancement:

Histogram stretching:
imadjust(I,[low high],[bottom top]);
Gamma correction:
imadjust(I,[],[],gamma_coef);
Histogram Equalization
histeq(I)

26
Noise removal
To add noise to an image:

imnoise(I,’type’,coef); type can be ‘salt n pepper’,


‘speckle’, ‘gaussian’ for S&P, multiplicative and
additive noise.

Averaging or gaussian filtering:


F=filter2(fspecial(‘average’,3),J);

Median filtering:
F=medfilt(J,[3 3]);

27
Morphological Operations

 Dilation : imdilate()
 Erosion: imerode()

 Closing: imclose()

 Opening: imopen()

28

Potrebbero piacerti anche