Asistio Module2 Activity
Asistio Module2 Activity
BSCPE-3A
Module 2: Activity
Assignment No.1
1. Pick any greyscale image. Using the imwrite function,write it to files of type JPEG, PNG
and BMP. What are the sizes of those files in MB?
2. Repeat the above question with (a) a binary image, (b) an indexed color image, (c) a
true color image.
1.
2.
Quiz
1:
Apply
imread
()
Module 3
Assignment 2:
Learning Outcome
At the end of the exercise, the student will be able to:
1. Perform standard arithmetic operations such as addition, subtraction, multiplication, and
division on images.
2. Identify the effects of the different arithmetic operations on images.
One can perform image arithmetic using the Scilab arithmetic operators. The Image Processing
Toolbox includes a set of functions that implement arithmetic operations for all numeric, nonsparse data
types such as uint8, uint16, and double, and return the result image in the same format. These functions
perform the operations in double precision, on an element-by-element basis, but do not convert images
to double-precision values in the workspace. Overflow is handled automatically. The functions saturate
return values to fit the data type.
These arithmetic operations act by applying a simple function to each grey value in the image:
y=f(x)
Thus f(x) is a function which maps the range 0-255 onto itself. Simple functions include adding or
subtracting a constant value to each pixel:
y = x + C or y = x - C
and multiplying or dividing each pixel by a constant:
y = C x or y = x / C
In each case, performing these operations may result to values outside the range of 0-255. To ensure
that the results are within the range, we need to round off the values to obtain an integer and then
clipping the values:
If y > 255, then y = 255 or if y < 0, then y = 0
It should be noted that Scilab handles this case automatically.
Procedure
1. We can test this on the image “cameraman.tif”. We start by reading the image in:
>> y = imread (‘cameraman.tif’);
>>figure (1), imshow (y)
Copy the image and place it the space provided under the label “Figure 1. Original Image”
2. Perform addition on the image by entering either of the commands:
>> Add_y = y + 128;
or
>> Add_y = imadd ( y, 128 );
>>figure (2), imshow (Add_y)
Copy the image and place it the space provided under the label “Figure 2. Addition”
3. Perform subtraction on the image by entering either of the commands:
>> Sub_y = y + 128;
or
>> Sub_y = imsubtract ( y, 128 );
>> figure (3), imshow (Sub_y)
Copy the image and place it the space provided under the label “Figure 3. Subtraction”
4. Perform multiplication on the image by entering either of the commands:
>> Mul_y = y * 2;
or
>> Mul_y = immultiply ( y, 2 );
>> figure (4), imshow (Mul_y)
Copy the image and place it the space provided under the label “Figure 4. Multiplication”
5. Perform division on the image by entering either of the commands:
>> Div_y = y / 2;
or
>> Div_y = imdivide ( y, 2 );
>> figure (5), imshow (Div_y)
Copy the image and place it the space provided under the label “Figure 1. xxx”
Figure 1. Original Image Figure 2. Addition Figure 3. Subtraction
Quiz 3
2. The following tables give the number of pixels at each of the grey levels – in an
image with those grey values only. In each case draw the histogram
corresponding to these grey levels, and then perform a histogram equalization
and draw the resulting histogram.
a.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
20 40 60 75 80 75 65 55 50 45 40 35 30 25 20 30
b.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 0 40 80 45 110 70 0 0 0 0 0 0 0 0 15
A.
B.