資源簡介
根據第五章 跌倒檢測算法剖析http://blog.csdn.net/baolinq/article/details/52400040,寫的跌到檢測源碼函數,大家可以參考一下,有問題歡迎一起交流學習。本系列其他文章http://blog.csdn.net/baolinq/article/details/52422206
代碼片段和文件信息
//檢測程序
void?CBodyBasics::Detection(Joint?joints[])
{
static?double?tin?tout;
//double?tframe;
//計算每相鄰10幀的高度差,從而計算速度,1111222
//大概30幀每秒,那么10幀就是0.33秒,
if?(framenumber?%?11?==?1) //framenumber是幀序列號,自己定義的
{
tin?=?static_cast(GetTickCount());
//cout?<“tin是“?< SpineHeightin?=?joints[JointType_SpineMid].Position.Y;
//cout?<“當前幀號為:“?< //cout?<“當前SpineHeightin的高度為“?< }
if?(!(framenumber?%?11))
{
tout?=?static_cast(GetTickCount());
//cout?< //cout?<<“tout是“< //cout?<“每10幀計算一次下降的速度“?< SpineHeightout?=?joints[JointType_SpineMid].Position.Y;
//cout?<“當前幀號為:“?< //??cout?<“***********************************“?< //??cout?<“當前SpineHeightin的高度為“?< //tframe?=?(tout?-?tin)?/?getTickFrequency();
//?cout?<ame?< //??cout?< //cout?<“當前SpineHeightout的高度為“?< //SpineV?=?(SpineHeightin?-?SpineHeightout)?/?tframe;
SpineV?=?SpineHeightin?-?SpineHeightout;
//cout?<“SpineV是多少??“?< if?((SpineV)?>?0.35) //文獻中給定的數據是1.35m/s,這個可能要根據實際情況略有調整
{
vDetection?=?true;
stringstream?stream0;
string?str?str1;
stream0?< stream0?>>?str;
str1?=?“身體中心向下的速度是:?“?+?str?+?“?m/s\r\n“;
//CString?cstr?=
- 上一篇:ftp的C++源碼實現,可以進行文件傳輸
- 下一篇:KCF跟蹤算法c++
評論
共有 條評論