diff --git a/detect.cc b/detect.cc index b08ed3f..7396cc5 100644 --- a/detect.cc +++ b/detect.cc @@ -76,7 +76,7 @@ void Detect::Thread() { objectX = -1; objectY = -1; - output.detmatrix = malloc (sizeof(uint32_t) * DET_MAXSHIFT * DET_MAXSHIFT); + output.detmatrix = (uint32_t*)malloc (sizeof(uint32_t) * DET_MAXSHIFT * DET_MAXSHIFT); while (running) { // check for new frame @@ -127,7 +127,8 @@ void Detect::Thread() { output.posx = objectX; output.posy = objectY; output.image = &imagegtk; - memcpy (output.detmatrix, detmatrix, sizeof(uint32_t) * DET_MAXSHIFT * DET_MAXSHIFT); + if (detmatrix != NULL) + memcpy (output.detmatrix, detmatrix, sizeof(uint32_t) * DET_MAXSHIFT * DET_MAXSHIFT); UnLockMutex(); // unlock Config diff --git a/detect.h b/detect.h index 2ce8da2..ee90f8f 100644 --- a/detect.h +++ b/detect.h @@ -29,7 +29,7 @@ enum { struct { VideoFrame *image; // detected image - uint16_t *detmatrix; + uint32_t *detmatrix; int posx; // position of the detected object int posy; // position of the detected object } typedef DetectOutput;