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()));