← All cases

Brick marking

A barcode that has to survive the kiln

Year
2023
Type
Marking & Identification
Material
Brick
Format
R&D
Technology
ML / Computer Vision
Reading
5 min
Two fired bricks with an RM4SCC code on the face

Translated from Russian.

In 2023 we investigated whether every brick could be marked right in the clay: a code pressed into the wet blank on the forming line, carried through drying and firing, and read by an ordinary phone camera. The study ended in a well-grounded decision not to take it into production — and that is a result too.

The task

The customer needed every brick marked individually, without stickers: an imprint in the clay itself while the blank is still soft.

The main difficulty is clear from the start. After forming, the clay column dries and goes into the kiln; the clay shrinks and warps, and the code warps with it — the bars change size and shape. Yet the code must be read with an ordinary phone, on the shop floor, in poor light, with shadows and dirt on the surface.

Many doubted the idea would work. The study went ahead all the same: a decision should rest on test results, not on forecasts.

First attempt: Code128

We started with the standard linear Code128. It was rolled onto the wet clay column right on the line; we printed reference sheets at different scales and built in an allowance for shrinkage.

Sheet of Code128 references at different scales next to a brick
References: 1:1, 2:1, with 4 mm shrinkage, with 2 mm correction
Raw and fired bricks with a linear code
Raw on the left, fired on the right
Cut of a wet clay column with a code imprint
Imprint on the wet clay column
Brick with a linear code in a stack
A coded brick in the stack
Rolling the code on the line
The column after rolling

After drying and firing the code could not be read. Code128 stores data in the widths of bars and gaps, and the clay distorts exactly the width: a narrow bar spreads into a wide one, and the code loses its meaning.

Choosing a format: RM4SCC

The next step was choosing a format. We compared about a hundred encoding methods against two requirements:

  • as much error-correction headroom as possible — the code deforms heavily as it dries;
  • reliable reading at low contrast, in shadows and with dirt.

RM4SCC fit best — the Royal Mail postal code used to sort letters.

Diagram · bar deformationLeft, Code128: before firing the bars are narrow and wide; after deformation the widths blur and the code cannot be read. Right, RM4SCC: after deformation widths blur too, but bars are still clearly up, down or in the middle, and the symbols read.Diagram · bar deformationCode128: meaning is in widthRM4SCC: meaning is in height and positionas formedafter drying and firingas formedafter drying and firingnarrow or wide?unreadabletop · middle · bottomreads as "3", "0"Bars are illustrative: this is not a real code.
Why Code128 did not survive deformation and RM4SCC did

Each symbol consists of four bars. The bars differ only in height and position relative to the centre line: short in the middle, up, down or full height. Bar width and the gaps between them carry no data, so the deformation of the clay does not change the meaning of the code.

Diagram · RM4SCC symbolThe four RM4SCC bar types: tracker, ascender, descender, full. Symbol "3" is made of a descender, a tracker, an ascender and a full bar — exactly two go up and exactly two go down. If one bar is unreadable and the other three are a descender, an ascender and a full bar, two already go up and two down, so the missing one is a tracker.Diagram · RM4SCC symbolFour bar typesA symbol = 4 barsOne bar is unreadableStrackerAascenderDdescenderLfullDSAL3up — exactly 2 of 4down — exactly 2 of 4?already 2 up → no topalready 2 down → no bottomso it is a tracker
How an RM4SCC symbol is built and how an unreadable bar is restored
Diagram · RM4SCC symbolsAll 36 RM4SCC characters — digits 0–9 and letters A–Z — in a 6 by 6 grid, each made of four bars on the middle line. The table row sets which bars go up, the column which go down. Bars: S — short, A — up, D — down, L — full height. A code starts with an ascender and ends with a full bar.Diagram · RM4SCC symbols0SSLL1SDAL2SDLA3DSAL4DSLA5DDAA6SADL7SLSL8SLDA9DASLADADABDLSACSALDDSLADESLLSFDAADGDALSHDLASIASDLJADSLKADDALLSSLMLSDANLDSAOASLDPADADQADLSRLSADSLSLSTLDASUAADDVALSDWALDSXLASDYLADSZLLSSS — shortA — upD — downL — fullstartstop
RM4SCC symbol table

In every symbol exactly two bars go up and exactly two go down. If one bar of the four cannot be read, but its position is known and the other three are recognised correctly, it can be restored.

Prototype on the line

The code was applied the same way as Code128: a roller with the code in relief rolls over the wet clay column.

Black roller with the code in relief
Roller with the code in relief
Roller on the forming line next to a clay column
Roller on the forming line

Out of the kiln the brick came with bloom, cracks and dirt on the surface — recognition had to cope with that.

Recognition

For RM4SCC we tested three models in sequence:

  1. The first marked each symbol with its own colour to split the code into groups of four bars. This approach did not work.
  2. The second read the whole code: an image in, a string of symbols out.
  3. The third worked at the level of individual bars: it determined the type of each bar, CTC combined the results into a string, and symbols were assembled from groups of four bars.

The models were trained on synthetic data: the code on brick and stone textures with shifts, tilt and shape distortions.

Synthetic RM4SCC symbols on different brick and stone textures
Synthetic data on different textures
Grid of inputs for the second model: code images and their labels
Second model: inputs and symbol labels
Eight synthetic codes: the recognised string matches the reference
Second model on synthetic data: recognised / reference
Diagram · CRNN + CTCThe code image is split into 16 columns. A CNN computes features for each cell, each column becomes a vector, a BiLSTM reads the vectors both ways, and every column gets its most likely class: A, D, S, L or blank. CTC merges repeats and drops blanks, giving DSALSSLL; four bars at a time these are the symbols 3 and 0.Diagram · CRNN + CTC01 Inputcode strip02 CNNcell features03 Column → vector04 BiLSTMreads both ways05 Probabilitiesclass × column06 Best classper column07 CTCmerge repeats08 CTCdrop "–"09 4 bars eachsymbol from tableCNN→←ADSL–DDS–AAL–S–S–L–L–DS–AL–S–S–L–L–DSALSSLLD S A L →3S S L L →0= "30"A — up · D — down · S — tracker · L — full · "–" — CTC blank
How a CRNN breaks down the code image

The last symbol of an RM4SCC code is a check symbol: it is computed from all the others and shows whether the code was read correctly. We also used it to repair damaged codes. If a symbol was not recognised, CTC put the [UNK] marker in its place, and the position of the gap was known exactly — that is why CTC was needed. The allowed symbols were then substituted into that place by brute force, checking the check symbol each time: on a match the code counted as repaired.

Diagram · check symbolThe code on the brick: start bar, content 3 0 A 4, check symbol Q, stop bar. Q comes from the sums of the symbols' row numbers (5) and column numbers (15) in the RM4SCC table, modulo 6: row 5, column 3. If symbol A is not read, [UNK] stands in its place; trying symbols 0 to F shows the check symbol only matches for A.Diagram · check symbolCode on the brickstartstop30A4QcontentcheckWhere Q comes from30A4summod 6row (bar tops)column (bar bottoms)1121415551553row 5, column 3 →QA remainder of 0 counts as 6.recognised30[UNK]4Q← check symbol readbrute force0123456789ABCDEFcheck30A4Qmatches only for "A"CTC marks an unreadable symbol as [UNK], so the gap position is known exactly.Only symbols that occur in the code are tried.
Where the check symbol comes from and how it repairs the code

After experiments with models, image correction and code recovery, we narrowed the model’s task: it only finds the boundaries of the marking, while an algorithm normalises the image and decodes the bars. In tests this combination proved the most reliable.

Recognition: the whole brick, zoom-in with alignment, processing stages, detected bars
Decoder debug output: bars split into top, bottom and middle
The decoder splits bars into top, bottom and middle

This is how reading with a phone camera looked:

Reading the code on a brick
The scanner recognised the code on a brick
Code recognised

Results

The study confirmed:

  • linear Code128 does not suit an imprint in clay: deformation destroys data stored in bar widths;
  • RM4SCC, where data is stored in the height and position of bars, survives drying and firing and can be read by a phone camera;
  • the most reliable approach is the pairing “the model finds the marking — an algorithm normalises and decodes”; the check symbol allows damaged codes to be repaired.

The customer’s decision

Item-level marking did not go into production. The customer chose ordinary batch labelling: a sticker with a DataMatrix code on each batch. The work remained a research project.

Pallet of bricks with a batch label
Batch label on a pallet
Bricks with labels of different batches
Labels of different batches

Highload.Zone · R&D

Does every problem have a solution?

In theory, the answer is yes. But we only take on technical problems in our work and rely on our technical experience. Tell us about your problem, and we will explore every option available.

hello@highload.zone