Skip to content

andyhuzhill/FreescaleImageProcess

Repository files navigation

飞思卡尔智能车竞赛 摄像头组 调试上位机

这个程序是我参加飞思卡尔智能汽车竞赛是用来分析图像数据和调试中线提取算法的工具,使用上位机,可以大大提高调试效率,不需要总是去让小车在跑道上跑。 test

数据格式

由于这个软件,我写了好几个版本,数据的格式也改了好几次,以下做一个简单说明。 介绍图像数据之前,我要介绍一下我使用的摄像头。我们使用的是野火设计的鹰眼摄像头,采用ov7725~cmos芯片,采用硬件二值化,单片机使用DMA采集图像,采集回来的直接就是二值化的图像,每个像素点只有1或0。

FreeScale2

FreeScale2程序使用的数据格式如下: 分辨率为50x50的二值化后的数据,使用50x50的二维数组保存数据。接收到的数据,每个像素点之间用英文逗号‘,’分隔,每一帧图像之间用‘img’分隔。 下面是一个示例数据:

img
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,1,0,1,1,1,1,0,1,1,1,1,0,0,1,1,1,0,1,1,1,1,0,1,1,1,0,0,0,0,0,0,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,0,0,
1,1,0,1,1,1,1,0,0,0,1,1,0,1,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,
1,1,0,1,0,0,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,
0,0,0,1,0,0,0,0,1,1,1,1,0,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,0,
0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,1,1,0,1,1,1,1,0,1,0,
0,0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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

img
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,0,0,0,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,0,0,
1,1,0,1,1,1,1,0,1,1,0,0,0,1,1,1,1,0,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,
...

上位机运行如下图所示

FreeScale2程序还有一个调试电机PID程序的功能。 使用方法就是用串口发回编码器采集回的转速,上位机绘制出曲线图。 下面是几个采集的图像。

FreeScale3

上面那个数据格式需要下位机发送已二值化且存在50x50数组里面的数据,因为每次只发送1或0,比较浪费时间,于是,我改成直接发送摄像头采集回来的一个字节八个像素点的数据,然后用上位机将图像展开成80x60的数组里面。

示例图像数据如下:

img
0,0,0,0,0,0,0,0,0,0,255,255,255,254,31,255,255,255,255,255,255,255,255,248,63,255,255,255,1,255,255,255,255,255,255,254,14,0,0,7,255,255,255,255,240,0,0,0,0,0,255,255,255,255,0,0,0,0,0,0,255,255,255,240,0,0,0,0,7,255,255,255,255,128,0,0,255,255,255,255,255,255,254,0,0,31,255,255,255,255,255,255,248,0,0,127,255,255,255,248,255,255,240,0,0,255,255,255,255,240,255,255,192,0,0,255,255,255,255,240,255,255,128,0,0,255,255,255,255,240,255,255,0,0,0,255,255,255,255,248,255,254,0,0,0,127,255,255,255,248,255,252,0,0,0,63,255,255,255,252,255,252,0,0,0,15,255,255,255,254,255,248,0,0,0,3,255,255,255,255,255,248,0,0,0,0,255,255,255,255,255,248,0,0,0,0,31,255,255,255,255,240,0,0,0,0,7,253,255,255,255,240,0,0,0,0,3,253,255,255,255,240,0,0,0,0,0,255,255,255,255,240,0,0,0,0,0,63,255,255,255,248,0,0,0,0,0,31,255,255,255,248,0,0,0,0,0,7,255,255,255,248,0,0,0,0,0,3,255,255,255,252,0,0,0,0,0,1,255,255,255,252,0,0,0,0,0,0,255,255,255,254,0,0,0,0,0,0,127,255,255,255,0,0,0,0,0,0,63,255,255,255,0,0,0,0,0,0,31,255,255,255,128,0,0,0,0,0,15,255,255,255,192,0,0,0,0,0,7,255,255,255,192,0,0,0,0,0,3,255,255,255,224,0,0,0,0,0,1,255,255,255,224,0,0,0,0,0,0,255,255,255,240,0,0,0,0,0,0,255,255,255,240,0,0,0,0,0,0,127,255,255,240,0,0,0,0,0,0,63,255,255,240,0,0,0,0,0,0,63,255,255,240,0,0,0,0,0,0,31,255,255,248,0,0,0,0,0,0,15,255,255,248,0,0,0,0,0,0,15,255,255,248,0,0,0,0,0,0,7,255,255,248,0,0,0,0,0,0,7,255,255,248,0,0,0,0,0,0,3,255,255,240,0,0,0,0,0,0,3,255,255,240,0,0,0,0,0,0,1,255,255,240,0,0,0,0,0,0,1,255,255,240,0,0,0,0,0,0,1,255,255,240,0,0,0,0,0,0,0,255,255,224,0,0,0,0,0,0,0,255,255,224,0,0,0,0,0,0,0,255,255,224,0,0,0,0,0,0,0,255,255,224,0,0,0,0,0,0,0,255,255,224,0,0,0,0,0,0,0,255,255,192,0,0,0,0,0,0,0,255,255,192,0,0,0,0,0,0,0,255,255,192,0,0,0,0,0,0,0,
img
0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,248,31,255,255,255,255,255,255,255,255,255,255,255,255,248,0,63,255,255,255,255,254,0,0,0,0,0,255,255,255,255,192,0,0,0,0,0,255,255,255,252,0,0,0,0,1,255,255,255,255,224,0,0,0,0,31,255,255,255,255,0,0,7,255,255,255,255,255,255,252,0,0,15,255,255,255,255,255,255,248,0,0,127,255,255,255,248,255,255,224,0,0,255,255,255,255,248,255,255,192,0,0,255,255,255,255,248,255,255,128,0,0,255,255,255,255,248,255,255,0,0,0,255,255,255,255,248,255,254,0,0,0,127,255,255,255,252,255,252,0,0,0,63,255,255,255,254,255,248,0,0,0,31,255,255,255,254,255,248,0,0,0,7,255,255,255,255,255,240,0,0,0,1,255,255,255,255,255,240,0,0,0,0,127,255,255,255,255,240,0,0,0,0,31,253,255,255,255,224,0,0,0,0,7,255,255,255,255,224,0,0,0,0,1,255,255,255,255,224,0,0,0,0,0,127,255,255,255,240,0,0,0,0,0,63,255,255,255,240,0,0,0,0,0,15,255,255,255,240,0,0,0,0,0,7,255,255,255,240,0,0,0,0,0,3,255,255,255,248,0,0,0,0,0,0,255,255,255,248,0,0,0,0,0,0,127,255,255,252,0,0,0,0,0,0,63,255,255,252,0,0,0,0,0,0,31,255,255,254,0,0,0,0,0,0,15,255,255,255,0,0,0,0,0,0,7,255,255,255,0,0,0,0,0,0,3,255,255,255,128,0,0,0,0,0,1,255,255,255,192,0,0,0,0,0,1,255,255,255,192,0,0,0,0,0,0,255,255,255,192,0,0,0,0,0,0,127,255,255,224,0,0,0,0,0,0,63,255,255,224,0,0,0,0,0,0,63,255,255,224,0,0,0,0,0,0,31,255,255,224,0,0,0,0,0,0,31,255,254,240,0,0,0,0,0,0,15,255,255,240,0,0,0,0,0,0,7,255,255,240,0,0,0,0,0,0,7,255,255,240,0,0,0,0,0,0,3,255,255,240,0,0,0,0,0,0,3,255,255,240,0,0,0,0,0,0,1,255,255,240,0,0,0,0,0,0,1,255,255,240,0,0,0,0,0,0,0,255,255,240,0,0,0,0,0,0,0,255,255,224,0,0,0,0,0,0,0,255,255,224,0,0,0,0,0,0,0,255,255,224,0,0,0,0,0,0,0,255,255,224,0,0,0,0,0,0,0,255,255,224,0,0,0,0,0,0,0,255,255,192,0,0,0,0,0,0,0,255,255,192,0,0,0,0,0,0,0,
img

上位机运行如下图所示

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published