Vous êtes sur la page 1sur 8

CHAPTER 4

INTRODUCTION TO IMAGE PROCESSING

4.1 INTRODUCTION TO MATLAB:


MATLAB is a high-performance tool for technical computing. It integrates computation,
visualization, and programming in an easy-to-use environment that the problems and solutions
are expressed in familiar mathematical notation. The typical uses are:
(1) Math and computation
(2) Algorithm development
(3) Data acquisition
(4) Modelling, simulation, and prototyping
(5) Data analysis, exploration, and visualization
(6) Scientific and engineering graphics
(7) Application development, including graphical user interface building
It is an interactive system that the basic data element is an array that does not require
dimensioning. This allows solving many technical computing problems, especially with matrix
and vector formulations, in a fraction of the time it would take to write a program in a scalar non
interactive language such as C or FORTRAN.
The features a family of add-on application-specific solutions called toolboxes. Very important
to most users of the tool, toolboxes allow learning and applying specialized technology.
Toolboxes are comprehensive collections of the tool functions that extend its environment to
solve particular classes of problems. The system consists of five main parts, development
environment, Mathematical Function Library, Language, Graphics, and the Application Program
Interface (API).Development Environment is the set of tools and facilities that helps to use
functions and files. Many of these tools are graphical user interfaces. It includes the tool desktop
and Command Window, a command history, an editor and debugger, and browsers for viewing
help, the workspace, files, and the search path. The Mathematical Function Library of the tool is
a vast collection of computational algorithms ranging from elementary functions, like sum, sine,
cosine, and complex arithmetic, to more sophisticated functions like matrix inverse, matrix Eigen
values, Bessel functions, and fast Fourier transforms. The Language is a high-level matrix/array
language with control flow statements, functions, data structures, input/output, and object-
oriented programming features. It allows both programming in the small to rapidly create quick
and dirty throw-away programs and programming in the large to create large and complex
application programs. Graphics has extensive facilities for displaying vectors and matrices as
graphs, as well as annotating and printing these graphs. It includes high-level functions for two-
dimensional and three-dimensional data visualization, image processing, animation, and
presentation graphics. It also includes low-level functions that allow to fully customize the
appearance of graphics as well as to build complete graphical user interfaces on applications.
The Application Program Interface API is a library that allows writing C and FORTRAN
programs that interact with the tool. It includes facilities for calling routines from the tool,
calling it as a computational engine and for reading and writing MAT-files.

4.2 INTRODUCTION TO IMAGE PROCESSING:


Image processing involves changing the nature of an image in order to either (i) improve its
pictorial information for human interpretation, (ii) render it more suitable for autonomous
machine perception. We shall be concerned with digital image processing, which involves using
a computer to change the nature of a digital image (see below). It is necessary to realize that
these two aspects represent two separate but equally important aspects of image processing. A
procedure which satisfies condition (1)a procedure which makes an image look bettermay
be the very worst procedure for satisfying condition (2). Humans like their images to be sharp,
clear and detailed; machines prefer their images to be simple and uncluttered. Examples of (1)
may include: Enhancing the edges of an image to make it appear sharper; an example is shown in
figure 4.1. Note how the second image appears cleaner; it is a more pleasant image.
Sharpening edges is a vital component of printing: in order for an image to appear at its best on
the printed page; some sharpening is usually performed.

Removing noise from an image; noise being random errors in the image. Noise is a very
common problem in data transmission: all sorts of electronic components may affect data
passing through them, and the results may be undesirable. Removing motion blur from an image.
Motion blur may occur when the shutter speed of the camera is too long for the speed of the
object. So to counter this unwanted effect image processing is used.
Examples of (2) may includes Obtaining the edges of an image. This may be necessary for the
measurement of objects in an image; an example is shown in figures 4.2. Once we have the
edges we can measure their spread, and the area contained within them. We can also use edge
detection algorithms as a first step in edge enhancement, as we saw above.

(a) The original image (b) Its edge image Figure

Fig. 4.2 Finding Edges in an Image [3]

From the edge result, we see that it may be necessary to enhance the original image slightly, to
make the edges clearer. MATLAB provides special Image Processing Toolbox for image
processing purpose. It assists the user with built in commands which simplify the work of
programmer. Also it has Image Acquisition toolbox for the hardware device connectivity. The
basic information about the image processing in MATLAB is give below:
An image may be defined as a two dimensional function, f(x, y), where x and y are spatial
(plane) coordinates, and the amplitude of f at any pair coordinates (x, y) is called the intensity or
gray level of the image at that point. When x, y, and the amplitude values of all finite, discrete
quantities; we call the image as a digital image. The Image Processing technique is a collection
of functions that extend the capability of the MATLAB in numeric computing environment. The
toolbox supports a wide range of image processing operations, including: open image file, add
noise of a given type (e.g. salt &pepper, Gaussian, Speckles...) to intensity image, 2D median
filtering and adaptive filtering, Image analysis and enhancement, Color Image decomposition
into RGB Channels, Image histogram, Image segmentation, image Multi thresholding, image
movie, signal plotting and etc. Many of the toolbox functions are MATLAB M-files, Model files
and a series of MATLAB statements that implement specialized image processing algorithms.
Then Histogram is done for the image and finally thresholding is done for the same image using
this image processing toolbox.

4.3 ASPECTS OF IMAGE PROCESSING :


It is convenient to subdivide different image processing algorithms into broad subclasses. There
are different algorithms for different tasks and problems, and often we would like to distinguish
the nature of the task at hand.
4.3.1 Image Enhancement:
This refers to processing an image so that the result is more suitable for a particular
application. Example includes: Sharpening or de-blurring an out of focus image, highlighting
edges, improving image contrast, or brightening an image, removing noise.
4.3.2 Image Restoration:
This may be considered as reversing the damage done to an image by a known cause, for
example: removing of blur caused by linear motion, removal of optical distortions, removing
periodic interference.
4.3.3 Image Segmentation:
This involves subdividing an image into constituent parts, or isolating certain aspects of an
image:
i. Finding lines, circles, or particular shapes in an image,
ii. In an aerial photograph, identifying cars, trees, buildings, or roads.
These classes are not disjoint; a given algorithm may be used for both image enhancement or
for image restoration. However, we should be able to decide what it is that we are trying to
do with our image: simply make it look better (enhancement), or removing damage
(restoration).

4.4 OPERATIONS IN IMAGE PROCESSING USING MATLAB:


Image processing on MATLAB is generally in following sequence of operations.
4.4.1 Acquiring the image:- First we need to produce a digital image from a paper envelope.
This can be done using either a CCD camera, or a scanner.
4.4.2 Pre-processing: This is the step taken before the major image processing task. The
problem here is to perform some basic tasks in order to render the resulting image more
suitable for the job to follow. In this case it may involve enhancing the contrast, removing
noise, or identifying regions likely to contain the postcode.
4.4.3Segmentation: Here is where we actually get the postcode; in other words we extract from
the image that part of it which contains just the postcode.
4.4.4Representation and description: These terms refer to extracting the particular features
which allow us to differentiate between objects. Here we will be looking for curves, holes
and corners which allow us to distinguish the different digits which constitute a postcode.
4.4.5Recognition and interpretation: This means assigning labels to objects based on their
descriptors (from the previous step), and assigning meanings to those labels. So we identify
particular digits, and we interpret a string of four digits at the end of the address as the
postcode.

4.5 TYPES OF DIGITAL IMAGES:


4.5.1 Binary: Each pixel is just black or white. Since there are only two possible values for
each pixel, we only need one bit per pixel. Such images can therefore be very efficient in
terms of storage. Images for which a binary representation may be suitable include text
(printed or handwriting), fingerprints, or architectural plans.
4.5.2 Grayscale: Each pixel is a shade of grey, normally from 0 (black) to 255 (white). This
range means that each pixel can be represented by eight bits, or exactly one byte. This is
a very natural range for image file handling. Other greyscale ranges are used, but
generally they are a power of 2.
4.5.3 True colour or RGB: Here each pixel has a particular colour; that colour being
described by the amount of red, green and blue in it Since the total number of bits
required for each pixel is 24, such images are also called 24 -bit colour images. Such an
image may be considered as consisting of a stack of three matrices; representing the
red, green and blue values for each pixel. This means that for every pixel there
correspond three values.
4.5.4 Indexed: Most colour images only have a small subset of the more than sixteen million
possible colours. For convenience of storage and file handling, the image has an
associated colour map, or colour palette, which is simply a list of all the colours used in
that image. Each pixel has a value which does not give its colour (as for an RGB image),
but an index to the colour in the map.

This was all about the brief details of MATLAB and its tools. Also we have seen the image
processing tools using MATLAB. In this chapter we have also seen the different aspect and
operation of image processing using MATLAB. Now the next chapter deals with the different
proposed methods for inspection purpose.
CHAPTER 5
PROPOSED METHODS OF INSPECTION THROUGH IMAGE
PROCESSING

5.1 DIGITAL IMAGE PROCESSING USING MATLAB:


The digital analysis of two-dimensional images of casting defect is based on processing the
image acquirement, with the use of a computer. The image is described by a two-dimensional
matrix of real or imaginary numbers presented by a definite number of bytes. The system of
digital image processing may be presented schematically as shown in figure 5.1 below:

Input Colour Image

Gray Image Conversion

Noise Removal and Filtering

Binary Image conversion

Thresholding

Histogram Output

Fig. 5.1 Flowchart Representing System of Digital Image Processing


(1) Capture image: Textile fabric surface image is acquired by using a CCD camera from top of
the surface from a distance adjusted so as to get the best possible view of the surface. That
acquire Input colour fabric image to the MATLAB in image processing system.
(2) Gray image Conversion: RGB colour image is converted into gray image.
(3) Determining size of image: Size of the grayscale image is determined.
(4) Binary image conversion: The grayscale image is further converted to the binary image for
the edge detection algorithm and for morphological operation.
(5) Edge detection: The edges in the grayscale images are determined and further the casting
defect regions are filled with the holes to determine the casting defect properties such as area,
perimeter, length etc.
(6) Displaying boundary: Histogram is a representation of the distribution of colour in an image
and it represents the number of pixels that have colours in each of a fixed list of colour
ranges.

Vous aimerez peut-être aussi