Gaussian Blur:

    So, my method is based on Ivan Kutskir, Who has demonstrated Gaussian blur using Fast image convolutions by Wojciech Jarosz. According to Ivan, the convolution of two 2D functions f and g is defined as the volume of product of f and shifted ‘g’.  which means that just by shifting one of the function of two, 2D functions blur can be achieved. Since it determines, how much of ‘f’ will get into the result. The Gaussian blur for a 2D function can be defined as a convolution of that function with 2D Gaussian. The Gaussian function is defined as a standard deviation also we are calling it as a ‘radius’.
In discrete finite case, we represent our 2D functions as matrices of values. Now we calculate the volume as a sum. Since Gaussian blur, value is in negative (behind the zero) we will use only all the values between (-r,r) something like −r≤x≤r,−r≤y≤r. This part of Weight is also called kernel.
The values are i and j and they are average between multiplied weights. We take source channel with weight, height and radius and put the values we get to the target channel. So mostly we are just using python math library for calculation of functions.
For radius we want a significant figure, so we take the radius and multiply it with 2.57. we initialize the [i,j] in between zero to [W,H] of source channel. We take minimum of x and y from Weight or Height -1 to the maximum value of i[x,y] between 0 to i[x,y]. In the diameter square, we take x of ‘I’ subtract it from ‘j’ and multiply it twice to make it a square and we take y of ‘I’ subtract it from ‘i’ and square it and add both the values. Now for weight, we take the following formula to calculate the Gaussian:   


Now after we get the values to put it to the target channel with new Wight.

Box blur:
In this method, the calculation happens between function f and Weight w, but the weight is constant and it only within box. The best part about box blur is that when you have weight function as same as some other function it will converge to Gaussian only after several passes. So in this method we take box radius and square multiply it with 4 and divide it by the function f: bb[i,j]=y=ibri+brx=jbrj+brf[y,x]/(2br)2  We need the standard deviation blur into dimensions of boxes for box blur. My math skills are not up to the point so I have used the http://blog.ivank.net method and implemented it in the program. The algorithm still has the same method, but now the area is small and weight is constant. Even we use it multiple times it work fast. in this method we take Radius as sigma and we make the 3 boxes of blur.

Total blur:
Now since box blur is just one direction blur let us make use of box blur and make it total blur with two dimensions.
 We have two separate direction of blur that we can loop together and use the same method again but this time for both the direction. Still the method complexity is same and weight is constant but now we have two direction which we have to loop them together

This is the end of the main functions of image recognition library, since we are using OpenCV directly for checking image, I might not make a new function for it. In future, we might implement out matching algorithm for detecting objects or machine learning that parts yet to be determined. So, far the main function for library are ready for images.  

Comments

Popular posts from this blog