From 9cbe722e913b5d2c896339986ad3fb5a6e174f18 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Wed, 17 Apr 2013 18:30:31 -0400 Subject: [PATCH] NEC bug fix --- openbr/plugins/neclatent1.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openbr/plugins/neclatent1.cpp b/openbr/plugins/neclatent1.cpp index 525fe9d..ea7b741 100644 --- a/openbr/plugins/neclatent1.cpp +++ b/openbr/plugins/neclatent1.cpp @@ -1,6 +1,7 @@ -#include "openbr_internal.h" #include +#include "openbr_internal.h" + // Necessary to allocate a large memory though the actual template size may be much smaller #define MAX_TEMPLATE_SIZE 400000 @@ -60,9 +61,9 @@ private: uchar *data = src.m().data; const int rows = src.m().rows; const int columns = src.m().cols; + uchar buff[MAX_TEMPLATE_SIZE]; uchar* pBuff = NULL; - int size, error; if (latent) { if (algorithm == LFML) error = NEC_LFML_ExtractLatent(data, rows, columns, 500, buff, &size); @@ -76,7 +77,7 @@ private: if (!error) { cv::Mat n(1, size, CV_8UC1); - memcpy(n.data, buff, size); + memcpy(n.data, pBuff ? pBuff : buff, size); dst.m() = n; } else { qWarning("NECLatent1EnrollTransform error %d for file %s.", error, qPrintable(src.file.flat())); -- libgit2 0.21.4