Skip to content

Instantly share code, notes, and snippets.

@eliotsykes
eliotsykes / camfix .bashrc
Last active August 1, 2021 02:06
camfix - Terminal command to fix Mac OS X built-in webcam
#!/bin/bash
# Add to your .bashrc on Mac OSX, then run camfix in Terminal
# if the Mac's built-in camera stops working.
# Thanks to: http://osxdaily.com/2013/12/27/fix-there-is-no-connected-camera-error-mac/
alias camfix='sudo killall VDCAssistant; sudo killall AppleCameraAssistant'
@shihyuan
shihyuan / ipcam.py
Last active November 25, 2022 18:54
Stream Video with OpenCV in Python from an Android running IP Webcam
# Stream Video with OpenCV from an Android running IP Webcam (https://play.google.com/store/apps/details?id=com.pas.webcam)
# Code Adopted from http://stackoverflow.com/questions/21702477/how-to-parse-mjpeg-http-stream-from-ip-camera
import cv2
import urllib2
import numpy as np
import sys
host = "192.168.0.220:8080"
if len(sys.argv)>1:
@takuma7
takuma7 / opencv-fourcc-on-mac-os-x.md
Last active April 3, 2024 07:29
OpenCV Video Writer on Mac OS X
@johan
johan / remac.zsh
Last active July 4, 2016 13:09
osx mac address changer
function remac() {
local progress='.oO°Oo'
local airport=/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport
local ssid=$($airport -I|awk '/^ *SSID/ {print $2}')
local iface=$(networksetup -listallhardwareports|grep -A1 Wi-Fi|awk '/Device:/ {print $2}')
local mac=${1:-00$(openssl rand -hex 5|sed 's/\(..\)/:\1/g')}
echo Disconnecting Wi-Fi $iface from SSID $ssid to set new mac address $mac...
sudo $airport -z
local i n=0
# This is script version 3.0 - HPC & PyClaw in Mac OSX
# ------------------------------------------------------------------------------ #
# This version uses github and bitbucket sources
# ------------------------------------------------------------------------------ #
# ------------------------------------------------------------------------------ #
#!/bin/bash -x
echo -e "\n**************************************************************"
echo "Build a HPC system in MacOSX"
echo "**************************************************************"
@nioto
nioto / PiCameraStream
Created March 4, 2014 10:14
Simple MJpeg streamer for Raspberri Pi Camera
#!/usr/bin/python
'''
A Simple mjpg stream http server for the Raspberry Pi Camera
inspired by https://gist.github.com/n3wtron/4624820
'''
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
import io
import time
import picamera
@bellbind
bellbind / avcapture.m
Last active June 19, 2023 01:21
[objective-c][macosx]capturing image from webcam
// capture image from webcam(e.g. face time)
// for OSX 10.9 (use AVFoundation API instead of deprecated QTKit)
// clang -fobjc-arc -Wall -Wextra -pedantic avcapture.m
// -framework Cocoa -framework AVFoundation -framework CoreMedia
// -framework QuartzCore -o avcapture
#import <AVFoundation/AVFoundation.h>
#import <AppKit/AppKit.h>
@interface Capture : NSObject <AVCaptureVideoDataOutputSampleBufferDelegate>
@n3wtron
n3wtron / simple_mjpeg_streamer_http_server
Last active December 22, 2023 13:32
Simple Python Motion Jpeg (mjpeg server) from webcam. Using: OpenCV,BaseHTTPServer
#!/usr/bin/python
'''
Author: Igor Maculan - n3wtron@gmail.com
A Simple mjpg stream http server
'''
import cv2
import Image
import threading
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
from SocketServer import ThreadingMixIn
@misaelnieto
misaelnieto / live-mjpeg-stream.py
Last active April 25, 2024 03:22
Streaming MJPEG over HTTP with gstreamr and python - WSGI version
#!/usr/bin/python
#based on the ideas from http://synack.me/blog/implementing-http-live-streaming
# Updates:
# - 2024-04-24: Apply suggestions from @Pin80
# Run this script and then launch the following pipeline:
# gst-launch videotestsrc pattern=ball ! video/x-raw-rgb, framerate=15/1, width=640, height=480 ! jpegenc ! multipartmux boundary=spionisto ! tcpclientsink port=9999
#updated command line
#gst-launch-1.0 videotestsrc pattern=ball ! videoconvert ! video/x-raw, framerate=15/1, width=640, height=480 ! jpegenc ! multipartmux boundary=spionisto ! #tcpclientsink port=9999
from multiprocessing import Queue
@victorbstan
victorbstan / video_pyopencv.py
Created March 20, 2012 02:07 — forked from kriben/video_pyopencv.py
Python opencv feed from webcam
import opencv
#this is important for capturing/displaying images
from opencv import highgui
import pygame
import sys
camera = highgui.cvCreateCameraCapture(0)
def get_image():
im = highgui.cvQueryFrame(camera)
# Add the line below if you need it (Ubuntu 8.04+)