sz3/libcimbar
Fork: 291 Star: 4084 (更新于 2024-10-31 14:20:50)
license: MPL-2.0
Language: C++ .
Optimized implementation for color-icon-matrix barcodes
最后发布版本: v0.6.1f ( 2024-07-01 11:03:08)
INTRODUCTION | ABOUT | CFC | LIBCIMBAR
DETAILS | PERFORMANCE | TODO
libcimbar: Color Icon Matrix Barcodes
Behold: an experimental barcode format for air-gapped data transfer.
It can sustain speeds of 850 kilobits/s (~106 KB/s) using just a computer monitor and a smartphone camera!
Explain?
The encoder outputs an animated barcode to a computer or smartphone screen:
- Encoder web app: https://cimbar.org
While the decoder is a cell phone app that uses the phone camera to read the animated barcode:
- Decoder android app: https://github.com/sz3/cfc
No internet/bluetooth/NFC/etc is used. All data is transmitted through the camera lens. You can try it out yourself, or take my word that it works. :)
How does it work?
cimbar
is a high-density 2D barcode format. Data is stored in a grid of colored tiles -- bits are encoded based on which tile is chosen, and which color is chosen to draw the tile. Reed Solomon error correction is applied on the data, to account for the lossy nature of the video -> digital decoding. Sub-1% error rates are expected, and corrected.
libcimbar
, this optimized implementation, includes a simple protocol for file encoding built on fountain codes (wirehair
) and zstd compression. Files of up to 33MB (after compression!) are encoded in a series of cimbar codes, which can be output as images or a live video feed. Once enough distinct image frames have been decoded successfully, the file will be reconstructed and decompressed successfully. This is true even if the images are received out of order, or if some have been corrupted or are missing.
Platforms
The code is written in C++, and developed/tested on amd64+linux, arm64+android (decoder only), and emscripten+WASM (encoder only). It probably works, or can be made to work, on other platforms.
Crucially, because the encoder compiles to asmjs and wasm, it can run on anything with a modern web browser. For offline use, you can either install cimbar.org as a progressive web app, or download the latest release of cimbar_js.html
, save it locally, and open it in your web browser.
Library dependencies
OpenCV and GLFW (+ OpenGL ES headers) must be installed before building. All other dependencies are included in the source tree.
- opencv - https://opencv.org/ (
libopencv-dev
) - GLFW - https://github.com/glfw/glfw (
libglfw3-dev
) - GLES3/gl3.h -
libgles2-mesa-dev
- base - https://github.com/r-lyeh-archived/base
- catch2 - https://github.com/catchorg/Catch2
- concurrentqueue - https://github.com/cameron314/concurrentqueue
- cxxopts - https://github.com/jarro2783/cxxopts (used for command line tools)
- fmt - https://github.com/fmtlib/fmt
- intx - https://github.com/chfast/intx
- libcorrect - https://github.com/quiet/libcorrect
- libpopcnt - https://github.com/kimwalisch/libpopcnt
- PicoSHA2 - https://github.com/okdshin/PicoSHA2 (used for testing)
- stb_image - https://github.com/nothings/stb (for loading embedded pngs)
- wirehair - https://github.com/catid/wirehair
- zstd - https://github.com/facebook/zstd
Build
- install opencv and GLFW. On ubuntu/debian, this looks like:
sudo apt install libopencv-dev libglfw3-dev libgles2-mesa-dev
- run the cmake + make incantation
cmake .
make -j7
make install
By default, libcimbar will try to install build products under ./dist/bin/
.
To build cimbar.js (what cimbar.org uses), see WASM.
Usage
Encode:
- large input files may fill up your disk with pngs!
./cimbar --encode -i inputfile.txt -o outputprefix
Decode (extracts file into output directory):
./cimbar outputprefix*.png -o /tmp
Decode a series of encoded images from stdin:
echo outputprefix*.png | ./cimbar -o /tmp
Encode and animate to window:
./cimbar_send inputfile.pdf
You can also encode a file using cimbar.org, or the latest release.
Performance numbers
Implementation details
Room for improvement/next steps
Inspiration
- https://github.com/JohannesBuchner/imagehash/
- https://github.com/divan/txqr
- https://en.wikipedia.org/wiki/High_Capacity_Color_Barcode
Would you like to know more?
INTRODUCTION | ABOUT
最近版本更新:(数据更新于 2024-11-06 03:36:27)
2024-07-01 11:03:08 v0.6.1f
2024-02-26 09:58:44 v0.6.0f
2024-01-24 14:10:50 v0.5.15
2023-12-04 09:11:12 v0.5.14f
2023-12-02 11:21:38 v0.5.14
2022-06-06 11:10:25 v0.5.12
2022-03-26 10:18:06 v0.5.11
2022-02-26 05:21:38 v0.5.10
2021-07-01 12:54:39 v0.5.8
2021-03-06 11:55:39 v0.5.7
主题(topics):
barcode, cpp17, fountain-codes, image-hash, opencv, proof-of-concept
sz3/libcimbar同语言 C++最近更新仓库
2024-11-05 23:57:44 PCSX2/pcsx2
2024-11-05 22:06:04 LizardByte/Sunshine
2024-11-05 00:42:13 ClickHouse/ClickHouse
2024-11-04 21:49:30 notepad-plus-plus/notepad-plus-plus
2024-11-03 22:31:09 MaaAssistantArknights/MaaAssistantArknights
2024-11-02 20:28:28 AaronFeng753/Waifu2x-Extension-GUI