This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* V4L2 video capture example | |
* | |
* This program can be used and distributed without restrictions. | |
* | |
* This program is provided with the V4L2 API | |
* see http://linuxtv.org/docs.php for more information | |
*/ | |
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pcap, dpkt, socket | |
import os | |
import time | |
pc = pcap.pcap('eth0') | |
ports = (80, 8080, 443, 888) | |
def process(): | |
t = time.time() | |
i = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######## | |
# 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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CXXFLAGS = -O2 -g -Wall -fmessage-length=0 `pkg-config opencv --cflags ` -I /usr/include/libusb-1.0 | |
OBJS = freenectopencvmat.o | |
LIBS = `pkg-config opencv --libs` -lfreenect | |
TARGET = kinectopencv | |
$(TARGET):$(OBJS) | |
$(CXX) -o $(TARGET) $(OBJS) $(LIBS) | |
all:$(TARGET) | |
clean: | |
rm -f $(OBJS) $(TARGET) |