Difference between revisions of "Convex Mirror"
From Robert-Depot
(→GCODE) |
|||
Line 10: | Line 10: | ||
M4 | M4 | ||
</pre> | </pre> | ||
+ | =Tests= | ||
+ | *draw a circle on blank image: | ||
+ | **<code>convert ~/Pictures/convex_mirror_storefront/work/blank.jpg -stroke White -fill none -strokewidth 1 -draw "circle 932, 932, 2, 932" ~/Pictures/convex_mirror_storefront/work/just_circle.png</code> | ||
+ | *convert to pnm: | ||
+ | **<code>convert ~/Pictures/convex_mirror_storefront/work/just_circle.png ~/Pictures/convex_mirror_storefront/work/just_circle.pnm</code> | ||
+ | *potrace to json: | ||
+ | **<code>potrace ~/Pictures/convex_mirror_storefront/work/just_circle.pnm -W 30.0 -H 30.0 -M 4.0 -i -a 0 -b geojson -s -o ~/Pictures/convex_mirror_storefront/work/just_circle.json</code> | ||
+ | *json to text: | ||
+ | **<code>/json_to_txt.py ~/Pictures/convex_mirror_storefront/work/just_circle.json ~/Pictures/convex_mirror_storefront/work/just_circle.txt 0.1</code> | ||
+ | *txt to nc: | ||
+ | **<code>./render_gcode.py ~/Pictures/convex_mirror_storefront/work/just_circle.txt ~/Pictures/convex_mirror_storefront/work/just_circle.nc 5.0 5.0 1.0 100.0</code> | ||
+ | *stream to plotter: | ||
+ | **<code>./stream3.py ~/Pictures/convex_mirror_storefront/work/just_circle.nc /dev/tty.usbmodem1a1241</code> | ||
=Workflow= | =Workflow= |
Revision as of 10:28, 24 November 2013
Self Portrait in a Convex Mirror
Contents
GCODE
- Store home:
(storing home) G90 G92 X47.0 Y47.0 M4
Tests
- draw a circle on blank image:
convert ~/Pictures/convex_mirror_storefront/work/blank.jpg -stroke White -fill none -strokewidth 1 -draw "circle 932, 932, 2, 932" ~/Pictures/convex_mirror_storefront/work/just_circle.png
- convert to pnm:
convert ~/Pictures/convex_mirror_storefront/work/just_circle.png ~/Pictures/convex_mirror_storefront/work/just_circle.pnm
- potrace to json:
potrace ~/Pictures/convex_mirror_storefront/work/just_circle.pnm -W 30.0 -H 30.0 -M 4.0 -i -a 0 -b geojson -s -o ~/Pictures/convex_mirror_storefront/work/just_circle.json
- json to text:
/json_to_txt.py ~/Pictures/convex_mirror_storefront/work/just_circle.json ~/Pictures/convex_mirror_storefront/work/just_circle.txt 0.1
- txt to nc:
./render_gcode.py ~/Pictures/convex_mirror_storefront/work/just_circle.txt ~/Pictures/convex_mirror_storefront/work/just_circle.nc 5.0 5.0 1.0 100.0
- stream to plotter:
./stream3.py ~/Pictures/convex_mirror_storefront/work/just_circle.nc /dev/tty.usbmodem1a1241
Workflow
RPi side
- OSX:
killall PTPCamera
- take photo on raspberry pi:
gphoto2 --capture-image-and-download --filename capt0004.jpg
- send to laptop:
scp capt0004.jpg rtwomey@192.168.2.1:~/Pictures/raspi
- USB reset device:
usbreset /dev/bus/usb/001/004
OS X side
- crop:
convert ~/Pictures/raspi/frame0001.jpg -crop 1450x1450+779+275 +repage square0001.jpg
- bg subtract:
python bgsubtract.py square0002.jpg square0008.jpg 20 2
- edge detect:
python edge.py square0001.jpg 20 255
- convert to pnm:
convert square0001_edge.png edge0001.pnm
- vectorize:
potrace edge0001.pnm --tight -i -s -o frame0001.svg
- send to gcode machine:
Helper script:
python process_image.py ~/Pictures/raspi/frame0024.jpg
- produces frame0024.svg
Background Subtract
- subtract one image from background with given threshold and dilations:
python bgsubtract.py background.jpg square.jpg 66 10
Processing from commandline
- install processing-java from tools menu in processing
- run from command line:
processing-java --sketch=/Users/rtwomey/processing/dm_xml/convexmirror_cmdline --output=tmp/convexmirror --run --force
- NOTE: all filenames in the app need full paths.
- run workflow with processing from commandline:
python bgprocessing.py ~/Pictures/raspi/frame0031.jpg
draw a circle
- add a circle to background:
convert background.jpg -stroke White -fill none -strokewidth 1 -draw 'circle 715,740 35,740' bgcircle.png
Error Image + Drawing Image
- compute new contours from error image. NOT DONE.
- accumulate error image. NOT DONE.
- accumulate drawing image. NOT DONE.