Skip to content

Instantly share code, notes, and snippets.

View jayrambhia's full-sized avatar

Jay Rambhia jayrambhia

View GitHub Profile
@maxlapshin
maxlapshin / capture_raw_frames.c
Created September 30, 2011 11:50
v4l2 capture example
/*
* 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>
@jayrambhia
jayrambhia / download-monitor
Created January 14, 2012 14:08
Monitor your downloading data
import pcap, dpkt, socket
import os
import time
pc = pcap.pcap('eth0')
ports = (80, 8080, 443, 888)
def process():
t = time.time()
i = 0
@mike-lawrence
mike-lawrence / py_multi_cv_save.py
Created June 2, 2012 18:38
Python code to timestamp webcam images in one process and save them in another
########
# 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()
@jayrambhia
jayrambhia / Makefile
Created May 30, 2013 12:53
Using Kinect with Freenect and OpenCV (C++ version)
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)