智能车制作
标题:
动态调整阈值的算法
[打印本页]
作者:
Blazar55
时间:
2018-8-5 09:07
标题:
动态调整阈值的算法
大家有没有不同环境下,动态调整小车阈值的算法,能给我发一份么。
作者:
Quixote
时间:
2018-8-5 14:22
本帖最后由 Quixote 于 2018-8-5 14:24 编辑
uint8 perline_aver_pixelNumber = 0;uint8 perline_jump_max2min = 0;uint32 AllPixel_Counter = 0;
uint8 maxPixel = 0;uint8 minPixel = 255;uint8 BookLineNumber = 0;//记录的行数
for (uint16 loop = 0; loop < constNum_X_MaxCounter; loop++)//循环开始
{
if(0 != m_ImageBeholder_Data[y_ctr][loop])
{
BookLineNumber ++;AllPixel_Counter += m_ImageBeholder_Data[y_ctr][loop];
if (m_ImageBeholder_Data[y_ctr][loop] > maxPixel){ maxPixel = m_ImageBeholder_Data[y_ctr][loop]; }
if (m_ImageBeholder_Data[y_ctr][loop] < minPixel){ minPixel = m_ImageBeholder_Data[y_ctr][loop]; }
}
}//计数循环结束
perline_aver_pixelNumber = AllPixel_Counter / BookLineNumber;//均值
perline_jump_max2min = maxPixel - minPixel;//差值
perLine_JumpNumVaild = (uint8)((float)perline_jump_max2min * 0.4f);//两个跳变值
perLine_JumpNumNonVaild = (uint8)((float)perline_aver_pixelNumber * 0.4f);//两个跳变值
sint16 n_jumpVar = m_ImageBeholder_Data[y_ctr][x_startPos] -
m_ImageBeholder_Data[y_ctr - 1][x_startPos];
sint16 absn_jumpVar = __ABS(n_jumpVar);
if ((absn_jumpVar > perLine_JumpNumVaild)&&(absn_jumpVar > perLine_JumpNumNonVaild))
{
if(n_jumpVar < 0)
{
LastSide.Last_BlackLine_suddenlyHappen = y_ctr;//本次是
LastSide.hasHappened_Once = 1;
isMaybefoundShutDown = 1;
//break;这里找到了一个黑点
}
}
作者:
来一杯烈酒
时间:
2018-8-5 21:33
给诸葛大佬顶贴
欢迎光临 智能车制作 (http://111.231.132.190/)
Powered by Discuz! X3.2