车库元素是今年赛道元素新增的元素。车库赛道元素是在起跑线旁设置的方形区域,它的尺寸如下图所示: 因为时间紧迫,这里采用最简单的入车库(左入)斑马线识别方法: 代码: 由于入库图像与环岛入环图像较为相似,入车库判断函数的优先级需要高于入环判断函数。 拉线分为4个阶段: 目前最稳定的方法为直接控制出库。车库元素一览
车模出发是从车库驶出,在运行一周之后在驶入车库内。比赛时间是从车模驶出车库和返回车库之间的时间差计算。因此计时线圈是放置在车库门口处。赛道上的斑马线和斑马线下的磁铁放置与往届规则相同。
车库应用于“基础四轮组”,“直立节能组”,“双车接力组”。入车库
20cm摄像头拍下的车库图
起跑线的识别
byte Garage_Judge(byte i) { byte y = 0, x = 0, count = 0, pixel_cnt = 0, zebraWidth = 0; //左边车库 if (i == 0) { for (OlRow = LeftLine_1.Agl_Row; OlRow <= LeftLine_1.Agl_Row + 20; OlRow++) { for (OlLine = (byte)(LeftLine_1.Agl_Line - 5); OlLine >= 93; OlLine--) { //SetText_1("Zerba Scan :"+ OlRow+" "+ OlLine); if (J_Pixels[OlRow][OlLine] == white && J_Pixels[OlRow][OlLine - 1] == black) { y = (byte)(OlRow + 3); //x = (byte)(OlLine-1); SetText_1("Find Zebra Point: " + y + " " + OlLine); break; } } if (y != 0) break; } if (y == 0) { SetText_1("Lost Zebra Point"); return 0; } for (x = LeftLine_1.Agl_Line; x >= 185 - LeftLine_1.Agl_Line; x--) { if (J_Pixels[y][x + 1] == white && J_Pixels[y][x] == black) { //SetText_1("Zebra Scan Start: " + y + " " + x); pixel_cnt = 1; } else if (J_Pixels[y][x + 1] == black && J_Pixels[y][x] == black) { //SetText_1("Zebra Add: " + y + " " + x); pixel_cnt++; } else if (J_Pixels[y][x + 1] == black && J_Pixels[y][x] == white) { if (count == 0 && pixel_cnt >= 3 && pixel_cnt <= 10) { zebraWidth = pixel_cnt; SetText_1("zebraWidth = " + zebraWidth); SetText_1("zebraStart Point: " + x + " " + y); count = 1; } else if (count > 0 && my_fabs(pixel_cnt - zebraWidth) <= 4) { //SetText_1("Zebra End: " + y + " " + (x - 1)); count++; } else { // SetText_1("Zebra Error: " + y + " " + (x - 1)); } } } SetText_1("Zebra Count = " + count); if (count >= 6) { SetText_1("Proved to be Garage"); return 1; } else { SetText_1("Not Proved to be Garage"); return 0; } } else //右边车库 { for (OlRow = RightLine_1.Agl_Row; OlRow <= RightLine_1.Agl_Row + 20; OlRow++) { for (OlLine = (byte)(RightLine_1.Agl_Line + 5); OlLine <= 93; OlLine++) { //SetText_1("Zerba Scan :"+ OlRow+" "+ OlLine); if (J_Pixels[OlRow][OlLine] == black && J_Pixels[OlRow][OlLine - 1] == white) { y = (byte)(OlRow + 3); //x = (byte)(OlLine-1); SetText_1("Find Zebra Point: " + y + " " + OlLine); break; } } if (y != 0) break; } if (y == 0) { SetText_1("Lost Zebra Point"); return 0; } for (x = RightLine_1.Agl_Line; x <= 185 - RightLine_1.Agl_Line; x++) { if (J_Pixels[y][x - 1] == white && J_Pixels[y][x] == black) { //SetText_1("Zebra Scan Start: " + y + " " + x); pixel_cnt = 1; } else if (J_Pixels[y][x - 1] == black && J_Pixels[y][x] == black) { //SetText_1("Zebra Add: " + y + " " + x); pixel_cnt++; } else if (J_Pixels[y][x - 1] == black && J_Pixels[y][x] == white) { if (count == 0 && pixel_cnt >= 3 && pixel_cnt <= 10) { zebraWidth = pixel_cnt; SetText_1("zebraWidth = " + zebraWidth); SetText_1("zebraStart Point: " + x + " " + y); count = 1; } else if (count > 0 && my_fabs(pixel_cnt - zebraWidth) <= 4) { //SetText_1("Zebra End: " + y + " " + (x - 1)); count++; } else { // SetText_1("Zebra Error: " + y + " " + (x - 1)); } } } SetText_1("Zebra Count = " + count); if (count >= 6) { SetText_1("Proved to be Garage"); return 1; } else { SetText_1("Not Proved to be Garage"); return 0; } } }
实践证明,识别成功率很高。入车库的拉线
出车库
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算