Top Banner
Question 1: What happens in the image apart from the color change? Image Type (Double-Precision Data (double Array)) Indexed (colormap) Image is stored as a two-dimensional (m-by-n) array of integers in the range [1, length (colormap)]; colormap is an m-by-3 array of floating-point values in the range [0, 1]. True color (RGB) Image is stored as a three-dimensional (m-by-n-by-3) array of floating-point values in the range [0, 1]. Image Type (8-Bit Data (uint8 Array)16-Bit Data (uint16 Array)) Indexed (colormap) Image is stored as a two-dimensional (m-by-n) array of integers in the range [0, 255] (uint8) or [0, 65535] (uint16); colormap is an m-by-3 array of floating-point values in the range [0, 1]. True color (RGB) Image is stored as a three-dimensional (m-by-n-by-3) array of integers in the range [0, 255] (uint8) or [0, 65535] (uint16). Intensity images: This type is usually used in monochormatic displays, e.g. gray colormap. Data in the matrix X do not have to be of any speciÖc numerical type and they are rescaled over a given range and the result is used to index into the colormap. Grayscale images are similar to indexed images in that each uses an m-by-3 RGB colormap, but you normally do not specify a colormap for a grayscale image. MATLAB displays grayscale images by using a grayscale system colormap (where R=G=B).
41
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Question 1

Question 1: What happens in the image apart from the color change?

Image Type (Double-Precision Data (double Array))

Indexed (colormap)

Image is stored as a two-dimensional (m-by-n) array of integers in the range [1, length (colormap)]; colormap is an m-by-3 array of floating-point values in the range [0, 1].

True color (RGB)

Image is stored as a three-dimensional (m-by-n-by-3) array of floating-point values in the range [0, 1].

Image Type (8-Bit Data (uint8 Array)16-Bit Data (uint16 Array))

Indexed (colormap)

Image is stored as a two-dimensional (m-by-n) array of integers in the range [0, 255] (uint8) or [0, 65535] (uint16); colormap is an m-by-3 array of floating-point values in the range [0, 1].

True color (RGB)

Image is stored as a three-dimensional (m-by-n-by-3) array of integers in the range [0, 255] (uint8) or [0, 65535] (uint16).

Intensity images: This type is usually used in monochormatic displays, e.g. gray colormap. Data in the matrix X do not have to be of any speciÖc numerical type and they are rescaled over a given range and the result is used to index into the colormap.

Grayscale images are similar to indexed images in that each uses an m-by-3 RGB colormap, but you normally do not specify a colormap for a grayscale image. MATLAB displays grayscale images by using a grayscale system colormap (where R=G=B).

Page 2: Question 1

Image(Canoe)

Page 3: Question 1

X: 196 Y: 90Index: 66RGB: 1, 1, 1

50 100 150 200 250 300

20

40

60

80

100

120

140

160

180

200

Colormap(gray) grey level color table of 64 levels

Page 4: Question 1

X: 196 Y: 90Index: 66RGB: 0.255, 0.255, 0.255

50 100 150 200 250 300

20

40

60

80

100

120

140

160

180

200

Colormap(gray(256))

load canoe256

image(Canoe)

colormap(gray)

colormap(gray(256))

Page 5: Question 1

image(Canoe)

axis equal

Image elements are squared.

help showgrey

SHOWGREY(IMAGE, RESOLUTION, ZMIN, ZMAX)

displays the real matrix IMAGE as a gray-level image on the screen.

A Matlab-function showgrey is provided in the function library of the course. If nothing else is stated, this function _rst computes the largest and smallest values, and then transforms this interval of grey-levels to an interval of a grey-level colour table of 64 levels.

X: 196 Y: 90Index: 20.29RGB: 0.302, 0.302, 0.302

Page 6: Question 1

showgrey(Canoe)

size(colormap,1)

length(colormap)

size(gray,1)

length(gray)

plot(colormap)

colormap

graph3D

showgrey(Canoe,256)

X: 190 Y: 90Index: 69.97RGB: 0.267, 0.267, 0.267

Fig showgrey(Canoe,256)

Page 7: Question 1

showgrey(Canoe,256) this techniques quantizing the image using different numbers of bits.

Question 2: Why does a pattern appear in the background of the telephone image? Howmany grey-levels are needed to get a (subjectively) acceptable result in this case?

Phone = phone256;

X: 112 Y: 192Index: 18.8RGB: 0.895, 0.895, 0.895

showgrey(phone,20)

In the matrix phone some intensity values are really small in compare with the other values , so we get the image patterns in the background.

Page 8: Question 1

vad = whatisthis256showgrey(vad)showgrey(vad,64,12,32)

Question 3: What does the image show? Why is it di_cult to interpret the informationin the original image?

X: 9 Y: 37Index: 164.2RGB: 1, 1, 1

Fig vad

Mountain, it is difficult to interpret the image by the information as the values are same almost everywhere and there some positions the maximum values.

nallo = nallo256image(nallo)colormap(gray(256))colormap(cool)colormap(hot)

Page 9: Question 1

X: 36 Y: 231Index: 1RGB: 0, 0, 0

50 100 150 200 250

50

100

150

200

250

X: 128 Y: 26Index: 175RGB: 1, 0.823, 0

50 100 150 200 250

50

100

150

200

250

Page 10: Question 1

X: 128 Y: 27Index: 186RGB: 0.725, 0.275, 1

50 100 150 200 250

50

100

150

200

250

Question 4: Interpret the plots in terms of image content. Which colormap makes thevisualization more clear and why?

Page 11: Question 1

0 10 20 30 40 50 60 700

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Cool

Page 12: Question 1

0 10 20 30 40 50 60 700

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Hot

Page 13: Question 1

0 50 100 150 200 250 3000

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Gray(256)

Gray(256) makes the visualization more clear.

nallo = nallo256image(nallo)nallo_sub1 = rawsubsample(nallo)image(nallo_sub1)nallo_sub2 = rawsubsample(nallo_sub1)image(nallo_sub2)

Question 5: Repeatedly apply the subsampling operator to some of the images mentionedabove. What are the results and your conclusions?

Page 14: Question 1

20 40 60 80 100 120

20

40

60

80

100

120

10 20 30 40 50 60

10

20

30

40

50

60

Page 15: Question 1

5 10 15 20 25 30

5

10

15

20

25

30

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Page 16: Question 1

phone = phonecalc256showgrey(phone,256)phone_1 = rawsubsample(phone)showgrey(phone_1,256)showgrey(phone_1,128)phone_b1 = binsubsample(phone)showgrey(phone_b1,256)showgrey(phone_b1,128)

Fig rawsubsample 128

Page 17: Question 1

Fig binsubsample

Page 18: Question 1

Fig rawsubsample

Page 19: Question 1

Fig binsubsample

Fig rawsubsample

Page 20: Question 1

Fig binsubsample

Question 6:Describe in which ways the results are similar and different. Explain thereasons behind the differences.

Question 7: What will the results be if you repeatedly apply these two types of operatorsto a textured image?

Texture is characterized by the spatial distribution of gray levels in aneighborhood. Thus, texture cannot be defined for a point. The resolutionat which an image is observed determines the scale at which the texture isperceived. For example, in observing an image of a tiled floor from a largedistance we observe the texture formed by the placement of tiles, but thepatterns within the tiles are not perceived. When the same scene is observedfrom a closer distance, so that only a few tiles are within the field of view, webegin to perceive the texture formed by the placement of detailed patternscomposing each tile. For our purposes, we can define texture as repeatingpatterns of local variations in image intensity which are too fine to be distinguished as separate objects at the observed resolution. Thus, a connected set

Page 21: Question 1

of pixels satisfying a given gray-level property which occur repeatedly in animage region constitutes a textured region. A simple example is a repeatedpattern of dots on a white background.

Grey-level transformations and look-up tables:

load canoe256

neg1 = - Canoe

showgrey(neg1)

neg2 = 255 – Canoe

showgrey(neg2)

Question 8:

Related to neg1 and neg2 - why are the histograms different but images

similar? Related to nallo - explain how the above transformation functions affect the

image histograms.

For histogram of neg1:

hist(neg1(:))

Page 22: Question 1

-250 -200 -150 -100 -50 00

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2x 10

4

For histogram of neg2:hist(neg2(:))

0 50 100 150 200 250 3000

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2x 10

4

Page 23: Question 1

Image histogram:

- Provides information about the contrast and overall intensity distribution.

- Simply a bar graph of pixel intensities.

An image histogram is a type of histogram that acts as a graphical representation of the tonaldistribution in a digital image.[1] It plots the number of pixels for each tonal value.

The horizontal axis of the graph represents the tonal variations, while the vertical axis represents the number of pixels in that particular tone.[1] The left side of the horizontal axis represents the black and dark areas, the middle represents medium grey and the right hand side represents light and pure white areas. The vertical axis represents the size of the area that is captured in each one of these zones. Thus, the histogram for a very dark image will have the majority of its data points on the left side and center of the graph. Conversely, the histogram for a very bright image with few dark areas and/or shadows will have most of its data points on the right side and center of the graph.

Fig neg1

Page 24: Question 1

Fig neg2

Brief Description

In an image processing context, the histogram of an image normally refers to a histogram of the pixel intensity values. This histogram is a graph showing the number of pixels in an image at each different intensity value found in that image. For an 8-bit grayscale image there are 256 different possible intensities, and so the histogram will graphically display 256 numbers showing the distribution of pixels amongst those grayscale values. Histograms can also be taken of color images --- either individual histograms of red, green and blue channels can be taken, or a 3-D histogram can be produced, with the three axes representing the red, blue and green channels, and brightness at each point representing the pixel count. The exact output from the operation depends upon the implementation --- it may simply be a picture of the required histogram in a suitable image format, or it may be a data file of some sort representing the histogram statistics.

How It Works

Page 25: Question 1

The operation is very simple. The image is scanned in a single pass and a running count of the number of pixels found at each intensity value is kept. This is then used to construct a suitable histogram.

Every pixel in the Color or Gray image computes to a Luminance value between 0 and 255. The Histogram graphs the pixel count of every possible value of Luminance, or brightness if it helps to think of it that way. Luminance is brightness the same way the human eye sees it, as opposed to absolute brightness. Anyway, the total tonal range of a pixel's 8 bit tone value is 0..255, where 0 is the blackest black at the left end, and 255 is the whitest white at the right end. The height of each vertical bar in the histogram simply shows how many image pixels have luminance value of 0, and how many pixels have luminance value 1, and 2, and 3, etc, all the way to 255 at the right end.The higher the graph at any given point the more pixels of that tone that are present in an image.

nallo = nallo256 showgrey(nallo.^(1/3))

X: 236 Y: 102Index: 20.31

RGB: 0.302, 0.302, 0.302

Page 26: Question 1

showgrey(cos(nallo/10))

X: 73 Y: 245Index: 65RGB: 1, 1, 1

n = nallo.^(1/3)hist(n(:))

Page 27: Question 1

0 1 2 3 4 5 6 70

0.5

1

1.5

2

2.5x 10

4

X: 2.537Y: 2.293e+004

n1 = cos(nallo/10)hist(n1(:))

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 10

0.5

1

1.5

2

2.5x 10

4

X: 0.8Y: 2.264e+004

Page 28: Question 1

Most spatial domain enhancement operations can be reduced to the formg (x, y) = T[ f (x, y)]where f (x, y) is the input image, g (x, y) is the processed image and T is some operator defined over some neighbourhood of (x, y) In this case T is referred to as a grey level transformation function or a point processing operationPoint processing operations take the forms = T ( r )where s refers to the processed image pixel value and r refers to the original image pixel value

Negative images are useful for enhancing white or grey detail embedded in dark regions of an images = intensitymax - r

Thresholding transformations are particularly useful for segmentation in which we want to isolate an object of interest from a background Gray Level Transformation is the process of transforming an input image of some format to an output image comprised of gray scale data. Input sources range from images taken in the visual spectrum (e.g. photographs) to non-visible images (e.g. x-rays).

Gray Scale

Gray-scale images represent data per element in a shade of gray that ranges in intensity from zero (being

black) to a maximum (being white) with various shades in between. For example, an 8-bit gray scale will

range from 0 to 255, providing 256 different possible levels of brightness.

Page 29: Question 1

Look-up tablesFor some types of grey-level transformations it may be necessary to represent transformations in terms of look-up tables. Typical examples are transformation that imply extensive computations for each image element, or if a closed expression for a transformation cannot be found.Creat a look up table for the grey level interval[0,255]:negtransf = (255:-1:0)'outpicture = compose(negtransf,nallo)showgrey(outpicture,256)

Page 30: Question 1

neg3 = compose(negtransf,Canoe+1)diff = neg3 - neg2 we get 0max(max(diff))hist(diff(:))

Page 31: Question 1

-5 -4 -3 -2 -1 0 1 2 3 40

1

2

3

4

5

6

7

8x 10

4

Question 9:Why was value 1 added to the image before the look-up?We take the zmax into the compose function.

Manipulation of colour tables

Page 32: Question 1

X: 71 Y: 117Index: 24RGB: 0, 1, 1

50 100 150 200 250 300

20

40

60

80

100

120

140

160

180

200

image(Canoe)

Page 33: Question 1

X: 71 Y: 117Index: 25RGB: 0.0625, 1, 0.938

50 100 150 200 250 300

20

40

60

80

100

120

140

160

180

200

image(Canoe+1)

image(Canoe+1)negcolormapcol = linspace(1,0,256)'colormap([negcolormapcol negcolormapcol negcolormapcol])showgrey(Canoe, linspace(1,0,256),0,255)

Page 34: Question 1

X: 279 Y: 179Index: 75.29RGB: 0.71, 0.71, 0.71

The two last arguments tell showgrey that the image has values in the interval [0,255], which means that we no longer have to add a value 1. The obvious drawback of just manipulating the colour table is that the result is not available for further processing or analysis.

Stretching of grey-levels

nallo_f = nallo256floatshowgrey(nallo_f,256)

Page 35: Question 1

X: 67 Y: 237Index: 1.889RGB: 0, 0, 0

hist(nallo_f(:))

0 0.1 0.2 0.3 0.4 0.5 0.6 0.70

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5x 10

4

Page 36: Question 1

showgrey(nallo_f.^(1/2))

nallo_f_trans = nallo_f.^(1/2)hist(nallo_f_trans(:))

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.80

0.5

1

1.5

2

2.5

3x 10

4

Page 37: Question 1

Question 10:What would be the best transformation function and why?As pointwise power transformation is better.

Logarithmic Compression:

nallo_f_log = log(nallo_f)showgrey(nallo_f_log)

X: 52 Y: 178Index: 28.07RGB: 0.429, 0.429, 0.429