You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
613 B
22 lines
613 B
#include "ZXing/ZXingCpp.h" |
|
|
|
#include <iostream> |
|
|
|
int main(int argc, char** argv) |
|
{ |
|
using namespace ZXing; |
|
|
|
auto copts = CreatorOptions(BarcodeFormat::QRCode, "eclevel=L"); |
|
auto barcode = CreateBarcodeFromText("Test", copts); |
|
auto wopts = WriterOptions().scale(2); |
|
auto img = WriteBarcodeToImage(barcode, wopts); |
|
|
|
auto iv = ImageView(img.data(), img.width(), img.height(), img.format()); |
|
auto ropts = ReaderOptions().formats(BarcodeFormat::AllLinear); |
|
auto barcodes = ReadBarcodes(iv, ropts); |
|
|
|
for (const auto& b : barcodes) |
|
std::cout << ToString(b.format()) << ": " << b.text() << "\n"; |
|
|
|
return 0; |
|
}
|
|
|