954,504 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

code for Gabor

Truclam
Newbie Poster
1 post since Nov 2005
Reputation Points: 10
Solved Threads: 0
 
prog-bman
Junior Poster
109 posts since Nov 2004
Reputation Points: 14
Solved Threads: 4
 

For one thing the arrays go out of bounds when r = 0 or c = 0 or r = R or c = C.

for( r = 0 ; r < R; r++ )
{
	for(c=0;c<C;c++)
	{
		// gradients gx and gy (sobel)
		gx[r][c]=(imag[r-1][c-1]*1)+(imag[r-1][c]*0)+(imag[r-1][c+1]*-1)+(imag[r][c-1]*2)+(imag[r][c]*0)+(imag[r][c+1]*-2)+(imag[r+1][c-1]*1)+(imag[r+1][c]*0)+(imag[r+1][c+1]*-1);

		gy[r][c]=(imag[r-1][c-1]*1)+(imag[r-1][c]*2)+(imag[r-1][c+1]*1)+(imag[r][c-1]*0)+(imag[r][c]*0)+(imag[r][c+1]*0)+(imag[r+1][c-1]*-1)+(imag[r+1][c]*-2)+(imag[r+1][c+1]*-1);


		Vx[r][c]=0;
		Vy[r][c]=0;
		for(u=r-5;u<=r+5;u++) //10x10 window
		{
			for(v=c-5;v<=c+5;v++)
			{

				Vx[r][c]=Vx[r][c]+(2*(gx[u][v])*(gy[u][v]));

				Vy[r][c]=Vy[r][c]+((gx[u][v]*gx[u][v])*(gy[u][v]*gy[u][v]));
			}
		}


		if(Vx[r][c]==0)
		{
			thetaQ[r][c]=90;
		}
		else
		{
			thetaQ[r][c]=(0.5*(atan(Vy[r][c])/(Vx[r][c])));
		}
	}
}
WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 

Does this code for gabor filter work?

JazzyRO
Newbie Poster
1 post since May 2009
Reputation Points: 10
Solved Threads: 0
 

Try it and find out.

Nick Evan
Not a Llama
Moderator
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You