| 185 | } |
| 186 | |
| 187 | std::vector<ScanResult> DecodeScheduler::zxingDecode(const cv::Mat& mat) |
| 188 | { |
| 189 | LOGE("start zxing decode") |
| 190 | |
| 191 | ZXing::ImageView imageView(mat.data, mat.cols, mat.rows, ZXing::ImageFormat::Lum); |
| 192 | ZXing::Result result = ZXing::ReadBarcode(imageView, m_formatHints); |
| 193 | if (result.isValid()) { |
| 194 | LOGE("zxing decode success, result data = %s", result.text().c_str()) |
| 195 | std::vector<ScanResult> vector; |
| 196 | |
| 197 | int zxingFormatIndex = static_cast<int>(result.format()); |
| 198 | auto format = static_cast<CodeFormat>(zxingFormatIndex); |
| 199 | |
| 200 | ZXing::Position position = result.position(); |
| 201 | int width = abs(position.bottomRight().x - position.topLeft().x); |
| 202 | int height = abs(position.bottomRight().y - position.topLeft().y); |
| 203 | CodeRect codeRect(position.topLeft().x, position.topLeft().y, width, height); |
| 204 | |
| 205 | ScanResult scanResult(format, result.text(), codeRect); |
| 206 | vector.push_back(scanResult); |
| 207 | return vector; |
| 208 | } |
| 209 | return m_defaultResult; |
| 210 | } |
| 211 | |
| 212 | double DecodeScheduler::detectBrightness(jbyte* bytes, int width, int height) |
| 213 | { |
nothing calls this directly
no test coverage detected