Implémentation Web basée sur le Web de l'algorithme Squiggedraw, implémenté à l'origine par Gregg Wygonik.
La version en ligne de ce projet tire une image de votre webcam et la transforme en fichier SVG à la création du tracteur.
Voici un exemple d'image de sortie générée avec cet outil:
Et voici une vidéo que mon traceur utilise cet outil:
Clone ou téléchargez ce dépôt, puis exécutez cette commande pour installer toutes les dépendances localement:
npm install
Ensuite, exécutez cette commande pour surveiller les modifications et pour lancer la page HTML dans le navigateur:
npm run dev
L'algorithme traite l'image de la manière suivante:
Retrieve photo as an array of pixels IMAGE
Set desired number of horizontal lines as LINE_COUNT
Set desired number of vertical spacing as SPACING
Set desired line amplitude as AMPLITUDE
Set desired line rotation frequency as FREQUENCY
For y :=0 to image height step image height / LINE_COUNT do
Set startx := 0
Set starty := y
Create a set of coordinates as [startx, starty]
For x := 1 to image width step SPACING do
Get brightness br of the current pixel as average of r,g,b values
Set r := (255 - br) / LINE_COUNT * AMPLITUDE
Set a := (255 - br) / FREQUENCY
Create a set of coordinates as [x, y + Math.sin(a) * r]
Pass the resulting array of coordinates to rendering application
Le fichier SVG de sortie généré avec cet outil peut être téléchargé sur le convertisseur SVG -> gcode (ou similaire) afin d'être tracé sur un traceur de stylo ou gravé sur un coupe-laser.
Si vous souhaitez mettre en œuvre l'un de ces éléments ou contribuer - veuillez créer un problème et n'hésitez pas à soumettre un RP, j'apprécierais cela.
Licence MIT