This is a small repository of some of my experiments with image processing. The algorithms are nothing special and can probably be found in Wikipedia as pseudocode, but it was very interesting for me to implement them and combine them to solve a specific problem for a university assignment.
Basically, whenever the levels of gray in an image are clumped close together,
it makes sense to spread them throughout the
[0, 255] range. This often takes
care of excessive brightness or darkness.
Two kinds of blurring are implemented, a simple mean blur and a gaussian blur. The gaussian blur uses a fixed 3x3 kernel.
|Mean blur with a radius of 3 (5x5 matrix)|
Two filters for edge detection are implemented, Laplacian and Sobel. The results they give are quite different and can probably be used with varying success on different occasions.
|Laplacian over gaussian|
There's not much to explain about the simple thresholding by a given value. A more interesting type of thresholding is the iterative one. Basically, it takes an initial value and tries to threshold the image by that. The average intensity of the foreground and background pixels is then used to perform another threshold, and so on until it converges on a "best" value.
In cases with varying lighting, adaptive thresholding is better. The most popular method for that seems to be Otsu's, but for now, I've implemented a simpler one. Each pixel is thresholded by the mean or by the median of the surrounding pixels.
The Floyd-Steinberg algorithm for error propagation is used as an alternative to the standard thresholding by a fixed value. I've yet to experiment with it and expect to make it a bit more useful.