# Question 1

September 5, 2017 | Author: Khan Raqib Mahmud | Category: Pixel, Vision, Imaging, Computer Graphics, Areas Of Computer Science

#### Description

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).

Image(Canoe)

20 40 60

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

80 100 120 140 160 180 200 50

100

150

200

250

300

Colormap(gray) grey level color table of 64 levels

20 40 60

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

80 100 120 140 160 180 200 50

100

150

200

Colormap(gray(256))

250

300

 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: 90 Index: 20.29 RGB: 0.302, 0.302, 0.302

showgrey(Canoe)

 size(colormap,1) length(colormap) size(gray,1) length(gray) plot(colormap) colormap graph3D  showgrey(Canoe,256)

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

Fig showgrey(Canoe,256)

 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? How many grey-levels are needed to get a (subjectively) acceptable result in this case?

Phone = phone256;

X: 112 Y: 192 Index: 18.8 RGB: 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.

 vad = whatisthis256 showgrey(vad) showgrey(vad,64,12,32) Question 3: What does the image show? Why is it di_cult to interpret the information in the original image? X: 9 Y: 37 Index: 164.2 RGB: 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 = nallo256 image(nallo) colormap(gray(256)) colormap(cool) colormap(hot)

50

100

150

200

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

250 50

100

150

200

250

200

250

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

50

100

150

200

250 50

100

150

X: 128 Y: 27 Index: 186 RGB: 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 the visualization more clear and why?

1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0

Cool

0

10

20

30

40

50

60

70

1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0

Hot

0

10

20

30

40

50

60

70

1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0

0

50

100

150

200

250

300

Gray(256) Gray(256) makes the visualization more clear.

 nallo = nallo256 image(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 mentioned above. What are the results and your conclusions?

20

40

60

80

100

120 20

40

60

80

100

120

10

20

30

40

50

60

10

20

30

40

50

60

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

 phone = phonecalc256 showgrey(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

Fig binsubsample

Fig rawsubsample

Fig binsubsample

Fig rawsubsample

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

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

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

of pixels satisfying a given gray-level property which occur repeatedly in an image region constitutes a textured region. A simple example is a repeated pattern 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(:))

4

2

x 10

1.8 1.6 1.4 1.2 1 0.8 0.6 0.4 0.2 0 -250

-200

-150

-100

-50

0

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

2

x 10

1.8 1.6 1.4 1.2 1 0.8 0.6 0.4 0.2 0

0

50

100

150

200

250

300

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

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

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: 102 Index: 20.31 RGB: 0.302, 0.302, 0.302

showgrey(cos(nallo/10))

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

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

4

2.5

x 10

X: 2.537 Y: 2.293e+004

2

1.5

1

0.5

0

0

1

2

3

4

5

6

7

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

2.5

x 10

X: 0.8 Y: 2.264e+004

2

1.5

1

0.5

0 -1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Most spatial domain enhancement operations can be reduced to the form g (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 operation Point processing operations take the form s=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 image s = 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.

Look-up tables For 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)

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

4

8

x 10

7 6 5 4 3 2 1 0

-5

-4

-3

-2

-1

0

1

2

3

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

4

20 40 60 80 X: 71 Y: 117 Index: 24 RGB: 0, 1, 1

100 120 140 160 180 200 50

image(Canoe)

100

150

200

250

300

20 40 60 80 X: 71 Y: 117 Index: 25 RGB: 0.0625, 1, 0.938

100 120 140 160 180 200 50

100

150

200

250

300

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

X: 279 Y: 179 Index: 75.29 RGB: 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 = nallo256float showgrey(nallo_f,256)

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

hist(nallo_f(:)) 4

5

x 10

4.5 4 3.5 3 2.5 2 1.5 1 0.5 0

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

showgrey(nallo_f.^(1/2))

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

3

x 10

2.5

2

1.5

1

0.5

0

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

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: 178 Index: 28.07 RGB: 0.429, 0.429, 0.429