test
Dependencies: BSP_DISCO_F429ZI LCD_DISCO_F429ZI mbed levkov_ov7670
zxing_lib/ImageReaderSource.h@1:5919d281ea43, 2017-09-25 (annotated)
- Committer:
- levkovigor
- Date:
- Mon Sep 25 12:40:27 2017 +0000
- Revision:
- 1:5919d281ea43
- Parent:
- 0:87b041e33c6c
teste
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
levkovigor | 0:87b041e33c6c | 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- |
levkovigor | 0:87b041e33c6c | 2 | #ifndef __IMAGE_READER_SOURCE_H_ |
levkovigor | 0:87b041e33c6c | 3 | #define __IMAGE_READER_SOURCE_H_ |
levkovigor | 0:87b041e33c6c | 4 | /* |
levkovigor | 0:87b041e33c6c | 5 | * Copyright 2010-2011 ZXing authors |
levkovigor | 0:87b041e33c6c | 6 | * |
levkovigor | 0:87b041e33c6c | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
levkovigor | 0:87b041e33c6c | 8 | * you may not use this file except in compliance with the License. |
levkovigor | 0:87b041e33c6c | 9 | * You may obtain a copy of the License at |
levkovigor | 0:87b041e33c6c | 10 | * |
levkovigor | 0:87b041e33c6c | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
levkovigor | 0:87b041e33c6c | 12 | * |
levkovigor | 0:87b041e33c6c | 13 | * Unless required by applicable law or agreed to in writing, software |
levkovigor | 0:87b041e33c6c | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
levkovigor | 0:87b041e33c6c | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
levkovigor | 0:87b041e33c6c | 16 | * See the License for the specific language governing permissions and |
levkovigor | 0:87b041e33c6c | 17 | * limitations under the License. |
levkovigor | 0:87b041e33c6c | 18 | */ |
levkovigor | 0:87b041e33c6c | 19 | |
levkovigor | 0:87b041e33c6c | 20 | #include "mbed.h" |
levkovigor | 0:87b041e33c6c | 21 | #include <iostream> |
levkovigor | 0:87b041e33c6c | 22 | #include <fstream> |
levkovigor | 0:87b041e33c6c | 23 | #include <string> |
levkovigor | 0:87b041e33c6c | 24 | #include <zxing/LuminanceSource.h> |
levkovigor | 0:87b041e33c6c | 25 | #include <zxing/common/Counted.h> |
levkovigor | 0:87b041e33c6c | 26 | #include <zxing/Binarizer.h> |
levkovigor | 0:87b041e33c6c | 27 | #include <zxing/MultiFormatReader.h> |
levkovigor | 0:87b041e33c6c | 28 | #include <zxing/Result.h> |
levkovigor | 0:87b041e33c6c | 29 | #include <zxing/ReaderException.h> |
levkovigor | 0:87b041e33c6c | 30 | #include <zxing/common/GlobalHistogramBinarizer.h> |
levkovigor | 0:87b041e33c6c | 31 | #include <zxing/common/HybridBinarizer.h> |
levkovigor | 0:87b041e33c6c | 32 | #include <exception> |
levkovigor | 0:87b041e33c6c | 33 | #include <zxing/Exception.h> |
levkovigor | 0:87b041e33c6c | 34 | #include <zxing/common/IllegalArgumentException.h> |
levkovigor | 0:87b041e33c6c | 35 | #include <zxing/BinaryBitmap.h> |
levkovigor | 0:87b041e33c6c | 36 | #include <zxing/DecodeHints.h> |
levkovigor | 0:87b041e33c6c | 37 | |
levkovigor | 0:87b041e33c6c | 38 | #include <zxing/qrcode/QRCodeReader.h> |
levkovigor | 0:87b041e33c6c | 39 | #include <zxing/multi/qrcode/QRCodeMultiReader.h> |
levkovigor | 0:87b041e33c6c | 40 | #include <zxing/multi/ByQuadrantReader.h> |
levkovigor | 0:87b041e33c6c | 41 | #include <zxing/multi/MultipleBarcodeReader.h> |
levkovigor | 0:87b041e33c6c | 42 | #include <zxing/multi/GenericMultipleBarcodeReader.h> |
levkovigor | 0:87b041e33c6c | 43 | |
levkovigor | 0:87b041e33c6c | 44 | using std::string; |
levkovigor | 0:87b041e33c6c | 45 | using std::ostringstream; |
levkovigor | 0:87b041e33c6c | 46 | using zxing::Ref; |
levkovigor | 0:87b041e33c6c | 47 | using zxing::ArrayRef; |
levkovigor | 0:87b041e33c6c | 48 | using zxing::LuminanceSource; |
levkovigor | 0:87b041e33c6c | 49 | |
levkovigor | 0:87b041e33c6c | 50 | using namespace std; |
levkovigor | 0:87b041e33c6c | 51 | using namespace zxing; |
levkovigor | 0:87b041e33c6c | 52 | using namespace zxing::multi; |
levkovigor | 0:87b041e33c6c | 53 | using namespace zxing::qrcode; |
levkovigor | 0:87b041e33c6c | 54 | |
levkovigor | 0:87b041e33c6c | 55 | |
levkovigor | 0:87b041e33c6c | 56 | class ImageReaderSource : public zxing::LuminanceSource { |
levkovigor | 0:87b041e33c6c | 57 | private: |
levkovigor | 0:87b041e33c6c | 58 | typedef LuminanceSource Super; |
levkovigor | 0:87b041e33c6c | 59 | |
levkovigor | 0:87b041e33c6c | 60 | const zxing::ArrayRef<char> image; |
levkovigor | 0:87b041e33c6c | 61 | const int comps; |
levkovigor | 0:87b041e33c6c | 62 | |
levkovigor | 0:87b041e33c6c | 63 | char convertPixel(const char* pixel) const; |
levkovigor | 0:87b041e33c6c | 64 | |
levkovigor | 0:87b041e33c6c | 65 | public: |
levkovigor | 0:87b041e33c6c | 66 | static zxing::Ref<LuminanceSource> create(char* buf, int buf_size, int width, int height); |
levkovigor | 0:87b041e33c6c | 67 | |
levkovigor | 0:87b041e33c6c | 68 | ImageReaderSource(zxing::ArrayRef<char> image, int width, int height, int comps); |
levkovigor | 0:87b041e33c6c | 69 | |
levkovigor | 0:87b041e33c6c | 70 | zxing::ArrayRef<char> getRow(int y, zxing::ArrayRef<char> row) const; |
levkovigor | 0:87b041e33c6c | 71 | zxing::ArrayRef<char> getMatrix() const; |
levkovigor | 0:87b041e33c6c | 72 | }; |
levkovigor | 0:87b041e33c6c | 73 | |
levkovigor | 0:87b041e33c6c | 74 | extern int ex_decode(uint8_t* buf, int buf_size, int width, int height, vector<Ref<Result> > * results, DecodeHints &hints); |
levkovigor | 0:87b041e33c6c | 75 | |
levkovigor | 0:87b041e33c6c | 76 | |
levkovigor | 0:87b041e33c6c | 77 | #endif /* __IMAGE_READER_SOURCE_H_ */ |