Aruco Marker Generator
Aruco Marker Generator. If looking for a docker based container with HTTP endpoint check : Aruco-NodeJS
[{"id":"183ffe1f.75ec62","type":"subflow","name":"Aruco Generator","info":"","category":"","in":[{"x":264.99999809265137,"y":53.33332443237305,"wires":[{"id":"bb2e884.49b7678"}]}],"out":[{"x":599.9999675750732,"y":46.66666889190674,"wires":[{"id":"bb2e884.49b7678","port":0}]}],"env":[{"name":"id","type":"str","value":""},{"name":"size","type":"str","value":""}],"color":"#3FADB5","icon":"node-red/function.svg","status":{"x":600.0000286102295,"y":111.66665649414062,"wires":[{"id":"bb2e884.49b7678","port":1}]}},{"id":"bb2e884.49b7678","type":"function","z":"183ffe1f.75ec62","name":"","func":"var id = msg.payload.id ||env.get('id') ;\nvar size = msg.payload.size ||env.get('size') ;\n\nmsg.payload = getImage(size, id);\nvar id_ = {};\nid_.payload = id;\n\nreturn [msg,id_];\n\nfunction gtMarkerMatrix(id) {\n var ids = [16, 23, 9, 14];\n var index, val, x, y;\n var marker = [[0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0]];\n\n for (y = 0; y < 5; y++) {\n index = (id >> 2 * (4 - y)) & 3;\n val = ids[index];\n for (x = 0; x < 5; x++) {\n if ((val >> (4 - x)) & 1) {\n marker[x][y] = 1;\n } else {\n marker[x][y] = 0;\n }\n }\n }\n return marker;\n}\n\nfunction getImage(size, id) {\n var x, y;\n var marker = gtMarkerMatrix(id);\n var image;\n\n if (size) {\n size = 'height=\"' + size + '\" width=\"' + size + '\"';\n } else {\n size = '';\n }\n\n image = '<svg ' + size + ' viewBox=\"0 0 7 7\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\\n' +\n ' <rect x=\"0\" y=\"0\" width=\"7\" height=\"7\" fill=\"black\"/>\\n';\n\n for (y = 0; y < 5; y++) {\n for (x = 0; x < 5; x++) {\n if (marker[x][y] === 1) {\n image += ' <rect x=\"' + (x + 1) + '\" y=\"' + (y + 1) +\n '\" width=\"1\" height=\"1\" fill=\"white\" ' +\n // Slight stroke to get around aliasing issues with adjacent rectangles\n 'stroke=\"white\" stroke-width=\"0.01\" />\\n';\n }\n }\n }\n\n image += '</svg>';\n return image;\n}\n","outputs":2,"noerr":0,"initialize":"","finalize":"","x":401.66665267944336,"y":53.333322525024414,"wires":[[],[]]},{"id":"54b42d8d.cda474","type":"tab","label":"Test Playground","disabled":false,"info":""},{"id":"a9cbbd1c.d418","type":"function","z":"54b42d8d.cda474","name":"","func":"msg.payload = {};\nmsg.payload.id = 7;\nmsg.payload.size = 140;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":368.3333625793457,"y":99.99998092651367,"wires":[["25a7936c.83b19c"]]},{"id":"b9bcde3c.02fdc","type":"inject","z":"54b42d8d.cda474","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":174.99995803833008,"y":99.99999046325684,"wires":[["a9cbbd1c.d418"]]},{"id":"74fea640.2c48e8","type":"debug","z":"54b42d8d.cda474","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":954.9999351501465,"y":96.66665744781494,"wires":[]},{"id":"25a7936c.83b19c","type":"subflow:183ffe1f.75ec62","z":"54b42d8d.cda474","name":"","env":[{"name":"id","value":"2","type":"str"},{"name":"size","value":"100","type":"str"}],"x":674.1666374206543,"y":98.33334732055664,"wires":[["74fea640.2c48e8"]]}]