Skip to content

Instantly share code, notes, and snippets.

@osalkk
osalkk / cv2_detect.py
Created November 4, 2015 09:34 — forked from npinto/cv2_detect.py
Simple face detection with OpenCV 'cv2' python bindings from 2.4.x
import cv2
import cv2.cv as cv
def detect(img, cascade_fn='haarcascades/haarcascade_frontalface_alt.xml',
scaleFactor=1.3, minNeighbors=4, minSize=(20, 20),
flags=cv.CV_HAAR_SCALE_IMAGE):
cascade = cv2.CascadeClassifier(cascade_fn)
rects = cascade.detectMultiScale(img, scaleFactor=scaleFactor,
@osalkk
osalkk / iot-mqtt-subscriber.py
Created October 20, 2015 07:57 — forked from shweta-nerake1/iot-mqtt-subscriber.py
mqtt-iot-subscriber
#!/usr/bin/python3
#required libraries
import sys
import ssl
import paho.mqtt.client as mqtt
#called while client tries to establish connection with the server
def on_connect(mqttc, obj, flags, rc):
if rc==0: