From: Skullheadx Date: Fri, 22 Nov 2024 23:13:53 +0000 (-0500) Subject: create error correction function X-Git-Url: http://git.skullheadx.com/nixos/README?a=commitdiff_plain;h=f3abb344fc53b0a7ac2360e07f399e86411c1d74;p=qrcodescanner.git create error correction function --- diff --git a/output.pbm b/6969696969.pbm similarity index 100% rename from output.pbm rename to 6969696969.pbm diff --git a/camera.cpp b/camera.cpp index 8c0633c..011f7a5 100644 --- a/camera.cpp +++ b/camera.cpp @@ -21,7 +21,9 @@ std::string get_input_data(std::vector &input_data, unsigned int character std::string decode_symbol(std::vector> &symbol); int main(){ - std::vector test_cases = {"012345678", "876543210", "000000000", "999999999", "123456789", "873703846", "884158624", "827515735", "869871935", "804235824"}; + //std::vector test_cases = {"012345678", "876543210", "000000000", "999999999", "123456789", "873703846", "884158624", "827515735", "869871935", "804235824"}; + std::vector test_cases = {"6969696969"}; + unsigned int test_counter = 1; for (auto test : test_cases){ std::vector> symbol(21, std::vector(21,0)); @@ -354,6 +356,7 @@ std::string decode_symbol(std::vector> &symbol){ //std::cout << "Number of data codewords: " << data_codewords.size() / 8.0 << std::endl; //std::cout << "Number of error correction codewords: " << error_correction_codewords.size() / 8.0 << std::endl; //print_codewords(data_codewords); + //print_codewords(error_correction_codewords); std::vector mode_indicator(data_codewords.begin(), data_codewords.begin() + 4); std::vector character_count(data_codewords.begin() + 4, data_codewords.begin() + 14); unsigned int character_count_indicator = convert_uint(character_count); @@ -364,6 +367,10 @@ std::string decode_symbol(std::vector> &symbol){ } +void error_correct(std::vector &codewords){ + // Error correction doe per block: (c,k,r)^a = (26,16,4)^b +} + void read_from_file(std::string filename, std::vector> &symbol){ std::ifstream file{ filename }; if (!file.is_open()) {