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