Skip to content

Commit 7b0ab1d

Browse files
authored
Merge pull request #27 from sz3/split-decodes
Support split encode/decoder mode, "mode B"
2 parents b5166ea + bdb35fb commit 7b0ab1d

18 files changed

+595
-103
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
fail-fast: false
88
matrix:
99
os: [ubuntu-latest]
10-
python-version: [3.7, 3.8, 3.9, "3.10"]
10+
python-version: [3.8, 3.9, "3.10", "3.11"]
1111
steps:
1212
- uses: actions/checkout@v2
1313
with:
@@ -20,7 +20,7 @@ jobs:
2020

2121
- name: install dependencies
2222
run: |
23-
pip install -r requirements
23+
pip install -r requirements.freeze
2424
pip install --upgrade coveralls
2525
2626
- name: test

ABOUT.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ My conclusion was that if I was going to create a proof-of-concept implementatio
3030

3131
Not yet. The project is -- at this point -- just a proof-of-concept. It's not clear to me that cimbar is any better for data density + reliability than HCCB, or better than the myriad of unfinished attempts at color QR codes that are floating around, or (...). It could be a technological dead end. But perhaps with more refinement it might be interesting?
3232

33-
## Notable open questions, concerns, and ideas:
33+
## Unresolved design questions, concerns, and ideas:
3434

3535
* the symbol set is not optimal. There are 16, and their image hashes are all reasonable hamming distance from each other, and do *ok* when upscaled... but I drew the initial 40 or so candidates by hand in kolourpaint, and paired down the set to 16 by experimentation.
3636
* 32 distinct tiles (5 bits) be possible for 8x8 tiles
@@ -52,21 +52,20 @@ Not yet. The project is -- at this point -- just a proof-of-concept. It's not cl
5252
* 8-color cimbar (3 color bits) is possible, at least in dark mode
5353
* probably light mode as well, but a palette will need to be found
5454
* 16-color cimbar does not seem possible with the current color decoding logic
55-
* but with pre-processing for color correction and a perceptual color diff (like CIE76), ... maybe?
56-
* this may be wishful thinking.
55+
* ...at least not in the small (sub-8x8) tile sizes we want to use for high data density
5756

5857
* Reed Solomon was chosen for error correction due how ubiquitous its implementations are.
5958
* it isn't a perfect fit. Most cimbar errors are 1-3 flipped bits at a time -- Reed Solomon doesn't care if one bit flipped or eight did -- a bad byte is a bad byte.
60-
* Something built on LDPC would likely be better.
59+
* Something that cares about bits and not bytes (LDPC? idk) would likely be better.
6160

6261
* the focus on computer screens has surely overlooked problems that come from paper/printed/e-paper surfaces
6362
* using a black background ("dark mode") came out of getting better results from backlit screens
6463
* notably, there are some threshold parameters and color averaging heuristics that will (probably) need to be re-tuned for "light mode" cimbar
6564
* curved surfaces are a can of worms I didn't want to open -- there are some crazy ideas that could be pursued there, but they may not be worth the effort
6665

6766
* should cimbar include "metadata" to tell the decoder what it's trying to decode -- ECC level, number of colors, (grid size...?)
68-
* the bottom right corner of the image seems like the logical place for this.
69-
* a slightly smaller 4th anchor pattern could give us 11 tiles (44 bits?) to work with for metadata, which is not a lot, but probably enough.
67+
* the bottom right corner of the image seems like the logical place for this. However, differing aspect ratios may be a problem
68+
* example: on 8x8, a slightly smaller 4th anchor pattern could give us 11 tiles (44 bits?) to work with for metadata, which is not a lot, but probably enough to be useful.
7069

7170

7271
## Would you like to know more?

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
cimbar is a proof-of-concept 2D data encoding format -- much like [QR Codes](https://en.wikipedia.org/wiki/QR_code), [JAB codes](https://jabcode.org/), and [Microsoft's HCCB](https://en.wikipedia.org/wiki/High_Capacity_Color_Barcode).
66

77
<p align="center">
8-
<img src="https://github.com/sz3/cimbar-samples/blob/v0.5/6bit/4color_ecc30_fountain_0.png" width="70%" title="an example cimbar code" >
8+
<img src="https://github.com/sz3/cimbar-samples/blob/v0.6/b/4cecc30f.png" width="70%" title="A non-animated mode-B cimbar code" >
99
</p>
1010

1111
## How it works
@@ -33,16 +33,16 @@ The main constraints cimbar must deal with are:
3333
* all tiles in the tileset must be sufficient hamming distance away from each other, where *sufficient* is determined by whether the decoder can consistently place blurry or otherwise imperfect tiles in the correct "bucket".
3434
* all colors in the colorset must be far enough away from each other -- currently as a function of RGB value scaling -- such that color bleeding, reflections, and the like, can be overcome.
3535

36-
In practice, this means that the source image should be around 900x900 resolution or greater, with reasonable color correction handled by the camera -- as you'd find in any modern cell phone.
36+
Cimbar is designed to deal with some lossiness. In practice, the source image should be around 700x700 resolution or greater, in focus, and with *some* color correction handled by the camera -- as you'll hopefully find in any modern cell phone.
3737

38-
This python cimbar implementation is a research project. It works, but it is not very performant, and does not handle error cases with much grace. [libcimbar](https://github.com/sz3/libcimbar), the C++ implementation, has been much more heavily optimized and tested. The target goals of the proof-of-concept were:
38+
This python cimbar implementation is a research project. It works, but it is slow, and does not handle error cases with much grace. [libcimbar](https://github.com/sz3/libcimbar), the C++ implementation, has been much more heavily optimized and tested. The target goals of the proof-of-concept were:
3939
1. achieve data density on the order of _10kb_ per image.
4040
2. validate a theoretical performance (and if possible, an implemented demonstration) of >= _100kb/s_ data transfer (800 kilobits/second) from a computer screen to a cell phone, using only animated cimbar codes and the cell phone camera.
4141

4242
## I want numbers!
4343

44-
* a 6-bit cimbar image contains `9300` raw bytes of data, and `7500` bytes with the default error correction level (30)
45-
* for 7-bit cimbar, the respective numbers are `10850` and `8750`
44+
* a `mode B` (8x8, 4-color, 30/155 ecc, 6-bits-per-tile) cimbar image contains `9300` raw bytes of data, and `7500` bytes with the default error correction level (30)
45+
* for the old `mode 8C` (8x8, 8-color, 7-bit) cimbar, the respective numbers are `10850` and `8750`
4646
* error correction level is `N/155`. So `ecc=30` corresponds to a `30:125` ratio of error correction bytes to "real" bytes.
4747
* error correction is (for now) done via Reed Solomon, which contibutes to the rather large ratio of error correction bytes. See [ABOUT](ABOUT.md) for more technical discussion.
4848

0 commit comments

Comments
 (0)