
JAB Code – A high-capacity 2D color bar code - Confiks
https://github.com/jabcode/jabcode
======
nimbius
for those decrying the limited use of 2d barcodes in the US or in europe,
you've never set foot in a manufacturing environment.

2d barcodes are used for cradle-to-grave inventory tracking by systems like
Glovia and SAP. everything from transmission gears to soda pop are tagged
during manufacture with numerous 2d barcodes that change at different
stations, and at different times.

it doesnt matter what your new standard claims to achieve, it is useless
without industry adoption. Toyota, Honda, Yamaha, Ford, Dell, and countless
other manufacturing titans have invested collective billions into the QR
implementations of their factories and arent going to re-tool just because
your standard has colors.

QR is also massively resilient to failure. Try this experiment: cut a QR code
in half, try to read it. It will succeed. This resilience is pivotal in harsh
environments and especially during international/trans oceanic shipping.

black and white QR can be engraved on shipping containers and is resistant to
corrosion, solvents, and the environment around it. QR codes are regularly
burned at thousands of degrees as part of the heat treatment process for
hardened steel, and still perform. Vision systems for forklifts and robotic
cranes at shipping yards (most are robotic yards these days) rely on near/far
vision systems developed by Intermec and other companies to read a code the
size of a postage stamp from up to 150 meters away.

~~~
nine_k
I suppose that color-based codes have more density per "pixel" (2-3 bits), so
they can be used to encode relatively large amounts of information. Try
encoding 1kb as a QR code; it will become pretty unwieldy, if it's possible at
all. Think about the size of a reasonable cryptographic public key; would it
be nice to have it optically readable sometimes?

Tagging things during manufacture is a different application area, with
different constraints and requirements. Bar codes are not gone because QR
codes are here, QR codes won't be gone because color codes appear.

~~~
kakarot
A B/W randomart image which uses alphanumeric and special characters, like the
one used in ssh-keygen itself when generating keys, would be enough. With
current tech, Adding colors is just a recipe for disaster in environments
which need maximum reliability.

Personally, I think QR codes are just fine for manufacturing but as for
encodings meant for end-users, I think we should be focusing on making them
more human-readable or at least visually comparable, without sacrificing bit-
depth.

Still, this tech was really neat to play around with and I hope something good
comes out of all the work put into it.

~~~
dcbadacd
Some kind of symmetry would already really enhance how nice QR codes look to
people.

------
pygy_
People here seem to think that this is someone's weekend project, not the
result of serious engineering from an institute of the Fraunhofer Society
(which it is).

The spec can be found at
[https://www.bsi.bund.de/EN/Publications/TechnicalGuidelines/...](https://www.bsi.bund.de/EN/Publications/TechnicalGuidelines/TR03137/BSITR03137.html)
(63 pages, the BSI is the German Federal Office for Information Security, a
government agency), and this is slated to become an ISO standard.

Here's the Google translation (original in German provided somewhere else by
@JdeBP) of an article introducing the tech:

[https://translate.google.com/translate?hl=fr&sl=auto&tl=en&u...](https://translate.google.com/translate?hl=fr&sl=auto&tl=en&u=https%3A%2F%2Fwww.ident.one%2Fde%2F2018%2F07%2F30%2Fjust-
another-barcode-jab-code%2F)

I agree with others that the master/slave terminology is unfortunate in new
tech like this. Otherwise this looks pretty good.

~~~
dsl
So it is some research institutes weekend project. The process of making
something an ISO standard is not as rigorous as IETF or IEEE. ISO has over 250
technical committees, cranking out useless standards all the time. Most
members vote to approve whatever comes down the pipe if it doesn't impact them
directly.

Looking closer at the spec you linked, it is tacked on to a standard for
visual checksumming of printed documents. It isn't even moving forward on its
own merits as a reasonable 2D barcode implementation.

~~~
jake_the_third
I've just skimmed over the both specifications and haven't noticed anything
that would indicate that this is a "weekend project". In fact, I'm impressed
enough that I might work on an implementation in my preferred language
(assuming a decent testing dataset is available).

What exactly are the technical issues that make you dismiss this project so
harshly?

------
Confiks
To copy a comment from a Github issue [1], comparing the different
implementations:

\- CRONTO, PM-Code and HCCB and AuthPaper are proprietary. CRONTO has
attracted some usage mainly by banks, PM-Code looks like vaporware, AuthPaper
seems inactive and HCCB is dead [2].

\- CobraKing seems to be a 2012 research project, unmaintained

\- HCC2D seems to be mainly academic exploration

Papers and results similar to HCC2D pop up periodically (i.e. [3]), but
unfortunately nobody has released any (experimental) source code. It quite
frustrating. For example, AuthPaper implemented their solution on top of
ZXing, but they never contributed back. They apparently thought they could
make some money out of it, but now that their venture is inactive, their ZXing
modification is in limbo as well.

From my one-hour research, that makes JAB Code the only actually FOSS
implementation of a high capacity 'barcode'. If you know of other (FOSS)
implementations, please let me know.

I'm quite surprised JAB Code has existed for so long in a fairly production-
ready state without attracting much attention. It deserves much more, looking
at the rest of the field.

[1]
[https://github.com/jabcode/jabcode/issues/2](https://github.com/jabcode/jabcode/issues/2)

[2]
[https://en.wikipedia.org/wiki/High_Capacity_Color_Barcode#Di...](https://en.wikipedia.org/wiki/High_Capacity_Color_Barcode#Discontinuation)

[3]
[https://pdfs.semanticscholar.org/95c7/fe455a084b0f0ce9923e99...](https://pdfs.semanticscholar.org/95c7/fe455a084b0f0ce9923e996652156c1f7998.pdf)

~~~
jf
Thanks for doing this research! I've long dreamed of making a "print to binary
to paper" backup system, but all the 2D barcodes I considered had patent
encumbrances.

~~~
fallat
This was the motivation behind what I tried to make:
[https://github.com/lf94/blots](https://github.com/lf94/blots)

~~~
ZenPsycho
related:
[https://github.com/cyphar/paperback](https://github.com/cyphar/paperback)

------
gregmac
One of the nice 'features' of QR codes is they're instantly recognizable as QR
codes due to the 3 registration marks, and so it's obvious you could pull out
your phone and scan one (not that anyone does that).

JAB codes just look like a jumble of colored pixels -- it's not obvious it's
encoded data, if you were to see this "in the wild".

It kind of misses another potential feature, which is registration marks could
also establish a baseline for colors, which a reader/scanner could then use to
compensate for differences in color reproduction (due to printing / screen
settings / etc).

~~~
neetdeth
Technical specification is here:
[https://www.bsi.bund.de/SharedDocs/Downloads/EN/BSI/Publicat...](https://www.bsi.bund.de/SharedDocs/Downloads/EN/BSI/Publications/TechGuidelines/TR03137/BSI-
TR-03137_Part2.pdf?__blob=publicationFile&v=2)

Every JAB code has four registration patterns in the corners, as well as
multiple color pallets at fixed locations.

~~~
rwmj
I think OP's point was that _humans_ can't recognize those features.

Edit: I should have said _untrained humans_.

~~~
neetdeth
I can recognize those features. Sure, you need to look for them, but why would
anyone care to? Surely after encountering only a few RGB codes the average
person will have no trouble inferring that a jumble of colored blocks against
a white background is likely to be encoded data. Same "training process" as
needed for QR codes - although in this case the quiet zone is not needed, so
you _could_ use these in a deliberately obscure fashion if you wanted, which
isn't a shortcoming.

~~~
derefr
Yes, you're able to realize that any given RGB mess-of-pixels printed
somewhere is "likely to be encoded data", but maybe, you'll think, there might
be _multiple_ standards for RGB-encoded data (there are) and so, what standard
does this code obey? Is it one your phone can parse?

QR codes are able to be recognized _as_ QR codes, which means you're able to
think "I could definitely scan that", rather than thinking "that is some data
there, that I could maybe read or maybe not."

It's the same as the difference between saying that data on the wire is "a TCP
packet" vs saying it's "HTTP." Yes, either way, you know that you've got some
packets—but if you want to _parse_ them, you'd better be able to recognize the
_format_ of those packets.

~~~
pygy_
There are also multiple standards for black and white 2d bar codes.

This is backed by the Fraunhofer Society and the German government, and on
tracks to become an ISO standard. It will be implemented in scanners (hardware
and software).

~~~
jschwartzi
Yes, and most people are not aware that there are multiple barcode standards,
even with 1D barcodes. Ask anyone what the difference is between Interleaved
2of5, Code 39, Code128, UPC/EAN, PostNet, etc. and they'll be hard-pressed to
identify any of the distinguishing characteristics that are immediately
obvious to the trained eye.

------
gregschlom
Reminds me of Microsoft's High-Capacity Color Barcode:
[https://www.microsoft.com/en-us/research/project/high-
capaci...](https://www.microsoft.com/en-us/research/project/high-capacity-
color-barcodes-hccb/)

Wikipedia:
[https://en.wikipedia.org/wiki/High_Capacity_Color_Barcode](https://en.wikipedia.org/wiki/High_Capacity_Color_Barcode)

~~~
brink
Microsoft comes up with a lot of neat little ideas. And also some bad ones.
But mostly good ones.

~~~
Twirrim
Their "Household of the future" lab consistently shows off amazing tech that
could be world changing, but the number that actually seem to come to
production always seems remarkably low.

------
divan
I wonder what throughput it can give when used as an animated sequence of
codes? I experimented with animated QRs for data transfer last week and the
real maximum I’ve achieved was around 9KB/s.
[https://divan.github.io/posts/animatedqr](https://divan.github.io/posts/animatedqr)

Using colored high-capacity encoding should yield much better results, given
the decoder is as fast as QR one.

~~~
specialist
Cool. How does Apple's iPhone-to-Watch pairing animated graphic work? Maybe
their technique has higher bandwidth.

~~~
paulgb
Speaking of screen-to-watch data transfer, the Timex Data Link watch somehow
accomplished this in the mid-90s. There must have been some dark magic to make
it work on a watch-battery powered processor at the time.

[https://youtu.be/2VmtPaiOBwI](https://youtu.be/2VmtPaiOBwI)

~~~
divan
That’s definitely a dark magic! Thanks for sharing this.

------
skrebbel
My bank uses some colored pixelcode not unlike this one. I scan a code on my
screen using a little device that I insert the bank card into.

It's cool, it works well and it's fancy, but every time I do banking I have to
turn off my computer's "night light" mode.

I assume lots of people use color filters for various good reasons. Are these
codes resisent to that? Else I'd truly prefer oldschool monochrome QR codes,
to be honest.

~~~
staticfloat
This is pretty easily fixed by doing white balance correction. One piece of
the barcode is always kept white, and it is used for color calibration.
assuming the color transformation is constant across the entire code (which is
the case in your example) you can undo some pretty large color shifts.

------
Crazyontap
In case anyone missed it, a very interesting link explaining how QR codes work
was posted on HN a few days ago[1]. I wish there was some explanation like
this on this JAB code and how exactly it gives high capacity over the b/w
code.

[1] [https://www.nayuki.io/page/creating-a-qr-code-step-by-
step](https://www.nayuki.io/page/creating-a-qr-code-step-by-step)

~~~
vanderZwan
Well, there is this:

> _The technical specification of the barcode is available as BSI TR03137 -
> Part 2_ [0]

It's apparently research done by the German Federal Office for Information
Security.

[0]
[https://www.bsi.bund.de/EN/Publications/TechnicalGuidelines/...](https://www.bsi.bund.de/EN/Publications/TechnicalGuidelines/TR03137/BSITR03137.html)

------
pavel_lishin
How well does it hold up in adverse conditions, like outdoors in bad weather,
or dark light, or a drunk person trying to take the photo?

~~~
tyingq
It doesn't appear to have anything to correct for orientation like the 3
corners in a QR code.

Edit: ok, found the docs/description of the finder patterns:
[https://imgur.com/a/ZXXLtQ0](https://imgur.com/a/ZXXLtQ0)

~~~
gugagore
> A JAB Code contains one master symbol and optionally multiple slave symbols.
> Master symbol contains four finder patterns located at the corners of the
> symbol, while slave symbol contains no finder pattern

------
Macuyiko
Yet again another barcode / QR proposal.

Can't speak for the Americas, but here in Europe QR codes aren't used that
much, I feel, except maybe for mobile payments. Compare this with China, where
QR codes are in literally every store, each taxi driver has a printed one
nearby and even street food cards use them to pay. I can't see this one
becoming popular, given how many are printed on glossy / dirty paper (often
using black and white printers as well). I am amazed though how well the
standard QR code works in most cases, even with everyone adding an icon in the
middle of it (and basically removing error correcting redundancy).

An interesting QR thing I picked up last time I was there is how circular QR
codes are becoming more popular, see e.g.
[https://irf.fhnw.ch/bitstream/handle/11654/17880/Fokusreport...](https://irf.fhnw.ch/bitstream/handle/11654/17880/Fokusreport_stamm.pdf?sequence=1)
and
[https://en.wikipedia.org/wiki/ShotCode](https://en.wikipedia.org/wiki/ShotCode)
for earlier approaches but WeChat has started using its own thing, kind of
like Facebook and Snapchat are doing: [https://chinachannel.co/wechat-
launches-new-mini-program-qrc...](https://chinachannel.co/wechat-launches-new-
mini-program-qrcodes/)

~~~
ravenstine
I think it's the same for the Americas, but just because the average person
doesn't use QR codes very much that doesn't mean that such technologies aren't
being used in ways that aren't widely reported. For instance, I know someone
who placed small barely-visible QR codes in videos that get passed off to
editors so that each clip and frame number(and other info) can be detected
programmatically despite editing software stripping out metadata. I think QR
is one of those things that solves very niche problems that even the average
engineer might not be made aware of.

People are quick to point out "nobody uses QR" but it's not exactly fair to
expect ubiquity from something like that. My response would be the same for
those in this thread saying "people can't recognize JAB codes like they can
with QR." Well, those who find a use for JAB codes are _probably_ going to be
the people using them 99% of the time(maybe more than QR because of data
density), thus they're almost certainly know to know how to recognize them.

~~~
reaperducer
_People are quick to point out "nobody uses QR" but it's not exactly fair_

I think everyone uses them, but they just don't know it.

Pretty much every label on every consumer good (in America, at least) from
cough syrup to Coca-Cola to computer chips has a tiny QR code on it. But since
people don't actively engage with the code, they don't realize that it's
there, and is a big part of the process of getting things from raw material to
store shelves.

------
theclaw
An eight-colour code does not seem smart for printed codes where most printers
use only four inks. A colour code using cyan, magenta, yellow, white and black
might be more reliable (although yellow could easily be confused with white).
The PDF suggests 256-colour codes are supported, but that would mean
luminosity is a factor, and I can't see how that would ever be reliable if the
code is intended to be scanned with a camera.

~~~
ttsda
The codes have palettes embedded to adjust to different lighting and ink.

------
lol768
Tried a few times with the "Scan" demo on
[https://jabcode.org/create/](https://jabcode.org/create/) using Firefox for
Android, but it appears to just get stuck displaying a loading spinner.

Seems to work in Chrome, so not sure what's wrong with the implementation to
make it not work.

~~~
iceprey
To add to this, I am getting vague error messages with any text of a certain
length (longer than 100 characters or so) if I tweak any, or at least several,
of the advanced settings.

------
jasonjmcghee
Demo ([https://jabcode.org/create/](https://jabcode.org/create/)) worked on
the first example I tried, then I tried using advanced settings and it threw
an "Error Something went wrong" every time.

This was in Chrome.

~~~
nneonneo
With Advanced Settings you control the format and capacity of the code, so if
you specify too many characters or too high of an error correction level it
will fail (with that rather unhelpful error). Try increasing the version
(which adds more pixels in the X or Y direction), or adding a few slave
blocks.

(The above is based on my quick exploration with it on Safari, YMMV)

------
PhrosTT
What's the capacity of this thing? Don't see it anywhere obvious.

~~~
1ris
It's on page 13 of the spec. Up to 27kb.

~~~
jungler
It's actually indefinite by adding more slave blocks, the spec example shows
how this works up to 60 blocks, but the algorithm holds beyond that.

------
PostOnce
Imagine downloading a manifesto or something from a protest sign in a
newspaper or on TV.

Imagine downloading a working application from a barcode (perhaps assuming you
have the "reader" app which includes a set of software libraries to do some of
the heavy lifting / batteries included) -- gameboy did it. It might be useful
in a disaster, or an oppressive regime scenario, but at worst, it would be
fun.

3D models? Retro game console with games distributed on paper?

My imagination is limited, but I have a feeling that barcodes are something
waiting to meet some newly-possible potential with the advent of handheld
scanners and very high capacity barcodes.

We tried VR and PDAs and cellphones and stuff in the late 80s/early 90s, but
it wasnt until the 2010s they became something really useful; I wonder if
barcodes will find some new life in the future, now that more capable and
available hardware exists.

------
douglaswlance
Every screen and printer will display/print colors differently. This is not a
good idea.

~~~
LeoPanthera
Every HN comment thread is full of armchair critics. Maybe the designer
actually thought of this!

If the colors are quantized into a constellation, even significant error could
be corrected.

~~~
aaaaaaaaaab
Except if said colors fade over time or change their hue due to UV exposure
like most pigments used for printing.

~~~
ygra
QR codes printed on thermal paper also fade over the course of a year and
would be unreadable. There are always uncorrectable adverse conditions.

~~~
aaaaaaaaaab
Sure. And if you light the paper on fire even 24pt Helvetica becomes
unreadable.

But I’m sure you too feel that the failure modes of this colored barcode form
a proper subset of the failure modes of its monochromatic counterpart.

~~~
naikrovek
Well, if your machine-readable color key fades as well, maybe it's not so much
of a showstopper if the colors fade.

The primary problem I see is that so many industrial cameras today are black
and white. B&W cameras can send at a higher framerate and you don't need to
convert to greyscale as your first step in your algorithm, so it saves time to
use b&w cameras.

------
tsumnia
A what point is someone just going to reinvent Piet [1]?

[1]
[https://en.wikipedia.org/wiki/Esoteric_programming_language#...](https://en.wikipedia.org/wiki/Esoteric_programming_language#Piet)

------
jake_the_third
What is JAB's patent situation like? One of QR-codes most important attributes
(for us, at least) is that patent threats are relatively low.

Has research been done to see how safe implementations are from infringing on
currently-valid patents?

------
Mistri
Is it just me or is that uglier than a QR code?

~~~
guitarbill
on a phone with average brightness, it's okay. on a big monitor, it hurts my
eyes looking at it, like green text on a red background. so i genuinely hope
these never get used.

------
lettergram
Seems similar to my ChromaTags approach from 2015:

[https://austingwalters.com/chromatags/](https://austingwalters.com/chromatags/)

My post goes a bit into more detail on how it works, and why for instance -
the given colors were chosen. It appears they too use the Lab color space for
instance.

~~~
kbaker
I don't think they use the Lab color space, except if you define your own
colors to use in the palette, did you see a reference to it?

From their encoding spec: > In order to optimize the decoding of JAB Code, the
used colors shall be so distinguishable as possible. Therefore, the used
colors shall keep a distance from each other in the _RGB color space cube_

> In case of 256-color-mode, the color channel R and G take eight values, 0,
> 36, 73, 109, 146, 182, 219 and 255, and the color channel B takes four
> values, 0, 85, 170 and 255, which will totally generate 256 colors.

Which is too bad, because your idea of using Lab with ChromaTags to enable
quick and accurate finding of the symbol was a really insightful technique.
The decoding algorithm they suggest seems like it would be slow, and their use
of RGB seems like a whole bunch of issues due to color-selective fading,
shadows, damage, lighting, incorrect printer calibration, etc.

------
JdeBP
There is more information at [https://www.ident.one/de/2018/07/30/just-
another-barcode-jab...](https://www.ident.one/de/2018/07/30/just-another-
barcode-jab-code/) .

------
specialist
Is there a "human readable" bar code variation? I want something that's both
scannable and typeable.

One use case is those placards for artworks at museums and galleries. I want
to print something that's both easy to scan and easy to jot down.

~~~
reaperducer
_Is there a "human readable" bar code variation?_

Like a UPC code? Those have the contents printed right underneath.

------
ThePadawan
How does this relate to the standard of the German ministry for Information
Security (BSI) linked at the bottom of the README?

Note that isn't just one of many independent implementations as both the
repository links to BSI _and_ vice versa.

------
moonsun
I am trying to think of possible use cases. If you came across an image like
at [https://moonsun.gitlab.io](https://moonsun.gitlab.io) would you stop to
scan it using your phone?

------
fallat
I had this exact idea about a year ago:
[https://github.com/lf94/blots](https://github.com/lf94/blots)

Basically: cheap consumer printers suck. Don't bother.

------
reaperducer
Somewhat off topic, but does anyone know the name of the crazy circular moving
barcode thing that Apple uses to pair an Apple Watch with an iPhone?

------
bl4ckm0r3
Isn't the colour a problem because of the white balancing and the way cameras
"change" the colour when taking a shot?

------
xhruso00
People print codes on glossy papers or try to scan them in various light
conditions. This is not alternative for outdoor placement.

~~~
CharlesW
All barcodes can be printed on glossy papers, so that's not a unique
challenge. Various light conditions aren't terribly difficult to account for,
especially when known colors are involved (as they are here).

------
r-w
Very cool! How’s it work on a smartphone camera? ;)

------
accosine
The website [https://jabcode.org/](https://jabcode.org/) gets a solid 100 in
Lighthouse - NICE!

------
zmix
So, how many bytes can this encode? I found no reference for that.

------
dymk
Their code generator makes codes that look quite pretty (if they're large). I
imagine the patterns come from redundancy for error correction?

[https://i.imgur.com/e0OrYZo.png](https://i.imgur.com/e0OrYZo.png)

------
gf263
> master symbol and slave symbol

nooo

~~~
tomcooks
Laughed hard

------
omershapira
I wonder if the 'Master'/'Slave' terminology is necessary here? Aside from
being problematic, does it really describe the setup more than
'Primary'/'Secondary'?

~~~
jml7c5
Is it problematic outside of the US? That said, possibly not the most
immediately illustrative choice of terms; master/slave usually implies who's
in charge, not a spatial relationship.

~~~
CharlesW
Slavery/human trafficking is not a US-only thing.

[https://en.wikipedia.org/wiki/Slavery_in_the_21st_century](https://en.wikipedia.org/wiki/Slavery_in_the_21st_century)

------
qume
Cameras only see one colour per pixel (i.e. Bayer colour filter array).
Because our eyes are not so acute at resolving colour compared to luminescence
this tradeoff works well.

But in this context I'm not sure at a pixel level how much 'extra' information
is added by _removing_ red/green from the blue pixels, green/blue from the red
etc.

In other words, if the image came from a digital camera, to actually stuff
more information into the same number of pixels, colour may or may not help.
In any case working with the raw CFA bayer source image would almost certainly
be beneficial over interpreting the image after it has been converted to a
normal RGB image (losing information in the process)

~~~
neetdeth
This is an interesting point, but it assumes perfect optics. If the image is
slightly out of focus, I think three lower resolution images in different
spectral regions is a big win.

~~~
qume
I think it depends on the context - if you're designing the whole system from
bar code to camera, I'm not sure that the color will help. But in that case
you can assume close to perfect optics and I'm not sure if you would find an
improvement or the opposite over a monochrome setup with better SNR.

On the other hand if you're stuck with things like mobile phone cameras, and
can only control the bar code side, then Id imagine you'd see some
improvements as you say.

An interesting middle ground would be if you could get the raw image from the
sensor before a generic debayer algorithm gets applied.

Good luck, keep up the good work... i've worked commercially on optical
barcode systems and it's a super interesting topic (tho looks like my post has
been downvoted out of existence so maybe you wont see this).

~~~
neetdeth
I don't want to represent myself as one of the inventors! I just saw this on
HN, skimmed the technical report, and found a bunch of comments on HN that
could be answered with my cursory knowledge thus gained.

What I can offer is that it is now possible to get memory buffers containing
"raw" sensor data from mobile phones. I've only done it on iPhone so far, but
the "camera2" API on Android looks to support this as well. It only works in
single-shot photo mode - I suspect there isn't the bandwidth to do 30 fps
streaming, and they rely on the ISP for debayering and color space conversion
in video mode.

iPhones seem to have negligible chromatic aberration in their raw output,
weirdly, so that isn't a blocker for full sensor resolution grayscale imaging.
Someone could exploit this to write the world's greatest mobile phone QR
reader app.

