kód pro filtr Gabor

T

Truclam

Guest
Zdravím všechny,
I implementovat Gabor filtrovat podle mého c funkce (dát do Visual C ).když jsem tam byl sestaven bez chyby, ale když jsem kliknul na tlačítko pro excution tuto funkci byl neúspěch zprávu.Nemohu zjistit chybu, takže doufám, že mi někdo pomůže.

Tady je můj kód:
/ / "Image" je ve formátu obrazu Intel (I used OpenCV)
/ / Obraz je šedivý obraz
void Tien_xu_ly:: Gabor (IplImage * obrázek)
(
# define R 300 / / číslo řádku
# define C 256 / / číslo sloupce
double imag [R] [C];
double Gabor [R] [C];
double gx [R] [C] gy [R] [C];
Vx double [R] [C], Vy [R] [C];
double thetaQ [R] [C];
int r, c, u, v, x, y, i, j;
int STDEV = 4;
double chrám, x_theta, y_theta;
double treten;

/ * Konvertita obraz až k ARRAY * /
for (i = 0; i <image-> výšky i )
(
for (j = 0; j <image-> width; j )
(
imag [j] = (unsigned char) (image-> imageData image->
widthStep * i) [j];
)
)

/ * MÍSTNÍ ORIENTAČNÍ ODHAD * /
for (r = 0, r <R, r )
(
for (c = 0, c <C, C )
(
/ / Sklony a gx 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 <= 5 r, u ) / / 10x10 okno
(
for (v = c-5, v <c = 5; v )
(

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

Vy [r] [c] = Vy [r] [c] ((gx [v] * gx [v]) * (gy [v] * gy [v ]));
)
)if (Vx [r] [c] == 0)
(
thetaQ [r] [c] = 90;
)
jiné
(
thetaQ [r] [c] = (0.5 * (atan (Vy [r] [c]) / (Vx [r] [c ])));
)
)
)

/ * RIDGE PERIODICITOU ODHAD * /
/ / předpokládat, průměrná vzdálenost mezi hřeben se 3, takže 1 / 3 = 0,33 = f

/ * 2D GABOR FILTROVÁNÍ v prostorových SPACE * /
for (x = 0; x <R; x )
(
for (y = 0, y <C; y )
(
x_theta = (x * cos (thetaQ [x] [y ])) ( y * sin (thetaQ [x] [y]));
y_theta =- (x * sin (thetaQ [x] [y ])) ( y * cos (thetaQ [x] [y]));

/ / SMODCH.VÝBĚR = 4
chrámu = (-1.0/2.0 )*((( x_theta * x_theta) / (16 )) (( y_theta * y_theta) / (16)));

/ / Gabor v prostorové doméně
Gabor [x] [y] = exp (chrám) * cos (2 * 3,14 * 0,33 * x_theta);
)
)

/ / vinout se prostorově obraz s filtrem dostat lepší obraz

for (x = 0; x <R; x )
(
for (y = 0, y <C; y )
(
treten = 0;
for (i = x-5; i <x 6; i )
(
for (j = y-5, j <y 6 j )
(

treten = (Gabor [j] * imag [j]);

)
)

(image-> imageData image-> widthStep * y) [x] = treten;)
)
)

 
Według danych przedstawionych przez SquareTrade, ekran stosowany w iPhonie 4 jest gorszej jakości pod względem technologicznym niż ten stosowany w modelu 3GS.

Read more...
 
V těchto kód, najdu jednu chybu: mimo rozsah pole obrazu Sobel smyčce.To je smyčka
for (r = 0, r <R, r )
(
for (c = 0, c <C, C )
(
/ / Sklony a gx 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);

když r = 0 pak obrázek [-1] [] není platný.
nebo-li c = 0 pak obrázek [] [-1] není platná;

jsi dokončit svůj projekt?
Dělám projekt, který je zapojen do Gabor filtru.A já cvičení OpenCV kódu.
Můžete mi poslat tuto dokončena kódy?
Můj mail: jackyhung12345 (at) yahoo.com.
Čeká na svou poštu.
Díky moc.

 

Welcome to EDABoard.com

Sponsor

Back
Top