MCPcopy Create free account
hub / github.com/devilsen/CZXing / readByte

Method readByte

czxing/src/main/cpp/DecodeScheduler.cpp:61–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61std::vector<ScanResult>
62DecodeScheduler::readByte(jbyte* bytes, int width, int height)
63{
64 LockGuard locker { m_decodeLock };
65 LOGE("start readByte rowWidth = %d rowHeight = %d", width, height)
66
67 cv::Mat src(height + height / 2, width, CV_8UC1, bytes);
68 saveMat(src);
69
70 // 转灰并更改格式
71 cv::Mat gray;
72 cvtColor(src, gray, cv::COLOR_YUV2GRAY_NV21);
73 saveMat(gray, "gray");
74
75 // 顺时针旋转90度图片,得到正常的图片(Android的后置摄像头获取的格式是横着的,需要旋转90度)
76 rotate(gray, gray, cv::ROTATE_90_CLOCKWISE);
77
78 LOGE("end readByte rowWidth = %d rowHeight = %d", width, height)
79 return startDecode(gray);
80}
81
82std::vector<ScanResult> DecodeScheduler::readBitmap(JNIEnv* env, jobject bitmap)
83{

Calls 1

saveMatFunction · 0.85

Tested by

no test coverage detected