Skip to content

Instantly share code, notes, and snippets.

@jbonyun
jbonyun / SquareWaveWithLEDMove.ino
Created September 24, 2019 16:50
Arduino code to send a synchronizing signal to cameras
// JB 20130421
// output square wave + LED frame counter + LED sub-frame measurement
// Square Wave: sent to FSIN on the cameras, maintaining the frame rate
// Counter: LEDs count in binary for each frame
// Sub-frame: each of 8 LEDs lights up in turn, 1/8th of the way through a frame
// constants for pins
// pins for input switches
const int LEDSWITCHPIN = 48;
const int SYNCSWITCHPIN = 50;
@jbonyun
jbonyun / simple_cb.py
Created September 13, 2019 05:21 — forked from DavidYKay/simple_cb.py
Simple color balance algorithm using Python 2.7.8 and OpenCV 2.4.10. Ported from: http://www.morethantechnical.com/2015/01/14/simplest-color-balance-with-opencv-wcode/
import cv2
import math
import numpy as np
import sys
def apply_mask(matrix, mask, fill_value):
masked = np.ma.array(matrix, mask=mask, fill_value=fill_value)
return masked.filled()
def apply_threshold(matrix, low_value, high_value):