From: Skullheadx Date: Wed, 20 Nov 2024 00:26:28 +0000 (-0500) Subject: print and import qr code from file X-Git-Url: http://git.skullheadx.com/links.html?a=commitdiff_plain;h=5802e4dc52d08f876e3adeb62ffaa1644a389f09;p=qrcodescanner.git print and import qr code from file --- diff --git a/.DS_Store b/.DS_Store index 4c68ead..43b4569 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/69.png b/69.png new file mode 100644 index 0000000..4c42ca8 Binary files /dev/null and b/69.png differ diff --git a/camera.cpp b/camera.cpp new file mode 100644 index 0000000..0d20f12 --- /dev/null +++ b/camera.cpp @@ -0,0 +1,44 @@ +#include +#include +#include +#include + +void read_words_from_file(char const *filename, std::vector> &symbol); +void print(std::vector> &symbol); + +int main(){ + std::vector> symbol(21, std::vector(21,0)); + + read_words_from_file("output.pbm", symbol); + print(symbol); + + + return 0; +} + + +void print(std::vector> &symbol){ + for (const auto &i : symbol){ + for (auto j : i){ + std::cout << j; + } + std::cout << std::endl; + } +} + +void read_words_from_file(char const *filename, std::vector> &symbol) { + std::ifstream file{ filename }; + if (!file.is_open()) { + std::cout << "[ERROR] " << filename << " not found or could not open file" << std::endl; + } + assert( file.is_open() ); + + file.ignore(9); + std::size_t row{0}; + for (std::string line; std::getline(file, line);++row){ + for (std::size_t pos{0}; pos < line.size(); pos+=2){ + symbol[row][pos/2] = (line[pos] == '1'); + } + } + file.close(); +} diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..e69de29