/************************Blur(smooth) Image using gaussian 3*3 kernel ****************************************************
Function Name : SmoothImage
Input : int *** , int , int , int
Output : int ****
*****************************************************************************************/
int*** SmoothImage(int ***XImage ,int width, int height, int channel)
{
double sigma = 1.85; //(n/2 -1)*0.3 +0.8 { n = 9 ,no. of elements}
double conv[3][3];
double hg = 0;
//Convolution kernel
for(int i=0; i<3;i++)
{
for(int j=0;j<3;j++)
{
int u=i-1; //subtract from centre element index in 3*3 (1,1)
int v=j-1;
conv[i][j] =exp ( - ((u*u) + (v*v)) / (2*sigma*sigma) );
hg += conv[i][j];
}
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余4页未读,立即下载
- 1
- 2
- 3
前往页