|
|
|
@ -93,23 +93,11 @@ void Detect::Thread() {
|
|
|
|
|
LockMutex(); // lock Config
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// 1. if no position of the object is known, search brightest
|
|
|
|
|
// object on the inFrame image.
|
|
|
|
|
if (objectX < objectW/2 || objectX > (inFrame.w-objectW/2) ||
|
|
|
|
|
objectY < objectH/2 || objectY > (inFrame.h-objectH/2))
|
|
|
|
|
{
|
|
|
|
|
switch (autodetecttype) {
|
|
|
|
|
case AUTODETECT_BRIGHT:
|
|
|
|
|
InputDetect(&objectX, &objectY);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 1. check near the last known position.
|
|
|
|
|
//
|
|
|
|
|
// 2. check near the last known position.
|
|
|
|
|
//
|
|
|
|
|
else {
|
|
|
|
|
if (objectX >= objectW/2 && objectX <= (inFrame.w-objectW/2) &&
|
|
|
|
|
objectY >= objectH/2 && objectY <= (inFrame.h-objectH/2))
|
|
|
|
|
{
|
|
|
|
|
switch (autofollowtype) {
|
|
|
|
|
case AUTOFOLLOW_BRIGHT:
|
|
|
|
|
InputDetect(&objectX, &objectY);
|
|
|
|
@ -127,6 +115,21 @@ void Detect::Thread() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// 2. if no position of the object is known, search brightest
|
|
|
|
|
// object on the inFrame image.
|
|
|
|
|
if (objectX < objectW/2 || objectX > (inFrame.w-objectW/2) ||
|
|
|
|
|
objectY < objectH/2 || objectY > (inFrame.h-objectH/2))
|
|
|
|
|
{
|
|
|
|
|
switch (autodetecttype) {
|
|
|
|
|
case AUTODETECT_BRIGHT:
|
|
|
|
|
InputDetect(&objectX, &objectY);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oldFrame.CopyFrom(&inFrame);
|
|
|
|
|
UnLockInMutex();
|
|
|
|
|
|
|
|
|
@ -225,6 +228,8 @@ void Detect::InputDetect(int *posx, int *posy) {
|
|
|
|
|
didx = 3* (image.w * dy + dx);
|
|
|
|
|
for (i = 0; i < 3; i++) pxi[didx+i] = pxs[idx+i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* returns approx. 8-bit gray value */
|
|
|
|
@ -320,6 +325,7 @@ void Detect::InputDetectCrossC(int *posx, int *posy) {
|
|
|
|
|
*posx += (mxx-DET_MAXSHIFT/2);
|
|
|
|
|
*posy += (mxy-DET_MAXSHIFT/2);
|
|
|
|
|
CopyObjectImage (*posx, *posy);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|