| 83 | } |
| 84 | |
| 85 | void BinaryBitmap::close() |
| 86 | { |
| 87 | if (_cache->matrix) { |
| 88 | auto& matrix = *const_cast<BitMatrix*>(_cache->matrix.get()); |
| 89 | BitMatrix tmp(matrix.width(), matrix.height()); |
| 90 | |
| 91 | // dilate |
| 92 | SumFilter(matrix, tmp, [](int sum) { return (sum > 0 * BitMatrix::SET_V) * BitMatrix::SET_V; }); |
| 93 | // erode |
| 94 | SumFilter(tmp, matrix, [](int sum) { return (sum == 9 * BitMatrix::SET_V) * BitMatrix::SET_V; }); |
| 95 | } |
| 96 | _closed = true; |
| 97 | } |
| 98 | |
| 99 | } // ZXing |
no test coverage detected