Skip to content

Instantly share code, notes, and snippets.

View faymek's full-sized avatar

Faymek Feng faymek

  • Shanghai Jiao Tong University
  • Shanghai
View GitHub Profile
@specter119
specter119 / zot_rm_empty_folders.py
Last active February 1, 2023 07:44
remove empty folders in `storage`
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
import configparser
import re
import shutil
import sys
@Quasimondo
Quasimondo / rgb2yuv_yuv2rgb.py
Last active July 5, 2024 10:57
RGB to YUV and YUV to RGB conversion for Numpy
import numpy as np
#input is a RGB numpy array with shape (height,width,3), can be uint,int, float or double, values expected in the range 0..255
#output is a double YUV numpy array with shape (height,width,3), values in the range 0..255
def RGB2YUV( rgb ):
m = np.array([[ 0.29900, -0.16874, 0.50000],
[0.58700, -0.33126, -0.41869],
[ 0.11400, 0.50000, -0.08131]])