# Texture analysis by dfhdhdhdhjr

VIEWS: 2 PAGES: 40

• pg 1
```									Image processing
and

Texture analysis
Dr. S. Selinger
Dennis Gabor College
Budapest - Hungary

Image processing
Fundamentals

Introduction

Modern digital technology has made it possible to
manipulate multi-dimensional signals with systems that
range from simple digital circuits to advanced parallel
computers.
An image defined in the "real world" is considered to
be a function of two real variables, for example, a(x,y) with
a as the amplitude (e.g. brightness) of the image at the
real coordinate position (x,y).
An image may be considered to contain sub-images
sometimes referred to as regions-of-interest, ROIs, or
simply regions.

Introduction (2)
An image is digitized to convert it to a form which
can be stored in a computer's memory or on some form
of storage media such as a hard disk or CD-ROM.

This digitization procedure can be done by a
scanner, or by a video camera connected to a frame
grabber board in a computer.

Once the image has been digitized, it can be
operated upon by various image processing operations.

Introduction (3)
We will restrict ourselves to two-dimensional (2D)
image processing although most of the concepts and
techniques that are to be described can be extended
easily to three or more dimensions.
An image defined in the "real world" is considered
to be a function of two real variables, for example,
a(x,y) with a as the amplitude (e.g. brightness) of the
image at the real coordinate position (x,y).
An image may be considered to contain sub-
images sometimes referred to as regions-of-interest,
ROI’s, or simply regions.

Introduction (4)
Image processing operations can be roughly
divided into three major categories:

   Image Compression,
   Image Enhancement
   Restoration and
   Measurement Extraction.

Introduction (5)
Image Compression involves reducing the amount
of memory needed to store a digital image.

Image defects which could be caused by the
digitization process or by faults in the imaging set-up
(for example, bad lighting) can be corrected using
Image Enhancement techniques.

Once the image is in good condition, the
Measurement Extraction operations can be used to
obtain useful information from the image.

Image Processing
image in - image out

Image Analysis
image in - measurements out

Image Understanding
image in - high-level description out

Digital Image Definitions
A digital image a[m,n] described in a 2D discrete
space is derived from an analog image a(x,y) in a 2D
continuous space through a sampling process that
is frequently referred to as digitization.

The 2D continuous image a(x,y) is divided into N rows
and M columns.

The intersection of a row and a column is
termed a pixel.
The value assigned to the integer coordinates
[m,n] with {m = 0,1,2,...,M-1} and {n = 0,1,2,...,N-1} is
a[m,n] .

Digital Image Definitions
(Common Values)
There are standard values for the various
parameters encountered in digital image processing.

Parameter Symbol             Typical values
Rows        N           256,512,525,625,1024,1035
Columns     M           256,512,768,1024,1320
Gray Levels L           2,64,256,1024,4096,16384

M = N = 2K where {K = 8,9,10}.

The number of distinct gray levels is usually a
power of 2, that is, L = 2B where B is the number of
bits in the binary representation of the brightness
levels.
Digitization of a continuous image

The image has been divided into N = 16 rows and
M = 16 columns. The value assigned to every pixel is the
average brightness in the pixel rounded to the nearest
integer value.
The process of representing the amplitude of the 2D
signal at a given coordinate as an integer value with L
different gray levels is usually referred to as amplitude
quantization or simply quantization.
Noise
Real world signals usually contain departures from
the ideal signal. Such departures are referred to as noise.
Noise arises as a result of unmodelled or
unmodellable processes going on in the production and
capture of the real signal.
Noise can generally be grouped into two classes:
- independent noise.
- noise which is dependent on the image data.

Characteristics of Image Operations
Types of operations

The types of operations to transform an input
image a[m,n] into an output image b[m,n] can be
classified into three categories:
   point: the output value at a specific coordinate is
dependent only on the input value at that same
coordinate,
   local: the output value is dependent on the input values in
the neighborhood of that same coordinate,
   global: the output value is dependent on all the values in
the input image.

Characteristics of Image Operations
Types of neighborhoods

The images can be sampled to the various
neighborhoods
   Rectangular sampling: images are sampled by
laying a rectangular grid over an image
   Hexagonal sampling:

rectangular sampling
hexagonal sampling 4-connected 8-connected 6-connected
Algorithms

Operations that are fundamental to digital              image
processing can be divided into four categories:

   operations based on the image histogram,
   on simple mathematics,
   on convolution,
   on mathematical morphology.

Tools
Certain tools are central to the processing of digital
images. These include mathematical tools such as:

       convolution,
       Fourier analysis,
       statistical descriptions and
       manipulative tools such as:
chain codes and run codes.

Histogram-based Operations
The histogram of an image represents the relative
frequency of occurrence of the various gray levels in the
image.
A black and white image is represented by a two-
dimensional array of numbers (or matrix), x(m,n), with
values ranging from 0 to 255.
A black pixel assumes the value x(m,n)=0 while a
white pixel assumes the value x(m,n)=255. All other levels
in between are assigned linearly to contrasts between the
black and white extremes.
The vertical lines in the histogram indicate how many
pixels in an image assume a particular gray level.

Histogram-based Operations (2)
In the histogram of the white and black image we see
that its pixels assume gray levels that are concentrated in
a interval

The histogram displays the overall range of the image,
allowing you to determine the distribution of light and dark
tones.
Histogram-based Operations (3)
From left to right the histogram displays the darkest to lightest
pixel values. The vertical lines each represent one of 256 possible
tones. The higher the line, the more of that particular tone exists in the
image.

Mean: the average brightness level for all image pixels.
Std Dev: (Short for Standard Deviation) this value represents the
difference in brightness of the average pixel from the Mean.
Median: the value found in the exact center of the existing tonal range.
Pixels: the total number of image pixels.
Level: the brightness value of an individual point on the Histogram,
position the cursor over it and click.
Percentile: the percentage of existing image pixels possessing a value
darker than the selected value.

Convolution
Convolution is a simple mathematical operation
which is fundamental to many common image processing
operators.

Convolution provides a way of `multiplying together'
two arrays of numbers (generally of different sizes, but of
the same dimensionality), to produce a third array of
numbers of the same dimensionality.

This can be used in image processing to implement
operators whose output pixel values are simple linear
combinations of certain input pixel values.

Convolution (2)
In an image processing context, one of the input
arrays is normally just a gray level image. The second
array is usually much smaller, and is also two dimensional
(although it may be just a single pixel thick), and is known
as the kernel.

The convolution is performed by sliding the kernel
over the image, generally starting at the top left corner, so
as to move the kernel through all the positions where the
kernel fits entirely within the boundaries of the image.

Convolution (3)
An example image and kernel that we will use to
illustrate convolution:

the value of the bottom right pixel in the output image will
be given by:

Convolution (4)
If the image has M rows and N columns, and the kernel
has m rows and n columns, then the size of the output
image will have M-m+1 rows, and N-n+1 columns.

Mathematically we can write the convolution as:

(where i runs from 1 to M-m+1 and j runs from 1 to N-n+1)

Fourier Transforms
The Fourier Transform to decompose an image into its sine and
cosine components.
The Fourier transform produces another representation of a
signal, specifically a representation as a weighted sum of complex
exponential.
Euler's formula:

The output of the transformation represents the image in the
Fourier or frequency domain, while the input image is the spatial
domain equivalent.
The Fourier Transform is used:
   image analysis,
   image filtering,
   image reconstruction and
   image compression.

Fourier Transforms (2)
Given an image a and its Fourier transform A, then the forward
transform goes from the spatial domain (either continuous or discrete)
to the frequency domain which is always continuous.

Forward -

The inverse Fourier transform goes from the frequency domain
back to the spatial domain.

Inverse -

Digital Filters
In image processing filters are mainly used to
suppress:

- high frequencies in the image
(i.e. smoothing the image)
- low frequencies
(i.e. enhancing or detecting edges in the image)

An image can be filtered either in the frequency or in
the spatial domain.

Linear Filtering
Low Pass Filters ("smoothing”):
- remove high spatial frequency noise from a digital image.

Reconstruction filtering
Enhancement filtering

Moving Window Operations
- affects one pixel of the image at a time, changing its value by
some function of a "local" region of pixels ("covered" by the
window).

Neighborhood-averaging filters
Median filters
Mode filters

Linear Filtering (2)
Neighborhood-averaging filters :
- replace the value of each pixel, a[i,j] say, by a weighted-
average of the pixels in some neighborhood around it.
(i.e.: a weighted sum of a[i+p,j+q], with p = -k to k, q = -k to k for
some positive k; the weights are non-negative with the highest weight
on the p = q = 0 term. If all the weights are equal then this is a mean
filter is "linear”)

Median filters:
- replaces each pixel value by the median of its neighbors.
(i.e. the value such that 50% of the values in the neighborhood are
above, and 50% are below. )

Mode filters:
- each pixel value is replaced by its most common neighbor. This
is a particularly useful filter for classification procedures where each
pixel corresponds to an object which must be placed into a class
Smoothing Operations

Linear Filters:
- Uniform filter
- Triangular filter
- Gaussian filter

Non-Linear Filters:
- Median filter
- Kuwahara filter

Thresholding
In many vision applications, it is useful to be able to
separate out the regions of the image corresponding to
objects in which we are interested (ROI), from the regions
of the image that correspond to background.

Thresholding often provides an easy and convenient
way to perform this segmentation on the basis of the
different intensities or colors in the foreground and
background regions of an image.

Thresholding (2)

The segmentation is determined by a single
parameter known as the intensity threshold.
In a single pass, each pixel in the image is compared
with this threshold. If the pixel's intensity is higher than the
threshold, the pixel is set to, say, white, in the output. If it
is less than the threshold, it is set to black.

Edge Detectors
Edges are places in the image with strong intensity
contrast.
Edges often occur at image locations representing
object boundaries.
Edge detection is extensively used in image
segmentation when we want to divide the image into areas
corresponding to different objects.
Edges consist of mainly high frequencies.
For the edge detection we can applying a highpass
frequency filter in the Fourier domain or convoluting the
image with an appropriate kernel in the spatial domain.

Laplacian Edge Detection
Build of morphing algorithm which operates on
features automatically extracted from target images:
View the following signal, with an edge as highlighted
below :

the gradient of this signal :

Tutorial Images
This is a demo showing different image processing techniques
ORIGINAL image
(photo "Robin Jeffers at Ton House" (1927) by Edward Weston)

Tutorial Images
SAMPLING RATE
Here is the image with every 3rd pixel sampled, and the intermediate
pixels filled in with the sampled values. Note the blocky appearance of
the new image.

Tutorial Images
QUANTIZATION
Here is the image with only 5 grayscale shades; the original has 184
Note how much detail is retained with only 5 shades!

Tutorial Images
LOW PASS FILTERING
Here is the image filtered with the following kernel:

1/9 1/9 1/9
1/9 1/9 1/9
1/9 1/9 1/9

this filter is a 3-by-3 mean filter

(notice how it smooths the texture
of the image while blurring out the edges)

Tutorial Images
LOW PASS FILTERING II
Here is the image filtered with the following 5-by-5 mean kernel:

1/25 1/25 1/25 1/25 1/25
1/25 1/25 1/25 1/25 1/25
1/25 1/25 1/25 1/25 1/25
1/25 1/25 1/25 1/25 1/25
1/25 1/25 1/25 1/25 1/25

Notice:
the difference between the images
from the two filters
Tutorial Images
EDGE DETECTION
Here is the image filtered with the following kernel:
0 -1 0
-1 4 -1
0 -1 0
This filter is a 2-dimensional Laplacian
(actually the negative of the Laplacian)

Notice:
how it brings out the edges in the image.

Tutorial Images
EDGE DETECTION II
Top right:
Here is the image filtered with the following kernel:
0 -1 0      000          0 -1 0
-1 4 -1 + 0 1 0 = -1 5 -1
0 -1 0      000          0 -1 0
This is the Laplacian filter
with the original image added back in

Notice:
how it brings out the edges in the image
while maintaining the underlying grayscale