OVERVIEW ======== "Sobel" is a method of edge detection. Edge detection is a commonly used image processing function, which identifies the pixels of an image, composing a line that joins two contrasting areas in the image. For example, an image of a black cat, in front of a white sky, will outline the silhouette of the cat, identifying the "edge" as the contrast between the black and white. (See the source file in ImageProcessingAnalysis/src, and the Blackfin Edge Detection applications) In this implementation, the input is processed using a horizontal and vertical mask. Both results are squared and added. This value is compared with the square of the threshold value, and if result is greater than the threshold value, the output is written as one. Otherwise, the output is zero. The resulting image is binary. Since the first and last rows do not contain valid information, the output values of these rows are zero. Similarly, in each row, the first and last columns are zero. (All boundary elements are zero.) The user must pass the proper threshold value. Horizontal mask = | -1 -2 -1 | | 0 0 0 | | 1 2 1 | Vertical mask = | -1 0 1 | | -2 0 2 | | -1 0 1 | To get one pixel edge, the following condition is checked: output(r,c) = (b(r,c)>cutoff) & ( ( (bx(r,c) >= by(r,c)) & (b(r,c-1) <= b(r,c)) & (b(r,c) > b(r,c+1)) ) | ( (by(r,c) >= bx(r,c)) & (b(r-1,c) <= b(r,c)) & (b(r,c) > b(r+1,c)))); r - row c- column bx - resultant matrix when horizontal mask is applied by - resultant matrix when vertical mask is applied b - bx(r,c)*bx(r,c) +by(r,c)*by(r,c); In the output image first row, last row, first column and last column, are all zero. Prototype: void _sobel(unsigned char* in, int row, int col, unsigned char *out,int threshold ); Arguments: in - pointer to the input image. row - number of rows of input image. col - number of columns of input image. out - pointer the output buffer. threshold - Threshold value to compare. Registers used : A0, A1, R0-R7, I1, I3, B0-B3, M0-M3, L1, L3, P0-P5, LC0, LC1. If image size is less than 64x64 then 2 stall [ Dcache Bank Collision ] will occur, because both temporary results are in stack. In condition check Branch prediction is assumed because most of the values will be below threshold. Image chosen for cycle count : 8x8 image with central 6x6 pixels with 255 value and rest of the pixels with value zero. Threshold value used is 966.