cimbar icon indicating copy to clipboard operation
cimbar copied to clipboard

Why does the content become garbled when I use the python -m cimbar.cimbar decode.png -o decode.txt --ecc=0 command to decode after using the Encoder on https://cimbar.org?

Open fighter-01 opened this issue 11 months ago • 3 comments

fighter-01 avatar Jan 14 '25 03:01 fighter-01

Most likely that "garbled" content is error correction. There are two levels of it in play:

  1. --ecc=0 will treat all decoded data as valid (and not attempt reedsolomon error correction), meaning the intermixed error correction bytes will be treated as if they're part of the file. cimbar.org uses ecc=30 (the default), and unless you're troubleshooting something you probably don't want to change this.
  2. you'll also need to enable "fountain" decoding with the --fountain flag, since that's what libcimbar/cimbar.org do.

sz3 avatar Jan 14 '25 07:01 sz3

python -m cimbar.cimbar 22.png --output=myoutputfile.txt --ecc=30 --fountain true
I used the command above and encountered the following error.: Traceback (most recent call last): File "D:\developsoft\conda\envs\cimbar\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "D:\developsoft\conda\envs\cimbar\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "E:\softProject\pythonproject\cimbar-master\cimbar\cimbar.py", line 581, in main() File "E:\softProject\pythonproject\cimbar-master\cimbar\cimbar.py", line 577, in main decode(src_images, dst_data, dark, ecc, fountain, should_preprocess, color_correct, **deskew) File "E:\softProject\pythonproject\cimbar-master\cimbar\cimbar.py", line 426, in decode for i, bits in decode_iter( File "E:\softProject\pythonproject\cimbar-master\cimbar\cimbar.py", line 375, in decode_iter dims = detect_and_deskew(src_image, temp_img, dark, auto_dewarp) File "E:\softProject\pythonproject\cimbar-master\cimbar\cimbar.py", line 199, in detect_and_deskew return deskewer(src_image, temp_image, dark, auto_dewarp=auto_dewarp) File "E:\softProject\pythonproject\cimbar-master\cimbar\deskew\deskewer.py", line 99, in deskewer align = scan(img, dark, use_edges, size, anchor_size) File "E:\softProject\pythonproject\cimbar-master\cimbar\deskew\deskewer.py", line 86, in scan cs = CimbarScanner(img, dark) File "E:\softProject\pythonproject\cimbar-master\cimbar\deskew\scanner.py", line 213, in init self.img = _the_works(img) File "E:\softProject\pythonproject\cimbar-master\cimbar\deskew\scanner.py", line 157, in _the_works x = int(min(img.shape[0], img.shape[1]) * 0.002) AttributeError: 'NoneType' object has no attribute 'shape'

fighter-01 avatar Jan 14 '25 08:01 fighter-01

The --ecc=30 and true are unnecessary.

That error is consistent with 22.png not existing -- or being in a different directory than the one you're running the code from.

Another thing to make sure of (after you get past the current error) is to switch the encoder into "mode B". I've been waiting to make that the default to give people time to upgrade the decoder app, but it's probably what you want.

sz3 avatar Jan 16 '25 07:01 sz3