OpenCV-cvBlob
请解释以下代码:OpenCV-cvBlob,opencv,blob,Opencv,Blob,请解释以下代码: struct CvTrack { CvID id; ///< Track identification number. CvLabel label; ///< Label assigned to the blob related to this track. unsigned int minx; ///< X min. unsigned int maxx; ///< X max. unsigned int min
struct CvTrack
{
CvID id; ///< Track identification number.
CvLabel label; ///< Label assigned to the blob related to this track.
unsigned int minx; ///< X min.
unsigned int maxx; ///< X max.
unsigned int miny; ///< Y min.
unsigned int maxy; ///< y max.
CvPoint2D64f centroid; ///< Centroid.
unsigned int lifetime; ///< Indicates how much frames the object has been in scene.
unsigned int active; ///< Indicates number of frames that has been active from last inactive period.
unsigned int inactive; ///< Indicates number of frames that has been missing.
unsigned int speed;
};
变量active和inactive的用途是什么?我假设问题是关于对象跟踪的,代码中的注释基本上回答了您的问题 假设你正在跟踪一个粉红色的球在桌子上滚动 Inactive是球被遮挡并对摄影机不可见的帧数 Active是摄影机可以看到球的连续帧数 如果球在当前帧中连续可见并突然变为不可见,则会发生以下情况:
lifetime++;
inactive++;
active = 0;
这将使您更好地了解如何保持被跟踪对象的轨迹。Shan,是什么原因导致此变量增加?是否会使两个对象更接近,并合并为帧中缺少的一个对象,或者当对象未检测到当前帧时的非活动增量…您提到的两种情况都会增加非活动计数。在案例1中:2个球将有2个轨迹,因此如果它合并为一个轨迹,其中一个轨迹将增加非活动变量。这只是案例2的一个特例。当前帧中未检测到跟踪对象时,非活动变量增加。