![]() |
![]() |
00001 /******************************************************************************* 00002 * GX MOTDET header file - v7.2.12 00003 * 00004 * 2002-2015 (c) Adaptive Recognition (https://adaptiverecognition.com) 00005 ******************************************************************************/ 00015 /******************************************************************************/ 00016 #ifndef MOTDET_INCL 00017 #define MOTDET_INCL 00018 /******************************************************************************/ 00019 #include "gxsd.h" 00020 #include "gximage.h" 00021 #include <assert.h> 00022 /******************************************************************************/ 00023 #ifdef GX_NAMESPACES 00024 namespace gx { 00025 #endif 00026 /******************************************************************************/ 00027 #ifdef GX_DOTNET 00028 #pragma unmanaged 00029 #endif 00030 /******************************************************************************/ 00031 #if !defined(GX_SWIGIF) && !defined(GX_MANUAL) /*(*/ 00032 /******************************************************************************/ 00034 enum MOTDET_CALL_CODE { 00035 GX_CALL_MOTDETITERATION = GX_CALL_GROUP_GX_MOTDET 00036 }; 00037 /******************************************************************************/ 00039 struct GX_PARM_MOTDETITERATION { 00040 gxIMAGE *image; 00041 int min_difference; 00042 int max_difference; 00043 int found_x1; 00044 int found_y1; 00045 int found_x2; 00046 int found_y2; 00047 }; 00048 #endif /* GX_SWIGIF GX_MANUAL )*/ 00049 00050 /******************************************************************************/ 00051 #if !defined(NO_GX_FUNCTIONS) && !defined(GX_SWIGIF) 00052 /******************************************************************************/ 00053 00054 /******************************************************************************/ 00058 /******************************************************************************/ 00059 00060 /******************************************************************************/ 00075 inline int gx_motdetiteration(gxHANDLE handle, struct GX_PARM_MOTDETITERATION *parm) { 00076 assert(parm); 00077 return gx_call(handle, GX_CALL_MOTDETITERATION, parm); 00078 } 00079 00080 /******************************************************************************/ 00082 /******************************************************************************/ 00083 00084 #endif 00085 00086 /******************************************************************************/ 00087 #ifdef GX_DOTNET 00088 #pragma managed 00089 #endif 00090 /******************************************************************************/ 00091 00092 /******************************************************************************/ 00093 #ifndef NO_GX_CLASSES 00094 00095 /******************************************************************************/ 00097 GX_CLASS gxMotionDetectorResult { 00098 public: 00099 int min_difference; 00100 int max_difference; 00101 int found_x1; 00102 int found_y1; 00103 int found_x2; 00104 int found_y2; 00107 inline gxMotionDetectorResult() { 00108 min_difference = max_difference = 0; 00109 found_x1 = found_y1 = found_x2 = found_y2 = 0; 00110 } 00111 00113 inline int GetMinDifference(void) GX_CONST { 00114 return min_difference; 00115 } 00117 inline int GetMaxDifference(void) GX_CONST { 00118 return max_difference; 00119 } 00121 inline int GetFoundX1(void) GX_CONST { 00122 return found_x1; 00123 } 00125 inline int GetFoundY1(void) GX_CONST { 00126 return found_y1; 00127 } 00129 inline int GetFoundX2(void) GX_CONST { 00130 return found_x2; 00131 } 00133 inline int GetFoundY2(void) GX_CONST { 00134 return found_y2; 00135 } 00136 }; 00137 /******************************************************************************/ 00139 GX_CLASS gxMotionDetector : public gxHandle { 00140 public: 00142 inline gxMotionDetector() gxFuncThrowsError { 00143 #ifndef GX_DOTNET 00144 if(!gx_openmodule(this, L"gxmotdet", L"default")) gxthrow; 00145 #else 00146 GX_GETHANDLE(h); 00147 if(!gx_openmodule(&h, L"gxmotdet", L"default")) gxthrow; 00148 _set_handle(h.handle); 00149 #endif 00150 } 00151 00152 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET) 00153 00159 inline gxMotionDetector(const wchar_t *propname, const wchar_t *modname = (const wchar_t *)0) gxFuncThrowsError { 00160 if(!gx_openmodule(this, modname ? modname : L"gxmotdet", propname)) gxthrow; 00161 } 00162 00168 inline gxMotionDetector(const char *propname, const char *modname = (const char *)0) gxFuncThrowsError { 00169 if(!gx_openmodule(this, modname ? modname : "gxmotdet", propname)) gxthrow; 00170 } 00171 #endif 00172 00173 #ifdef GX_UNICODE 00174 00179 inline gxMotionDetector(gxInStr propname, gxInStr modname) gxFuncThrowsError { 00180 GX_GETSTRING(_propname, propname); 00181 GX_GETSTRING(_modname, modname); 00182 #ifndef GX_DOTNET 00183 if(!gx_openmodule(this, _modname, _propname)) gxthrow; 00184 #else 00185 GX_GETHANDLE(h); 00186 if(!gx_openmodule(&h, _modname, _propname)) gxthrow; 00187 _set_handle(h.handle); 00188 #endif 00189 } 00190 00195 inline gxMotionDetector(gxInStr propname) gxFuncThrowsError { 00196 GX_GETSTRING(_propname, propname); 00197 #ifndef GX_DOTNET 00198 if(!gx_openmodule(this, L"gxmotdet", _propname)) gxthrow; 00199 #else 00200 GX_GETHANDLE(h); 00201 if(!gx_openmodule(&h, L"gxmotdet", _propname)) gxthrow; 00202 _set_handle(h.handle); 00203 #endif 00204 } 00205 #endif 00206 00207 #ifdef GX_ASCII 00208 00213 inline gxMotionDetector(gxInAStr propname, gxInAStr modname) gxFuncThrowsError { 00214 GX_GETASTRING(_propname, propname); 00215 GX_GETASTRING(_modname, modname); 00216 if(!gx_openmodule(this, _modname, _propname)) gxthrow; 00217 } 00218 00223 inline gxMotionDetector(gxInAStr propname) gxFuncThrowsError { 00224 GX_GETASTRING(_propname, propname); 00225 if(!gx_openmodule(this, "gxmotdet", _propname)) gxthrow; 00226 } 00227 #endif 00228 00229 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET) 00230 00245 inline bool Iteration(gxIMAGE *image, int *max_difference) gxFuncThrowsError { 00246 GX_PARM_MOTDETITERATION parm; 00247 parm.image = image; 00248 bool st = gx_motdetiteration(*this, &parm) ? true : false; 00249 if(st) { 00250 if(max_difference) *max_difference = parm.max_difference; 00251 } else { 00252 gxthrow; 00253 } 00254 return st; 00255 } 00256 00270 inline int Iteration(gxIMAGE *image) gxFuncThrowsError { 00271 int ret = -1; 00272 Iteration(image, &ret); 00273 return ret; 00274 } 00275 #endif 00276 00290 inline int Iteration(gxImageData GX_REF_CLASS(image)) gxFuncThrowsError { 00291 GX_PARM_MOTDETITERATION parm; 00292 GX_GETHANDLE(h); 00293 #ifndef GX_DOTNET 00294 parm.image = image; 00295 #else 00296 parm.image = (gxIMAGE *)image GX_M _get_image().ToPointer(); 00297 #endif 00298 if(gx_motdetiteration(h, &parm)) return parm.max_difference; 00299 gxthrow; 00300 return -1; 00301 } 00302 00316 inline int Iteration(gxImage GX_REF_CLASS(image)) gxFuncThrowsError { 00317 GX_PARM_MOTDETITERATION parm; 00318 GX_GETHANDLE(h); 00319 #ifndef GX_DOTNET 00320 parm.image = image; 00321 #else 00322 parm.image = (gxIMAGE *)image GX_M _get_image().ToPointer(); 00323 #endif 00324 if(gx_motdetiteration(h, &parm)) return parm.max_difference; 00325 gxthrow; 00326 return -1; 00327 } 00328 00329 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET) 00330 00366 inline bool Iteration(gxIMAGE *image, int *max_difference, int *min_difference, 00367 int *found_x1, int *found_y1, int *found_x2, int *found_y2) gxFuncThrowsError { 00368 00369 GX_PARM_MOTDETITERATION parm; 00370 parm.image = image; 00371 int st = gx_motdetiteration(*this, &parm); 00372 if(!st) { 00373 gxthrow; 00374 return false; 00375 } 00376 if(max_difference) *max_difference = parm.max_difference; 00377 if(min_difference) *min_difference = parm.min_difference; 00378 if(found_x1) *found_x1 = parm.found_x1; 00379 if(found_y1) *found_y1 = parm.found_y1; 00380 if(found_x2) *found_x2 = parm.found_x2; 00381 if(found_y2) *found_y2 = parm.found_y2; 00382 return true; 00383 } 00384 00398 inline bool Iteration(gxIMAGE *image, gxMotionDetectorResult &result) gxFuncThrowsError { 00399 GX_PARM_MOTDETITERATION parm; 00400 parm.image = image; 00401 int st = gx_motdetiteration(*this, &parm); 00402 if(!st) { 00403 gxthrow; 00404 return false; 00405 } 00406 result.max_difference = parm.max_difference; 00407 result.min_difference = parm.min_difference; 00408 result.found_x1 = parm.found_x1; 00409 result.found_y1 = parm.found_y1; 00410 result.found_x2 = parm.found_x2; 00411 result.found_y2 = parm.found_y2; 00412 return true; 00413 } 00414 #endif 00415 00429 inline bool Iteration(gxImageData GX_REF_CLASS(image), gxMotionDetectorResult GX_REF_CLASS(result)) gxFuncThrowsError { 00430 GX_PARM_MOTDETITERATION parm; 00431 GX_GETHANDLE(h); 00432 #ifndef GX_DOTNET 00433 parm.image = image; 00434 #else 00435 parm.image = (gxIMAGE *)image GX_M _get_image().ToPointer(); 00436 #endif 00437 int st = gx_motdetiteration(h, &parm); 00438 if(!st) { 00439 gxthrow; 00440 return false; 00441 } 00442 result GX_M max_difference = parm.max_difference; 00443 result GX_M min_difference = parm.min_difference; 00444 result GX_M found_x1 = parm.found_x1; 00445 result GX_M found_y1 = parm.found_y1; 00446 result GX_M found_x2 = parm.found_x2; 00447 result GX_M found_y2 = parm.found_y2; 00448 return true; 00449 } 00450 00464 inline bool Iteration(gxImage GX_REF_CLASS(image), gxMotionDetectorResult GX_REF_CLASS(result)) gxFuncThrowsError { 00465 GX_PARM_MOTDETITERATION parm; 00466 GX_GETHANDLE(h); 00467 #ifndef GX_DOTNET 00468 parm.image = image; 00469 #else 00470 parm.image = (gxIMAGE *)image GX_M _get_image().ToPointer(); 00471 #endif 00472 int st = gx_motdetiteration(h, &parm); 00473 if(!st) { 00474 gxthrow; 00475 return false; 00476 } 00477 result GX_M max_difference = parm.max_difference; 00478 result GX_M min_difference = parm.min_difference; 00479 result GX_M found_x1 = parm.found_x1; 00480 result GX_M found_y1 = parm.found_y1; 00481 result GX_M found_x2 = parm.found_x2; 00482 result GX_M found_y2 = parm.found_y2; 00483 return true; 00484 } 00485 }; 00486 /******************************************************************************/ 00487 #endif // NO_GX_CLASSES 00488 /******************************************************************************/ 00489 #ifdef GX_NAMESPACES 00490 } 00491 #endif 00492 /******************************************************************************/ 00493 #endif // MOTDET_INCL 00494 /******************************************************************************/