DSPRelated.com
Forums

Pattern recognition on DSK 6711

Started by u881418 June 6, 2005
Hi!
I used the DSK 6711 to deal with the pattern recognition and classify
it into two features. The algorithm of pattern recognition includes
median filtering, low pass filtering, and connected commponent labeling
etc.
Furthermore I also use an interupt to make RTDX, deriving an image to
do pattern recognition by the video daughter board of enfochips, and
setting -o2 and Speed Most critical of build option.
When I do the pattern recognition, I found it takes more the 20 seconds
to finish the whole process.
Is that normal?
Is there any other way to speed up the whole procession?
Please kindly provide me some suggestion.
Thank you very much.


hi:
Sorry for not clarifing my problem.
This is my cmd file
-c
-heap 0x1000
-l rts6700.lib
-l csl6711.lib
-l I2cDrv67xx.lib
-l vDriver67xx.lib

_HWI_Cache_Control = 0;

_RTDX_interrupt_mask = ~0x000001808;

MEMORY
{
VECS: o = 0x00000000 l = 0x00000200
IRAM: o = 0x00000200 l = 0x00020000
SDRAM: o = 0x80000000 l = 0x10000000
}

SECTIONS
{
.text > IRAM
.stack > IRAM
.cinit > SDRAM
.bss > SDRAM
.const > SDRAM
.data > SDRAM
.switch > SDRAM
.sysmem > SDRAM
.cio > SDRAM
vecs > VECS
.rtdx_text > SDRAM
.rtdx_data > SDRAM

imem : > SDRAM
emem : > SDRAM
}

I didn't use the dsp library to acheive the lowpass filtering
algorithm.
First, i got 1D image data from the video daughter borad ,and then i
transfered 1D data to 2D array.The 2D array is 640 *480.
I wrote the lowpass filtering , median filtering and connected
component labeling in the C language.

My lopass filtering(3*3):
for(y = (wy/2); y < H-(wy/2); y++)
for(x = (wx/2); x < W-(wx/2); x++)
{
sum=0;

//coefficient of filter is [1,1,1]
// [1,1,1]
// [1,1,1]

for(j = -(wy/2); j < (wy/2)+1; j++)
for(i = -(wx/2); i < (wx/2)+1; i++)
sum += Temp[y+j][x+i];

sum = sum / ( wx * wy );
Object[y][x] = sum;

}

I used the bubble sorting method to acheive the median filtering
algorithm(3*3):
int median_3(
int a0,int a1,int a2,
int a3,int a4,int a5,
int a6,int a7,int a8 )
{

int x[9];
int temp;

x[0] = a0; x[1] = a1; x[2] = a2;
x[3] = a3; x[4] = a4; x[5] = a5;
x[6] = a6; x[7] = a7; x[8] = a8;

//bubble sort
for( i=0; i<9; i++ )
{
for( j=i; j<9; j++ )
{
if( x[i]>x[j] )
{
temp = x[i];
x[i]=x[j];
x[j]=temp;
}
}
}

return x[4];
}
My connected component labeling algorithm is N-4.
I used a block of external memory to replace stack.

if( (x-1)>=0 && (x-1)< W && y>=0 && y<H )
if( Temp[y][x-1] == c ) //c is the bright point
{

//Push Stack
mp = &MarkFill_Stack[ MarkFill_Stack_Index ];
MarkFill_Stack_Index++; mp->x = x-1;
mp->y = y;

//mark_components_fill( p, x-1, y, c, mark );
continue;
}

if( (x+1)>=0 && (x+1)< W && y>=0 && y<H )
if( Temp[y][x+1] == c )
{
//Push Stack
mp = &MarkFill_Stack[ MarkFill_Stack_Index ];
MarkFill_Stack_Index++; mp->x = x+1;
mp->y = y; //mark_components_fill( p, x+1, y, c, mark );
continue;
} if( x>=0 && x< W && (y-1)>=0 && (y-1)<H )
if( Temp[y-1][x] == c )
{
//Push Stack
mp = &MarkFill_Stack[ MarkFill_Stack_Index ];
MarkFill_Stack_Index++; mp->x = x;
mp->y = y-1; //mark_components_fill( p, x, y-1, c, mark );
continue;
} if( x>=0 && x< W && (y+1)>=0 && (y+1)<H )
if( Temp[y+1][x] == c )
{
//Push Stack
mp = &MarkFill_Stack[ MarkFill_Stack_Index ];
MarkFill_Stack_Index++;

mp->x = x;
mp->y = y+1;

//mark_components_fill( p, x, y+1, c, mark );
continue;
}
//Pop Stack
MarkFill_Stack_Index--;
I didn't enable cache in my bios settings because I didn't use the
bios setting.
Thanks for your great suggestion.
Please kindly provide me your valuable advise.

Best Regards/