diff --git a/src/lib/cimb_translator/CimbReader.cpp b/src/lib/cimb_translator/CimbReader.cpp index 5a3f7ebe..289e169b 100644 --- a/src/lib/cimb_translator/CimbReader.cpp +++ b/src/lib/cimb_translator/CimbReader.cpp @@ -27,13 +27,16 @@ namespace { template bitbuffer preprocessSymbolGrid(const MAT& img, bool needs_sharpen) { - int blockSize = 3; // default: no preprocessing + int blockSize = 5; // default: no preprocessing cv::Mat symbols; cv::cvtColor(img, symbols, cv::COLOR_RGB2GRAY); if (needs_sharpen) - sharpenSymbolGrid(symbols, symbols); // we used to change blockSize for this case -- may one day be a useful trick again? - cv::adaptiveThreshold(symbols, symbols, 255, cv::ADAPTIVE_THRESH_MEAN_C, cv::THRESH_BINARY, blockSize, -5); + { + blockSize = 7; + sharpenSymbolGrid(symbols, symbols); + } + cv::adaptiveThreshold(symbols, symbols, 255, cv::ADAPTIVE_THRESH_MEAN_C, cv::THRESH_BINARY, blockSize, 0); bitbuffer bb(std::pow(Config::image_size(), 2) / 8); bitmatrix::mat_to_bitbuffer(symbols, bb.get_writer()); diff --git a/src/lib/cimb_translator/test/CimbReaderTest.cpp b/src/lib/cimb_translator/test/CimbReaderTest.cpp index 6b6723ff..32d69b59 100644 --- a/src/lib/cimb_translator/test/CimbReaderTest.cpp +++ b/src/lib/cimb_translator/test/CimbReaderTest.cpp @@ -73,9 +73,9 @@ TEST_CASE( "CimbReaderTest/testSample", "[unit]" ) ++count; } - string expected = "0=0 99=8 600=33 710=28 711=30 821=8 822=22 823=19 934=55 11688=55 11799=25 " - "11900=28 12000=23 12100=0 12200=5 12201=0 12298=32 12299=34 12300=30 12301=32 " - "12398=10 12399=15"; + string expected = "0=0 99=8 11680=3 11681=32 11900=28 11901=25 11904=12 11995=2 11996=8 11998=6 " + "11999=54 12001=29 12004=6 12099=2 12195=57 12196=1 12200=5 12201=0 12298=32 " + "12299=34 12300=30 12399=15"; assertEquals( expected, turbo::str::join(res) ); PositionData pos; @@ -109,8 +109,9 @@ TEST_CASE( "CimbReaderTest/testSampleMessy", "[unit]" ) ++count; } - string expected = "0=0 99=8 600=33 711=30 11462=2 11573=33 11574=0 11685=52 11686=17 11687=41 " - "11688=55 11797=30 11798=15 11799=25 12200=5 12298=46 12299=34 12300=30 12301=32 12397=38 12398=10 12399=15"; + string expected = "0=0 1=28 99=8 100=28 600=33 601=38 711=30 712=57 11464=53 11576=32 11577=44 " + "11687=41 11688=55 11689=32 11690=48 11798=15 11799=25 12297=46 12298=32 " + "12299=34 12300=30 12399=15"; assertEquals( expected, turbo::str::join(res) ); PositionData pos; @@ -200,7 +201,7 @@ TEST_CASE( "CimbReaderTest/testCCM.VeryNecessary", "[unit]" ) " 0.023812667, 0.98703396, -0.0048082001;\n" " 0, 0, 1.0017186]", ss.str()); - std::array expectedColors = {0, 0, 0, 0, 0, 3}; // it's wrong, but it's consistent! + std::array expectedColors = {0, 0, 0, 0, 0, 0}; // it's wrong, but it's consistent! for (unsigned i = 0; i < expectedColors.size(); ++i) { PositionData pos; diff --git a/src/lib/encoder/test/DecoderTest.cpp b/src/lib/encoder/test/DecoderTest.cpp index 16e2bfb2..edb4053b 100644 --- a/src/lib/encoder/test/DecoderTest.cpp +++ b/src/lib/encoder/test/DecoderTest.cpp @@ -57,5 +57,5 @@ TEST_CASE( "DecoderTest/testDecode.Sample", "[unit]" ) assertEquals( 9300, bytesDecoded ); if (CV_VERSION_MAJOR == 4) - assertEquals( "0f74a76cb1f59df7a42449a3527d464d913d12a03bffa51d6f53828724c3feb1", get_hash(decodedFile) ); + assertEquals( "2040c157884c476def842f7854621a7655182e5f11a34ade563616d93cb93455", get_hash(decodedFile) ); } diff --git a/web/icon-192x192.png b/web/icon-192x192.png new file mode 100644 index 00000000..e04cf269 Binary files /dev/null and b/web/icon-192x192.png differ diff --git a/web/icon-512x512.png b/web/icon-512x512.png new file mode 100644 index 00000000..092d00cc Binary files /dev/null and b/web/icon-512x512.png differ diff --git a/web/index.html b/web/index.html index 51f4b94d..0793cb20 100644 --- a/web/index.html +++ b/web/index.html @@ -3,7 +3,8 @@ Cimbar Encoder - + + diff --git a/web/pwa.json b/web/pwa.json new file mode 100644 index 00000000..b978022a --- /dev/null +++ b/web/pwa.json @@ -0,0 +1,13 @@ +{ + "lang": "en", + "dir": "ltr", + "name": "Cimbar Encoder", + "short_name": "cimbar.org", + "icons": [{"src":"icon-192x192.png","sizes":"192x192","type":"image/png"},{"src":"icon-512x512.png","sizes":"512x512","type":"image/png"}], + "scope": "/", + "start_url": "index.html", + "display": "fullscreen", + "theme_color": "aliceblue", + "background_color": "black" +} + diff --git a/web/sw.js b/web/sw.js index ef81b292..dad10abf 100644 --- a/web/sw.js +++ b/web/sw.js @@ -1,12 +1,13 @@ -var _cacheName = 'cimbar-js-v0.5.8.c'; +var _cacheName = 'cimbar-js-v0.5.14'; var _cacheFiles = [ '/', '/index.html', '/cimbar_js.js', '/cimbar_js.wasm', '/favicon.ico', - '/main.js' + '/main.js', + '/pwa.json' ]; // fetch files