sz3 / libcimbar

Optimized implementation for color-icon-matrix barcodes
https://cimbar.org
Mozilla Public License 2.0
4.22k stars 306 forks source link

answer #67

Closed yuanshengyong closed 2 years ago

yuanshengyong commented 2 years ago

Hi! Is the role of 112112 grid used to form the mat size of 10241024? Is there any connection between data blocks and grid

sz3 commented 2 years ago

Is the role of 112112 grid used to form the mat size of 10241024?

Yes. The 112x112 is a grid of 8x8 tiles (with 1px between them, so really a grid of 9x9s). This gets us to 1008x1008 (with 8px of border to get to 1024x1024).

Is there any connection between data blocks and grid

I'm not sure what the question is here. Are you asking how the data is structured within the grid?

yuanshengyong commented 2 years ago

Is the 6 6 data block in the code related to the 8 8 grid?

yuanshengyong commented 2 years ago

How to calculate the data block contained in a graph

sz3 commented 2 years ago

I'm still not sure I understand the question. I do need to update this document -- perhaps when I do, that will make things less confusing.

In regards to a "6x6": in the python implementation there is a 6x6 square of pixels sampled to determine the color of the tile during the decode -- but that's not part of the format, it's an implementation detail (and in fact, libcimbar calculates the color by sampling a different set of pixels in the tile).

yuanshengyong commented 2 years ago

image How to calculate this 1550?

yuanshengyong commented 2 years ago

How many symbols can be placed in an 8 * 8 grid?

sz3 commented 2 years ago

How to calculate this 1550?

Oops. This is an error. The number of tiles is 12400 = (112 * 112) - (4 * 6 * 6) (the 6*6 here are for the finder patterns).

yuanshengyong commented 2 years ago

Thank you for your answer. I probably understand your idea now. I see that the parameters of image size in the code are fixed, but now my hardware device does not support such a large image. Can I adjust the size by modifying the parameters to support my device

yuanshengyong commented 2 years ago

What is the meaning of the parameter interleaved_block? Why is it set to 115?Is it a suitable value for you to test?

sz3 commented 2 years ago

Can I adjust the size by modifying the parameters to support my device

This isn't currently supported. I've considered adding a functionality to the python implementation), but the optimized C++ implementation will probably only target 1080p. Scaling down the size drastically reduces transfer speed -- for example, 76x76 tiles (700x700px) == 5632*6 bits == 4224 bytes per frame (compared to 9300 for 112x112).

What camera resolution are you working with?

What is the meaning of the parameter interleaved_block? Why is it set to 115?Is it a suitable value for you to test?

cimbar interleaves (https://en.wikipedia.org/wiki/Error_correction_code#Interleaving) tiles after the reedsolomon encoding. 155 is the punctured reedsolomon block size we're using. It's somewhat arbitrary, but importantly it neatly divides 12400, the number of tiles for a 112x112. We reuse it for interleaving because we need a number that neatly divides our total tiles there as well, and in any case it's convenient to have it match the block size.