forked from e-radu/irisRec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsegIris.c~
54 lines (46 loc) · 1.46 KB
/
segIris.c~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "utils.h"
u8_int initSeg(IRISCONFIG* s)
{
s->seg_st->outPattern = (u8_int*)malloc(s->seg_st->radNo * P_WIDTH);
return 1;
}
u8_int runSeg(IRISCONFIG* s)
{
u8_int i;
u16_int j;
u16_int x,y;
u16_int xCenter, yCenter;
s32_float theta[P_WIDTH];
theta[0] = 0;
for(j = 1; j < P_WIDTH; j++)
{
theta[j] = theta[j - 1] + PI/(P_WIDTH>>1);
}
//check for center alignment
if(abs(s->hough_st->maxCoord[0].x - s->hough_st->maxCoord[1].x) > 10)
return -1;
if(abs(s->hough_st->maxCoord[0].y - s->hough_st->maxCoord[1].y) > 10)
return -1;
xCenter = (s->hough_st->maxCoord[0].x + s->hough_st->maxCoord[1].x)>>1;
yCenter = (s->hough_st->maxCoord[0].y + s->hough_st->maxCoord[1].y)>>1;
//check for out of bounds
if(!lim(xCenter, s->seg_st->radNo + 1, s->width - s->seg_st->radNo - 1))
return -1;
if(!lim(yCenter, s->seg_st->radNo + 1, s->height - s->seg_st->radNo -1))
return -1;
for(i = 0; i < s->seg_st->radNo; i++)
{
for(j = 0; j < P_WIDTH; j++)
{
x = ((s->hough_st->maxCoord[0].rad + i)*cos(theta[j])) + yCenter;
y = ((s->hough_st->maxCoord[0].rad + i)*sin(theta[j])) + xCenter;
s->seg_st->outPattern[P_WIDTH * i + j] = s->frame[s->width * y + x];
}
}
return 1;
}
u8_int freeSeg(IRISCONFIG* s)
{
free(s->seg_st->outPattern);
return 1;
}