[SOLVED] Image Processing-Exercise 2 A & B Program That Thresholds an Input Image & Program That Compares 2 Input PGM Images

20.99 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (1 vote)

Exercise 02a. Implement a program ‘exercise_02a_thresh’ that thresholds an input image exercise_02a_input_01.pgm at level ‘value’:

exercise_02a_thresh exercise_02a_input_01.pgm value exercise_02a_output_01.pgm

The thresholding operation is as follows: a pixel p will have a value of 255 in exercise_02a_output_01.pgm if its value in exercise_02a_input_01.pgm is greater or equal than that of value; otherwise, p will have a value of 0.

The image ‘cam_74_threshold100.pgm’ is the result of thresholding ‘cam_74.pgm’ at value 100.

Exercise 02b. Implement a program ‘exercise_02b_compare’ that compares two input PGM images (arguments of the program). The names of the

executable and of the input images are indicated in the

following example call:

exercise_02b_compare exercise_02b_input_01.pgm exercise_02b_input_02.pgm

The program should write ‘-‘ or ‘!-‘ (without quotes) to an output file called exercise_02b_output_01.txt depending on whether the pgm images are equal or not.

The sizes of the input images could be different, in which case exercise_02b_output_01.txt should contain ‘!-‘ .

Note: two images I1 and I2 of identical sizes are equal if and only if the intensity value of every pixel (x,y) of I1 is equal to

the intensity value of the same pixel (x,y) of I2.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.