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

Function SetupLumImageView

czxing/src/main/cpp/zxing/src/ReadBarcode.cpp:101–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99};
100
101ImageView SetupLumImageView(ImageView iv, LumImage& lum, const DecodeHints& hints)
102{
103 if (iv.format() == ImageFormat::None)
104 throw std::invalid_argument("Invalid image format");
105
106 if (hints.binarizer() == Binarizer::GlobalHistogram || hints.binarizer() == Binarizer::LocalAverage) {
107 if (iv.format() != ImageFormat::Lum) {
108 lum = ExtractLum(iv, [r = RedIndex(iv.format()), g = GreenIndex(iv.format()), b = BlueIndex(iv.format())](
109 const uint8_t* src) { return RGBToLum(src[r], src[g], src[b]); });
110 } else if (iv.pixStride() != 1) {
111 // GlobalHistogram and LocalAverage need dense line memory layout
112 lum = ExtractLum(iv, [](const uint8_t* src) { return *src; });
113 }
114 if (lum.data())
115 return lum;
116 }
117 return iv;
118}
119
120std::unique_ptr<BinaryBitmap> CreateBitmap(ZXing::Binarizer binarizer, const ImageView& iv)
121{

Callers 1

ReadBarcodesFunction · 0.85

Calls 8

ExtractLumFunction · 0.85
RedIndexFunction · 0.85
GreenIndexFunction · 0.85
BlueIndexFunction · 0.85
RGBToLumFunction · 0.85
pixStrideMethod · 0.80
formatMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected