M Sobel

From Cpre584
Jump to navigation Jump to search

Initial Software

Currently I have the software hosted at the following link on github: https://github.com/mjpatter88/SobelEdgeDetection

The code can be found here: https://github.com/mjpatter88/SobelEdgeDetection/blob/master/sobel.c

The makefile can be found here: https://github.com/mjpatter88/SobelEdgeDetection/blob/master/Makefile


This software supports both ppm (color) and pgm (black and white) images. In the case when the input image is a color image, each pixel is converted to gray scale before the Sobel operator is applied.

This algorithm also dynamically scales the output, so the highest value after the Sobel Operator has been applied becomes 255 (maxval), and the rest are scaled appropriately. From what I've observed, this tends to make the output images a little darker than other implementations, but they also are smoother. My implementation seems fairly similar to GIMP's use of the Sobel operator, as can be seen in the following screenshots.

The original image followed by the output of my Sobel operator followed by the output of GIMP's Sobel filter.

I also tested it on Convey to make sure it worked there as well, and it did.

Software Optimization

I then did some simple optimizations in software to make sure the output did not change. This basically consisted of ignoring the cases when values were multiplied by 0 and also turning the multiplications into additions.

Here is a resulting image, exactly the same as before.

Software Simulation

link to code (c code, assembly, software sim c++), results.


Hardware

link to code, results, timing analysis