金牌会员
- 积分
- 1642
- 威望
- 767
- 贡献
- 557
- 兑换币
- 9
- 注册时间
- 2012-2-26
- 在线时间
- 159 小时
|
8#
楼主 |
发表于 2012-6-4 23:01:15
|
只看该作者
赵仁煊 发表于 2012-6-4 21:07
弯道的中心线怎么提取的,来点互动撒!
void road_hei_line() {
char i=0;
char left_line=0,left_flag=0,right_flag=0,right_line=0;
//unsigned char hei_left=0,hei_right=0;
// unsigned char hei_num_flag=0,change_flag=0;
// sci_write('3');
for(q=8;q<hang-5;q++) { //′óμú8DD¿aê¼
left_flag=0;
right_flag=0;
//×ó±ßμÄoúÏßÖDDÄ
for(i=car_location;i>=18;i--) { //×ó±ß20DDéáè¥
if(q==8||q==9) {
if(data[q]-data[q][i-1]>0) {
left_flag++;
if(data[q+1]==0||data[q+1][i+1]==0||data[q+1][i+2]==0) {
if(data[q+2][i+1]==0||data[q+2][i+2]==0||data[q+2][i+3]==0){
left_line=i-1;
left_line_location[q]=left_line;
}
else
left_line_location[q]=-1;
} else
left_line_location[q]=-1;
}
if(left_flag==0)
left_line_location[q]=-1;
}
if(q>9) {
if(data[q]-data[q][i-1]>0) {
left_flag++;
if(data[q-1][i-2]==0||data[q-1][i-1]==0||data[q-1]==0) {
if(data[q-2][i-3]==0||data[q-2][i-2]==0||data[q-2][i-1]==0) {
left_line=i-1;
left_line_location[q]=left_line;
}
else
left_line_location[q]=-1;
}else
left_line_location[q]=-1;
}
if(left_flag==0)
left_line_location[q]=-1;
}
}
// sci_write('4');
//óò±ßμÄoúÏßÖDDÄ
for(i=car_location;i<dian-7;i++) {
if(q==8||q==9) {
if(data[q]-data[q][i+1]>0) {
right_flag++;
if(data[q+1][i-2]==0||data[q+1][i-1]==0||data[q+1]==0) {
if(data[q+2][i-3]==0||data[q+2][i-2]==0||data[q+2][i-1]==0) {
right_line=i+1;
right_line_location[q]=right_line;
}
else
right_line_location[q]=-1;
} else
right_line_location[q]=-1;
}
if(right_flag==0)
right_line_location[q]=-1;
}
if(q>9) {
if(data[q]-data[q][i+1]>0) {
right_flag++;
if(data[q-1]==0||data[q-1][i+1]==0||data[q-1][i+2]==0) {
if(data[q-2][i+1]==0||data[q-2][i+2]==0||data[q-2][i+3]==0) {
right_line=i+1;
right_line_location[q]=right_line;
}
else
right_line_location[q]=-1;
}else
right_line_location[q]=-1;
}
if(right_flag==0)
right_line_location[q]=-1;
}
}
if(right_line_location[q]!=-1&&left_line_location[q]!=-1)
zhong_xian[q]=(right_line_location[q]+left_line_location[q])/2;
else
zhong_xian[q]=zhong_xian[q-1];
}
/*for(a=8;a<hang-5;a++) {
sci_write(zhong_xian[a]);
} */
}
这个只是初步的,可以用(根据我们的硬件),提取的比较粗糙...还要改进...
|
|