Commit f25266ec9d79224d9d7298ae6a5ef051f73a0617

Authored by Scott Klum
1 parent 603f5cc1

Avoid double count

openbr/plugins/imgproc/cropfrommask.cpp
... ... @@ -25,12 +25,10 @@ private:
25 25  
26 26 Mat mask = dst.file.get<Mat>("Mask");
27 27  
28   - const int count = countNonZero(mask);
29   -
30   - if (count > 0) {
31   - Mat indices;
32   - findNonZero(mask,indices);
  28 + Mat indices;
  29 + findNonZero(mask,indices);
33 30  
  31 + if (indices.total() > 0) {
34 32 QList<int> x, y;
35 33 for (size_t i=0; i<indices.total(); i++) {
36 34 x.append(indices.at<Point>(i).x);
... ... @@ -65,6 +63,7 @@ private:
65 63  
66 64 dst.m() = Mat(src.m(), Rect(l, t, r - l + 1, b - t + 1));
67 65 } else {
  66 + // Avoid serializing mask
68 67 dst.file.remove("Mask");
69 68 dst.file.fte = true;
70 69 }
... ...