Skip to content

Instantly share code, notes, and snippets.

View fritzfrancisco's full-sized avatar

Fritz Francisco fritzfrancisco

View GitHub Profile
@fritzfrancisco
fritzfrancisco / whitebalancer.py
Created February 7, 2025 13:52
White balance
#!/usr/bin/env python
from pathlib import Path
import os
import cv2
import argparse
# Supported OpenCV Backend Ubuntu 24.04.1 LTS
os.environ["QT_QPA_PLATFORM"] = "xcb"
os.environ["OPENCV_UI_BACKEND"] = "xcb"
#!/usr/bin/env python3
def create_response():
'''Create polited and humble response to reviewer suggestions'''
a = ['y', 'u', 'e', 'n', 'f', ' ', '?', 'a', 'p', ' ', 'r', 's', 'd', 'u', 'o', 't', 'i', ' ', 'c', 'u', 'g', 'k', 'i']
b = [4, 17, 2, 12, 8, 3, 21, 0, 18, 7, 1, 15, 20, 6, 5, 16, 19, 14, 10, 9, 13, 11, 12]
out = ''.join([x for _,x in sorted(zip(b,a))])
return out
@fritzfrancisco
fritzfrancisco / laplace_filter.py
Last active December 14, 2021 20:23
Retrieve sharp images from video
#!/usr/bin/env python3
import numpy as np
import cv2 as cv
import os
import sys
import argparse
import matplotlib.pylab as plt
@fritzfrancisco
fritzfrancisco / camera_calibration.py
Created October 11, 2021 12:40
Single camera calibration using OpenCV
#!/usr/bin/env python3
# input video file:
input_file = 'input_video.mp4'
# termination criteria
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)
# change this to your checkerboard dimensions:
width_number_of_squares = 14
''' Python implementation of basic background subtraction and object detection from
video using the OpenCV and numpy packages.'''
import cv2
import numpy as np
# input video
cap = cv2.VideoCapture('video/file/directory/goes/here')
# initiating basic background subtraction, creating a background from history=n frames
@fritzfrancisco
fritzfrancisco / count_glomeruli.ipynb
Last active March 3, 2020 23:15
Small interface for counting glomeruli in z-stacked images (.tif)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fritzfrancisco
fritzfrancisco / multiplayer.py
Last active May 12, 2022 20:42
Player implemented in python for simultaneously viewing two video inputs
#!/usr/bin/env python3
import numpy as np
import cv2
import sys, os
import argparse
ap = argparse.ArgumentParser(
description='Input specific output pathway and framerate')
ap.add_argument("-i", "--input1",type=str, required=True,