Commit 9cbe722e913b5d2c896339986ad3fb5a6e174f18

Authored by Josh Klontz
1 parent 478ad422

NEC bug fix

Showing 1 changed file with 4 additions and 3 deletions
openbr/plugins/neclatent1.cpp
1 -#include "openbr_internal.h"  
2 #include <LatentEFS.h> 1 #include <LatentEFS.h>
3 2
  3 +#include "openbr_internal.h"
  4 +
4 // Necessary to allocate a large memory though the actual template size may be much smaller 5 // Necessary to allocate a large memory though the actual template size may be much smaller
5 #define MAX_TEMPLATE_SIZE 400000 6 #define MAX_TEMPLATE_SIZE 400000
6 7
@@ -60,9 +61,9 @@ private: @@ -60,9 +61,9 @@ private:
60 uchar *data = src.m().data; 61 uchar *data = src.m().data;
61 const int rows = src.m().rows; 62 const int rows = src.m().rows;
62 const int columns = src.m().cols; 63 const int columns = src.m().cols;
  64 +
63 uchar buff[MAX_TEMPLATE_SIZE]; 65 uchar buff[MAX_TEMPLATE_SIZE];
64 uchar* pBuff = NULL; 66 uchar* pBuff = NULL;
65 -  
66 int size, error; 67 int size, error;
67 if (latent) { 68 if (latent) {
68 if (algorithm == LFML) error = NEC_LFML_ExtractLatent(data, rows, columns, 500, buff, &size); 69 if (algorithm == LFML) error = NEC_LFML_ExtractLatent(data, rows, columns, 500, buff, &size);
@@ -76,7 +77,7 @@ private: @@ -76,7 +77,7 @@ private:
76 77
77 if (!error) { 78 if (!error) {
78 cv::Mat n(1, size, CV_8UC1); 79 cv::Mat n(1, size, CV_8UC1);
79 - memcpy(n.data, buff, size); 80 + memcpy(n.data, pBuff ? pBuff : buff, size);
80 dst.m() = n; 81 dst.m() = n;
81 } else { 82 } else {
82 qWarning("NECLatent1EnrollTransform error %d for file %s.", error, qPrintable(src.file.flat())); 83 qWarning("NECLatent1EnrollTransform error %d for file %s.", error, qPrintable(src.file.flat()));