Both QR codes and data matrices are a good choice. QRCode is more commonly used for end-user applications, and the data matrix is more common in robotic and industrial applications. If you needed maximum flexibility, I would recommend Data Matrix, and a few years ago it was even more robust code. But since the QR Code is so popular these days, and since there are so many implementations available, you can use the QR code.
Both QR Code and Data Matrix are reliable codes. They can withstand certain damage, and good decoders will work even if the code is viewed at an angle, uneven lighting, or even if the code is located on a curved surface. One of the advantages of codes with built-in error correction is that they have only two read results: success, which gives the correct data or decoding failure and lack of data. You will not be mistaken.
Open source implementations are likely to work fine for high contrast codes (like black ink on white paper), but if you run into problems, you might consider buying a cheap commercial smart camera from an industrial machine design company. A few years ago, I cut a data matrix into a piece of light pink rubber with a hand knife, and, looking at the light, the code was available for an industrial-quality decoder.
source share