|
|
@ -39,7 +39,7 @@ using namespace std; |
|
|
|
static inline cv::Point2f centerRect(const cv::Rect& r) |
|
|
|
static inline cv::Point2f centerRect(const cv::Rect& r) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return cv::Point2f(r.x+((float)r.width)/2, r.y+((float)r.height)/2); |
|
|
|
return cv::Point2f(r.x+((float)r.width)/2, r.y+((float)r.height)/2); |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static inline cv::Rect scale_rect(const cv::Rect& r, float scale) |
|
|
|
static inline cv::Rect scale_rect(const cv::Rect& r, float scale) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -50,7 +50,7 @@ static inline cv::Rect scale_rect(const cv::Rect& r, float scale) |
|
|
|
int y=cvRound(m.y - height/2); |
|
|
|
int y=cvRound(m.y - height/2); |
|
|
|
|
|
|
|
|
|
|
|
return cv::Rect(x, y, cvRound(width), cvRound(height)); |
|
|
|
return cv::Rect(x, y, cvRound(width), cvRound(height)); |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
namespace cv |
|
|
|
namespace cv |
|
|
|
{ |
|
|
|
{ |
|
|
@ -66,6 +66,7 @@ class cv::DetectionBasedTracker::SeparateDetectionWork |
|
|
|
bool run(); |
|
|
|
bool run(); |
|
|
|
void stop(); |
|
|
|
void stop(); |
|
|
|
void resetTracking(); |
|
|
|
void resetTracking(); |
|
|
|
|
|
|
|
|
|
|
|
inline bool isWorking() |
|
|
|
inline bool isWorking() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return (stateThread==STATE_THREAD_WORKING_SLEEPING) || (stateThread==STATE_THREAD_WORKING_WITH_IMAGE); |
|
|
|
return (stateThread==STATE_THREAD_WORKING_SLEEPING) || (stateThread==STATE_THREAD_WORKING_WITH_IMAGE); |
|
|
@ -801,6 +802,7 @@ void cv::DetectionBasedTracker::detectInRegion(const Mat& img, const Rect& r, ve |
|
|
|
Rect r0(Point(), img.size()); |
|
|
|
Rect r0(Point(), img.size()); |
|
|
|
Rect r1 = scale_rect(r, innerParameters.coeffTrackingWindowSize); |
|
|
|
Rect r1 = scale_rect(r, innerParameters.coeffTrackingWindowSize); |
|
|
|
r1 = r1 & r0; |
|
|
|
r1 = r1 & r0; |
|
|
|
|
|
|
|
|
|
|
|
if ( (r1.width <=0) || (r1.height <= 0) ) { |
|
|
|
if ( (r1.width <=0) || (r1.height <= 0) ) { |
|
|
|
LOGD("DetectionBasedTracker::detectInRegion: Empty intersection"); |
|
|
|
LOGD("DetectionBasedTracker::detectInRegion: Empty intersection"); |
|
|
|
return; |
|
|
|
return; |
|
|
|