if you are using linux, unix, os x:
pip install -U setuptools
pip install -U pip
pip install numpy
pip install scipy
pip install matplotlib
#pip install PySide
if you are using linux, unix, os x:
pip install -U setuptools
pip install -U pip
pip install numpy
pip install scipy
pip install matplotlib
#pip install PySide
#undef HID_ENABLED | |
// Arduino Due ADC->DMA->USB 1MSPS | |
// by stimmer | |
// from http://forum.arduino.cc/index.php?topic=137635.msg1136315#msg1136315 | |
// Input: Analog in A0 | |
// Output: Raw stream of uint16_t in range 0-4095 on Native USB Serial/ACM | |
// on linux, to stop the OS cooking your data: | |
// stty -F /dev/ttyACM0 raw -iexten -echo -echoe -echok -echoctl -echoke -onlcr |
-- Two dashes start a one-line comment. | |
--[[ | |
Adding two ['s and ]'s makes it a | |
multi-line comment. | |
--]] | |
---------------------------------------------------- | |
-- 1. Variables and flow control. | |
---------------------------------------------------- |
######## | |
# This code creates 2 sub-processes: one that continually polls a webcam and labels each resulting image with a timestamp, and another that saves these images to file. The process that saves the images to file doesn't save all the images, but instead listens to the main process for time windows that it should save. This permits one to save only certain time windows (toss images that fall outside this time window) and avoids the capture start up lag that occurs if you simply try to poll the webcam during the time window of interest (this lag can be several tenths of a second!). Converting the images to string then pickling before queueing them was necessary because opencv's iplimage format doesn't like to be put in a queue directly. | |
######## | |
import multiprocessing | |
import cv | |
import cPickle | |
import time | |
queue_to_cam_writer = multiprocessing.Queue() |