From 60221e364fdee66c3ec7c3d58f87e587f8efc0ca Mon Sep 17 00:00:00 2001 From: Steffen Pohle Date: Sat, 30 Oct 2021 00:28:15 +0200 Subject: [PATCH] export detmatrix out of thread --- detect.cc | 3 +++ gui.cc | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/detect.cc b/detect.cc index e04f1bf..15615f3 100644 --- a/detect.cc +++ b/detect.cc @@ -76,6 +76,7 @@ void Detect::Thread() { objectX = -1; objectY = -1; + output.detmatrix = malloc (sizeof(uint32_t) * DET_MAXSHIFT * DET_MAXSHIFT); while (running) { // check for new frame @@ -126,6 +127,7 @@ void Detect::Thread() { output.posx = objectX; output.posy = objectY; output.image = &imagegtk; + memcpy (output.detmatrix, detmatrix, sizeof(uint32_t) * DET_MAXSHIFT * DET_MAXSHIFT); UnLockMutex(); // unlock Config @@ -136,6 +138,7 @@ void Detect::Thread() { usleep (10000); } + free (output.detmatrix); } diff --git a/gui.cc b/gui.cc index 8dcdfc9..ea840e2 100644 --- a/gui.cc +++ b/gui.cc @@ -174,6 +174,10 @@ gboolean cb_thread_detect (gpointer data) { gdk_window_invalidate_rect(gtk_widget_get_window(detect_da), NULL, true); filter.NewFrame(dout->image, dout->posx, dout->posy); + // + // matrix values + + detect.UnLockImageMutex(); //