Question: IMAGE PROCESSING IN C (IMAGE EDGE DETECTION) (45 MARKS) Note: this particular assignment will form the basis for the OS-assignment, which will involve image manipulation
IMAGE PROCESSING IN C (IMAGE EDGE DETECTION) (45 MARKS) Note: this particular assignment will form the basis for the OS-assignment, which will involve image manipulation using many processes or threads. Thus, an understanding of (and correct solution to) this problem will significantly reduce the time you will need in the OS assignment. Given an m m image A, the required task is to detect edges in the image. This type of operation is a standard practice in image processing and computer vision, and is a required step in tasks, such as automated object recognition by a robot or by a machine, in shape retrieval and classification, and in biometrics. It is also performed during the stage of image and video compression, for edge-based compression schemes. For simplicity, we assume that the input image is always square (but this does not have to be the case). The required edge detection is performed using a 2D filtering mask as follows. Step 1: Filtering Define a 2D mask as an n n matrix. For now we assume n is a small odd number, example n=3, 5, or 7. For each n n block we compute the product of the values in the mask with the corresponding position in the small block. We replace the value at the center of the small block from the image with the sum of the products. Specifically, if I(x,y) is the pixel value at position (x,y) in the image I, and E(x, y) is resulting edge response after the filtering using the mask w. The edge response is obtained as: = = = + + a p a a q a E x y w p q I x p y q ( , ) ( , ) ( , ) , where a=(n-1)/2 . The filtering is performed using a horizontal mask (wh) and a vertical mask (wv). Each mask produces a component image, which are then combined to obtain the final edge response image. E(x, y) E (x, y) E (x, y) h v = + For this assignment, we perform simple Sobel edge detection, with the masks defined by the following matrices: . 1 0 1 2 0 2 1 0 1 , 1 2 1 0 0 0 1 2 1 = = h v w w Step 2: Binary Image The edge response image is then binarized using a threshold to obtain a binary edge image. To determine a threshold, we compute the mean () and standard deviation () of the edge responses. We define the threshold simply as follows: T = + Ks , where K is a constant. We set K=1 for now. The binary image is then defined as : = 0 otherwise 1 if ( , ) ( , ) E x y T
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
