Start New Discussion within our **Software Development Community** Not Yet Answered # Gabor filter

1o0oBhP 4 Chainsaw 12 Discussion Starter dalaharp jwenting 1,531 Discussion Starter dalaharp alc6379 105 Dave Sinkula 2,398 1o0oBhP 4 Discussion Starter dalaharp hayat alazzeh -1

0

Talk us through the gabor filter.... im sure if you explain it anyone can do a pseudocode for you and maybe a bit more.... :)

0

Since Google is a programmer's best friend, a search there yielded a bunch-o-sites (of course), and this one claims to have some source code:

http://www.icsi.berkeley.edu/ftp/global/pub/speech/papers/icslp02-gabor/

-1

thanks for the help,

google yields hits, ok. but the problem is that all the codes are in high level C, unfortunately i am not that good in C. so i want the coding in simple C.

ok i can outline the operation required and the equations, maybe we can put together a code of sorts. :-|

i have attached a file, where the first step of gabor filter is detailed (a point to note: i am implementing gabor for fingerprint image processing)

and this is how i coded it..

just see if there are no technical errors in it..

R and C are image height and width.

and

#define P1 image[r-1][c-1] //3x3 IMAGE MASK ELEMENTS

#define P2 image[r-1][c]

#define P3 image[r-1][c+1]

#define P4 image[r][c+1]

#define P5 image[r+1][c+1]

#define P6 image[r+1][c]

#define P7 image[r+1][c-1]

#define P8 image[r][c-1]

```
/* LOCAL ORIENTATION ESTIMATION */
for(r=0;r<R;r++)
{
for(c=0;c<C;c++)
{
// calculate the gradients gx and gy
gx[r][c]=((P1*1)+(P2*0)+(P3*-1)+(P8*2)+(image[r][c]*0)+(P4*-2)+(P7*1)+(P6*0)+(P5*-1));
gy[r][c]=((P1*1)+(P2*2)+(P3*1)+(P8*0)+(image[r][c]*0)+(P4*0)+(P7*-1)+(P6*-2)+(P5*-1));
Vx[r][c]=0;
Vy[r][c]=0;
for(u=r-5;u<=r+5;r++)
{
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]+(pow((gx[u][v]),2)*pow((gy[u][v]),2));
}
} //inner loop
if(Vx[r][c]==0)
{
thetaQ[r][c]=90;
}
else
{
//T=(Vy[r][c])/(Vx[r][c]);
thetaQ[r][c]=(1/2)*(atan((Vy[r][c])/(Vx[r][c]))); //orientation angle of the query image
}
//vecx[r][c]=sin(2*theta[r][c]);
//vecy[r][c]=cos(2*theta[r][c]);
} //outer loop
} //the loop
```

thanks..

0

Maybe you should get better in C then before attempting to solve complex problems.

Studying that more complex code is one way which will help you get better yourself.

0

if i am any better in C, why should i ask for help. :-)

with what little time i have, i have to finish the job at hand, and with what little C expertise i have. so...

0

if i am any better in C, why should i ask for help. :-)

with what little time i have, i have to finish the job at hand, and with what little C expertise i have. so...

I think what they're trying to say is there might not be a simple way of doing it. I don't think you'll find some do_what_i_want_it_to_do(); function out there to plug into your program. This may be the opportunity to bone up on the topic.

0

i have attached a file, where the first step of gabor filter is detailed (a point to note: i am implementing gabor for fingerprint image processing)

and this is how i coded it..

just see if there are no technical errors in it..

We can't really do that because you are not including enough code.

My living room is rectangular; there are some couches and a chair and some other stuff: tell me if it is baby-safe.

0

do you have any matrix manipulation functions in your code??? you need to check them if you havent already (use ID matrix to check). Most people get the indicies of their matrices mixed up and therefore the maths breaks down!

If you have seperate functions for matrix algebra it would clean up the code. It doesnt look too hard at first glance, and should be able to be written in 'simple' (bit of a loose definition) c. Do you understand the maths? if you you should see that a matrix multiply in the block followed by a summation can be VERY easily done in c.....

What have you tried / got working so far? any code would help with errors ect..

0

i really liked that do_what_i_want_it_to_do(); function and the baby-safe example..

but the problem is, the whole porgram is some 500 codes, so i submitted only the pertinent code.

i just want to know if i have commited a domain error, or the like(some technical flaw), which will go undetected by the compiler, but will ultimately produce erraneous results.

please tell me if i have put the equations in correct C.

i really cant understand why this code is insufficient for that( i maybe asking this because i know little about C), is it so?

i missed to define the data types,

`unsigned char gx[R][C],gy[R][C],Vx[R][C],Vy[R][C],thetaQ[R][C];`

thanks..

and i dont think i have any matrix multiplication in my code.

-1

Hi,

i am trying to implement code of filter for image

if someone has any code snippet or pseudocode or any idea of implementing it in C++, please help me out with it.

thanks

This article has been dead for over six months. Start a new discussion instead.