Lecture 01
Lecture 01
Image Processing (CS/ECE 545)
Lecture 1: Introduction to Image
Processing and ImageJ
Prof Emmanuel Agu
Computer Science Dept.
Worcester Polytechnic Institute (WPI)
What is an Image?
2‐dimensional matrix of Intensity (gray or color) values
Image coordinates
Set of Intensity values are integers
Example of Digital Images
a) Natural landscape
b) Synthetically generated scene
c) Poster graphic
d) Computer screenshot
e) Black and white illustration
f) Barcode
g) Fingerprint
h) X‐ray
i) Microscope slide
j) Satellite Image
k) Radar image
l) Astronomical object
Imaging System
become an approximation of a real scene
1 pixel
We will start with gray‐scale images, extend to color later
What is image Processing?
Algorithms that alter an input image to create new image
Input is image, output is image
Image Processing
Algorithm
(e.g. Sobel Filter)
Improves an image for human interpretation in ways including:
Image display and printing
Image editting
Image enhancement
Image compression
Example Operation: Noise Removal
Examples: Noise Removal
Example: Contrast Adjustment
Example: Edge Detection
Example: Region Detection,
Segmentation
Example: Image Compression
Example: Image Inpainting
Original MRI Image of a Dog Heart Edge Detection Image
Applications of Image Processing
dd
Applications of Image Processing:
Geographic Information Systems (GIS)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Terrain classification
Meteorology (weather)
Applications of Image Processing: Law
Enforcement
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Number plate recognition for speed cameras or
automated toll systems
Fingerprint recognition
Applications of Image Processing: HCI
Face recognition
Gesture recognition
Relationship with other Fields
Key Stages in Digital Image Processing
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Representation
Acquisition & Description
Object
Problem Domain
recognition
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Image Aquisition
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Representation
Acquisition & Description
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Representation
Acquisition & Description
Image Morphological
Restoration Processing
Example: Remove
Noise
Image
Segmentation
Enhancement
Image Representation
Acquisition & Description
Object
Problem Domain
recognition
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Morphological Processing
Extract
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image
Segmentation
Enhancement
Image Representation
Acquisition & Description
Object
Problem Domain
recognition
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Segmentation
Divide
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image
Segmentation
Enhancement
Image Representation
Acquisition & Description
Object
Problem Domain
recognition
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Object Recognition
Image
regions
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image
Segmentation
Enhancement
Image Representation
Acquisition & Description
Object
Problem Domain
recognition
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Representation & Description
Finds &
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image
Segmentation
Enhancement
Image Representation
Acquisition & Description
Object
Problem Domain
recognition
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Image Compression
Reduce
Image Morphological
image size
Restoration Processing (e.g. JPEG)
Image
Segmentation
Enhancement
Image Representation
Acquisition & Description
Object
Problem Domain
recognition
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Colour Image Processing
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Representation
Acquisition & Description
Object
Problem Domain
recognition
Consider color
Colour Image Image
images (color
models, etc) Processing Compression
Mathematics for Image Processing
Calculus
Linear algebra
Probability and statistics
Differential Equations (PDEs and ODEs)
Differential Geometry
Harmonic Analysis (Fourier, wavelet, etc)
About This Course
Image Processing has many aspects
Computer Scientists/Engineers develop tools (e.g. photoshop)
Requires knowledge of maths, algorithms, programming
Artists use image processing tools to modify pictures
DOES NOT require knowledge of maths, algorithms, programming
Retina covered with
light receptors called
cones (6‐7 million) and
rods (75‐150 million)
Cones concentrated
around fovea. Very
sensitive to colour
Rods more spread out
and sensitive to low illumination levels
Image Formation In The Eye
Muscles in eye can change the shape of the lens
allowing us focus on near or far objects
An image is focused onto retina exciting the rods and
cones and send signals to the brain
Image Formation
The Pinhole Camera (abstraction)
First described by ancient Chinese and Greeks (300‐400AD)
Thin Lens
Brightness Adaptation &
Discrimination
The human visual system can perceive approximately
1010 different light intensity levels
However, at any one time we can only discriminate
between a much smaller number – brightness adaptation
Similarly, perceived intensity of a region is related to the
light intensities of the regions surrounding it
Brightness Adaptation &
Discrimination: Mach Band Effect
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Perceived intensity
overshoots or undershoots
at areas of intensity change
Brightness Adaptation &
Discrimination
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
All inner squares have same intensity but appear darker as outer
square (surrounding area) gets lighter
Image Acquisition
Images typically generated by illuminatinga scene
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
and absorbing energy reflected by scene objects
Image Sensing
Incoming energy (e.g. light) lands on a sensor material
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
responsive to that type of energy, generating a voltage
Collections of sensors are arranged to capture images
Imaging Sensor
Sampling and quantization generates
approximation of a real world scene
Image as Discrete Function
Image as a Function
Representing Images
Image data structure is 2D array of pixel values
Pixel values are gray levels in range 0‐255 or RGB colors
Array values can be any data type (bit, byte, int, float,
double, etc.)
Spatial Resolution
The spatial resolutionof an image is determined by
how fine/coarse sampling was carried out
Spatial resolution: smallest discernable image detail
Vision specialists
talk about image resolution
Graphic designers
talk about dots per
inch (DPI)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Spatial Resolution
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Spatial Resolution: Stretched Images
Intensity Level Resolution
Intensity level resolution: number of intensity levels
used to represent the image
The more intensity levels used, the finer the level of detail
discernable in an image
Intensity level resolution usually given in terms of number
of bits used to store each intensity level
Number of Intensity
Number of Bits Examples
Levels
1 2 0, 1
2 4 00, 01, 10, 11
4 16 0000, 0101, 1111
8 256 00110011, 01010101
16 65,536 1010101010101010
Intensity Level Resolution
256 grey levels (8 bits per pixel) 128 grey levels (7 bpp) 64 grey levels (6 bpp) 32 grey levels (5 bpp)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
16 grey levels (4 bpp) 8 grey levels (3 bpp) 4 grey levels (2 bpp) 2 grey levels (1 bpp)
Saturation & Noise
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Example: Picture on right okay for counting number
of cars, but not for reading the number plate
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Low Detail
Medium Detail
Intensity Level Resolution
High Detail
Image File Formats
Hundreds of image file formats. Examples
Tagged Image File Format (TIFF)
Graphics Interchange Format (GIF)
Portable Network Graphics (PNG)
JPEG, BMP, Portable Bitmap Format (PBM), etc
Image pixel values can be
Grayscale: 0 – 255 range
Binary: 0 or 1
Color: RGB colors in 0‐255 range (or other color model)
Application specific (e.g. floating point values in astronomy)
How many Bits Per Image Element?
Introduction to ImageJ
ImageJ: Open source Java Image processing software
Developed by Wayne Rasband at Nat. Inst for Health (NIH)
Many image processing algorithms already implemented
New image processing algorithms can also be implemented easily
Nice click‐and‐drag interface
Plug‐in mechanism for implementing new
functionality, extending ImageJ
Macro language + interpreter: Easy to implement
large blocks from small pieces without knowing Java
ImageJ Software Architecture
ImageJ uses Java’s windowing system (AWT) for display
Programmer writes plugins to extend ImageJ
Already implemented plugins available through ImageJ’s
plugins menu
ImageJ Plugins
Plugins: Java classes that implement an interface
defined by ImageJ
Two types of plugins
Plugin: Requires no image to be open first
PlugInFilter: Passed currently open image, operates on it
We will mostly focus on PlugInFilters
Two methods defined
int setup(String arg, ImagePlus im):
Does initialization, verifies plugin capabilities matches input image
int run(ImageProcessor ip):
Does actual work. Passed image (ip), modifies it, creates new images
First ImageJ Example: Invert Image
Task: Invert 8‐bit grayscale (M x N) image
Basically, replace each image pixel with its complement
We shall call plugIn My_Inverter
Name of Java Class: My_Inverter
Name of source file: My_Inverter.java
“_” underscore makes ImageJ recognize source file as plugin
After compilation, automatically inserted into ImageJ menu
First ImageJ Example: Invert Image
Note: On startup, ImageJ loads all plugins in the <ij>plugins/
sub‐directory
ImageJ can also be used with eclipse IDE (large programs)
References
Wilhelm Burger and Mark J. Burge, Digital Image
Processing, Springer, 2008
University of Utah, CS 4640: Image Processing Basics,
Spring 2012
Gonzales and Woods, Digital Image Processing (3rd
edition), Prentice Hall
Digital Image Processing slides by Brian Mac Namee