This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import glob | |
| import json | |
| import cv2 | |
| LUT = {"class0": 0, "class1": 1, "class2": 2} | |
| for each_file in glob.glob("data/*.json"): | |
| with open(each_file) as json_file: | |
| data = json.load(json_file)[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>Pose</title> | |
| <script | |
| src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils@0.1/camera_utils.js" | |
| crossorigin="anonymous" | |
| ></script> | |
| <script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>Holistic</title> | |
| <script | |
| src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils@0.1/camera_utils.js" | |
| crossorigin="anonymous" | |
| ></script> | |
| <script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>Hands</title> | |
| <script | |
| src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils@0.1/camera_utils.js" | |
| crossorigin="anonymous" | |
| ></script> | |
| <script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>Face mesh</title> | |
| <script | |
| src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils@0.1/camera_utils.js" | |
| crossorigin="anonymous" | |
| ></script> | |
| <script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>Face detection</title> | |
| <script | |
| src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils@0.1/camera_utils.js" | |
| crossorigin="anonymous" | |
| ></script> | |
| <script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |