How to generate a 3x3 Barcode Matrix Marker for AR.js?

With AR.js you can use binary barcode matrix as marker, therefore you don’t need to “train” the marker since you just can provide the binary value to the framework to recognise the marker. My question is, there are some websites providing marker Generation ( like Marker generator ) but how can I create my own marker (visual marker to print) on the fly? What is the algorithm behind this?