# sift算法实现图像配准中的小算法问题

0

static void check_dense( CvSeq* features, int* dense_array, unsigned char check_distance[458][501])
{
struct feature* feat;
long row, line, a, b;
int sum;
for(row = 42; row <= 425; row += 31)
for(line = 44; line <= 458; line += 31)
{
if((row - 233) * (row - 233)/400 + (line - 248) * (line - 248)/484 <= 100)
{
sum=0;
for(a = row - 15;a <= row + 15; ++a)
for(b = line - 15;b <= line + 15; ++b)
if(check_distance[a][b] >= 100) sum += check_distance[a][b] - 99;
else sum += check_distance[a][b];
if( sum > 20)//纯绿
{
for(a = row - 15;a <= row + 15; ++a)
for(b = line - 15;b <= line + 15;++b)
if(check_distance[a][b] >= 100)
{
feat = CV_GET_SEQ_ELEM( struct feature, features, *(dense_array + b * 458 + a) );
feat->dense = 4;
}
}
else if( sum > 14)//淡红
{
for(a = row - 15;a <= row + 15; ++a)
for(b = line - 15;b <= line + 15;++b)
if(check_distance[a][b] >= 100)
{
feat = CV_GET_SEQ_ELEM( struct feature, features, *(dense_array + b * 458 + a) );
feat->dense = 3;
}
}
else if( sum > 7)//纯蓝
{
for(a = row - 15;a <= row + 15; ++a)
for(b = line - 15;b <= line + 15;++b)
if(check_distance[a][b] >= 100)
{
feat = CV_GET_SEQ_ELEM( struct feature, features, *(dense_array + b * 458 + a) );
feat->dense = 2;
}
}
else //灰色
{
for(a = row - 15;a <= row + 15; ++a)
for(b = line - 15;b <= line + 15;++b)
if(check_distance[a][b] >= 100)
{
feat = CV_GET_SEQ_ELEM( struct feature, features, *(dense_array + b * 458 + a) );
feat->dense = 1;
}
}
}
}

jamesli1234 | 初学一级 | 园豆：42

您需要登录以后才能回答，未注册用户请先注册