This file contains 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 random | |
import colorsys | |
import matplotlib.pyplot as plt | |
def create_image(w, h, color): | |
image = np.zeros((w, h, 3), np.uint8) | |
# Fill image with red color(set each pixel to red) | |
image[:] = color | |
return image |
This file contains 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
#!/usr/bin/env bash | |
drive_download() { | |
if [[ -f "$3/$2" ]]; then | |
echo "$2 already existed" | |
return | |
fi | |
echo "$2 not found, downloading..." | |
mkdir -p "$3" | |
curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=$1" > /dev/null |
This file contains 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 numpy as np | |
def hist_matching(src_img, dst_img): | |
shape = src_img.shape | |
src = src_img.ravel() | |
dst = dst_img.ravel() | |
s_values, bin_idx, s_counts = np.unique(src, return_inverse=True, return_counts=True) | |
d_values, d_counts = np.unique(dst, return_counts=True) | |
This file contains 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 | |
import io | |
def compound_unicode(unicode_str): | |
""" | |
Tranform Unicode Compound to Unicode (UTF-8). | |
Chuyển đổi chuỗi Unicode Tổ Hợp sang Unicode UTF-8. | |
Edited from: https://gist.github.com/anhtran/d317a2c52b015bb243fd262f1cad0e4f | |
""" | |
unicode_str = unicode_str.replace("e\xd2", "\u1EBB") # ẻ |