WOW !! MUCH LOVE ! SO WORLD PEACE !
Fond bitcoin pour l'amélioration du site: 1memzGeKS7CB3ECNkzSn2qHwxU6NZoJ8o
  Dogecoin (tips/pourboires): DCLoo9Dd4qECqpMLurdgGnaoqbftj16Nvp


Home | Publier un mémoire | Une page au hasard

 > 

Implementation of edge detection for a digital image

( Télécharger le fichier original )
par Innocent MBARUBUKEYE
KIST - AO Electronics and telecommunication engineering 2008
  

précédent sommaire suivant

Bitcoin is a swarm of cyber hornets serving the goddess of wisdom, feeding on the fire of truth, exponentially growing ever smarter, faster, and stronger behind a wall of encrypted energy

3.1.10. IMAGE TYPES AND DATA CLASSES

MATLAB supports intensity images (including binary images), indexed images, and color images. Most of this class will involve intensity images, in which each pixel is a scalar measure of light by a detector. Binary images have only values 0 or 1 for 'no light' or 'light'. Binary pixel values can be represented with one bit and packed into bytes.

Intensity images with more precision can use integer data of various lengths or floating point data of various lengths. Typically, we will use uint8 (unsigned 8-bit integers) or double (double-precision floating point numbers).

MATLAB has functions for converting the data types of images.  It is important to understand the mathematics of these conversions.

Image Indexing

The value of a single pixel in an image is indexed as:

p(m,n)

Multiple pixels can be indexed with a vector as:

p([1 3],1) which selects pixels p(1,1) and p(3,1).

Multiple pixels also can be indexed using a range.  The first row is all pixels with row index 1 and any column index:

p(1,1:N) The notation 1:N indicates all indexes from 1 to N.

The notation can contain a step value, e.g., 1::2:5 indicates indexes 1, 3, 5.

The keyword end can be used to indicate the last index. The range operator by itself, :, indicates the full range, from 1 to end either of a dimension or of the whole matrix.

Standard Arrays

MATLAB has standard arrays for creating arrays of a defined size with zeros, ones, true, false, or random values. For example:

p = zeros(M,N);

Builtin Functions

MATLAB has many useful builtin functions listed in Appendix A of the text book. For example:

max(p(:))

Gives the largest value in the matrix.

Note, given matrix p, max(p) treats the matrix as an array of column vectors and returns a vector of the largest value in each column.

Operators

MATLAB has builtin arithmetic, relational, and logical operators.

Two images can be added so that the output value at each pixel is the sum of the values of the corresponding input pixels.  For example:

r = p+q;

which also can be written:

r = plus(p,q);

The operands can be scalars, vectors, or matrices.

The array and matrix arithmetic operations are done in double precision floating point.  MATLAB also provides operations which support integer arithmetic, e.g., imadd and immultiply,

For multiplication and some other operations, MATLAB has two types of arithmetic operations: array arithmetic operations which perform the operation on corresponding pixels of the input images and matrix arithmetic operations which perform matrix arithmetic.

Array multiplication is:

r = p.*q;

or

r = times(p,q);

Matrix multiplication is:

r = p*q;

or

r = mtimes(p,q);

3.1.11. IMAGE FORMATS SUPPORTED BY MATLAB

The following image formats are supported by Matlab:

BMP, HDF, JPEG, PCX, XWD and TIFF.

Most images you find on the Internet are JPEG-images which is the name for one of the most widely used compression standards for images. If you have stored an image you can usually see from the suffix what format it is stored in. For example, an image named myimage.jpg is stored in the JPEG format and we will see later on that we can load an image of this format into Matlab.

WORKING FORMATS IN MATLAB

If an image is stored as a JPEG-image on your disc we first read it into Matlab. However, in order to start working with an image, for example perform a wavelet transform on the image, we must convert it into a different format. This section explains four common formats.

Intensity image (gray scale image)

This is the equivalent to a "gray scale image" and this is the image we will mostly work with in this course. It represents an image as a matrix where every element has a value corresponding to how bright/dark the pixel at the corresponding position should be colored. There are two ways to represent the number that represents the brightness of the pixel: The double class (or data type). This assigns a floating number ("a number with decimals") between 0 and 1 to each pixel. The value 0 corresponds to black and the value 1 corresponds to white. The other class is called uint8, which assigns an integer between 0 and 255 to represent the brightness of a pixel. The value 0 corresponds to black and 255 to white. The class uint8 only requires roughly 1/8 of the storage compared to the class double. On the other hand, many mathematical functions can only be applied to the double class. We will see later how to convert between double and uint8.

Binary image

This image format also stores an image as a matrix but can only color a pixel black or white (and nothing in between). It assigns a 0 for black and a 1 for white.

Indexed image

This is a practical way of representing color images. (In this course we will mostly work with gray scale images but once you have learned how to work with a gray scale image you will also know the principle how to work with color images.) An indexed image stores an image as two matrices. The first matrix has the same size as the image and one number for each pixel. The second matrix is called the color map and its size may be different from the image.

The numbers in the first matrix is an instruction of what number to use in the color map matrix.

RGB image

This is another format for color images. It represents an image with three matrices of sizes matching the image format. Each matrix corresponds to one of the colors red, green or blue and gives an instruction of how much of each of these colors a certain pixel should use.

Multiframe image

In some applications we want to study a sequence of images. This is very common in biological and medical imaging where you might study a sequence of slices of a cell. For these cases, the multiframe format is a convenient way of working with a sequence of images. In case you choose to work with biological imaging later on in this course, you may use this format.

précédent sommaire suivant






Bitcoin is a swarm of cyber hornets serving the goddess of wisdom, feeding on the fire of truth, exponentially growing ever smarter, faster, and stronger behind a wall of encrypted energy








"Il existe une chose plus puissante que toutes les armées du monde, c'est une idée dont l'heure est venue"   Victor Hugo