Skip to content

Instantly share code, notes, and snippets.

View InputBlackBoxOutput's full-sized avatar
🐮

Rutuparn Pawar InputBlackBoxOutput

🐮
  • Boston, MA
View GitHub Profile
@InputBlackBoxOutput
InputBlackBoxOutput / pose.html
Created February 5, 2022 07:25
Mediapipe: Pose
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Pose</title>
<script
src="https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/camera_utils.js"
crossorigin="anonymous"
></script>
<script
@InputBlackBoxOutput
InputBlackBoxOutput / holistic.html
Created February 5, 2022 07:25
Mediapipe: Holistic
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Holistic</title>
<script
src="https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/camera_utils.js"
crossorigin="anonymous"
></script>
<script
@InputBlackBoxOutput
InputBlackBoxOutput / hands.html
Created February 5, 2022 07:24
Mediapipe: Hands
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Hands</title>
<script
src="https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/camera_utils.js"
crossorigin="anonymous"
></script>
<script
@InputBlackBoxOutput
InputBlackBoxOutput / face-mesh.html
Created February 5, 2022 07:23
Mediapipe: Face Mesh
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Face mesh</title>
<script
src="https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/camera_utils.js"
crossorigin="anonymous"
></script>
<script
@InputBlackBoxOutput
InputBlackBoxOutput / face-detection.html
Created February 5, 2022 07:23
Mediapipe: Face detection
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Face detection</title>
<script
src="https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/camera_utils.js"
crossorigin="anonymous"
></script>
<script
@InputBlackBoxOutput
InputBlackBoxOutput / segmentation.py
Created January 22, 2022 13:14
Perform skin segmentation by combining masks obtained by thresholding an image using multipe colour models
# Perform skin segmentation by combining masks obtained by thresholding an image using multipe colour models
# Modified from source: https://medium.com/swlh/human-skin-color-classification-using-the-threshold-classifier-rgb-ycbcr-hsv-python-code-d34d51febdf8
import cv2
import numpy as np
import matplotlib.pyplot as plt
def generate_RGB_mask(img):
B_Frame, G_Frame, R_Frame = [img[..., BGR] for BGR in range(3)]
@InputBlackBoxOutput
InputBlackBoxOutput / main.py
Last active January 29, 2022 04:46
Channel routing using the Left edge algorithm
from router import router, plotter
# A = ['0', 'A', 'D', 'E', 'A', 'F', 'G', '0', 'D', 'I', 'J', 'J']
# B = ['B', 'C', 'E', 'C', 'E', 'B', 'F', 'H', 'I', 'H', 'G', 'I']
# A = ['A', '0', 'B', 'C']
# B = ['A', 'B', '0', 'C']
# A = ['N1', '0', 'N2', 'N3']
@InputBlackBoxOutput
InputBlackBoxOutput / yosys.py
Created January 5, 2022 13:07
Python wrapper for Yosys
import os, re, subprocess, json
class Yosys:
def __init__(self, path):
self.yosys = subprocess.Popen(
[path, '-Q', '-T'], universal_newlines=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE
)
def process(self, filepath, save=False):
if not os.path.isfile(filepath):
@InputBlackBoxOutput
InputBlackBoxOutput / image-utils.py
Created October 18, 2021 10:37
Functions to save and show an image in IPYNB notebooks
import matplotlib.pyplot as plt
def save_image(img, filename="image.png"):
plt.plot(), plt.imshow(img)
plt.xticks([]), plt.yticks([])
plt.axes("off")
plt.savefig(filename)
def show_image(img, title="title"):
plt.plot(), plt.imshow(img)
@InputBlackBoxOutput
InputBlackBoxOutput / split.py
Created October 12, 2021 03:06
Split an image dataset into train, validation and test set for the Keras ImageDataGenerator
import os
import glob
import random
import shutil
# Parse through the respective class directories and make a list of image file paths
class_1 = glob.glob("class_1/*.png")
class_1 += glob.glob("class_1/*.png")
class_2 = glob.glob("class_2/*.png")