SquiggleCam
1.0.0
基於Web的SquiggledRaw算法的實現,最初由Gregg Wygonik實施。
該項目的在線版本從您的網絡攝像頭中拍攝圖片,並將其變成可繪圖器可繪製的激光 - 可衍射的SVG文件。
這是使用此工俱生成的輸出圖像的示例:
這是我的繪圖儀使用此工具的視頻:
克隆或下載此回購,然後運行此命令以在本地安裝所有依賴關係:
npm install
然後,運行此命令以查看更改並在瀏覽器中啟動HTML頁面:
npm run dev
該算法通過以下方式處理圖像:
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
使用此工俱生成的輸出SVG文件可以上傳到SVG - > gcode(或類似)轉換器,以便將其繪製在筆繪圖儀上或刻在激光切割器上。
如果您想實施任何一個或做出貢獻 - 請創建一個問題並隨時提交PR,我將感謝它。
麻省理工學院許可證