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 json | |
import sys | |
file_name = sys.argv[1] | |
json_open = open(file_name, 'r') | |
json_load = json.load(json_open) | |
json_write = open("output" + file_name, 'w') | |
json.dump(json_load, json_write, ensure_ascii=False, indent=4, sort_keys=True, separators=(',', ': ')) |
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 cv2 | |
import numpy as np | |
def image_syn(rgb_img_path, mask_img_path, output_path, x_move, y_move): | |
# two image -> same size (3D H,W,C=3) | |
cv_image = cv2.imread(rgb_img_path) | |
mask_image = cv2.imread(mask_img_path) | |
img_gray = cv2.cvtColor(mask_image, cv2.COLOR_BGR2GRAY) | |
_thre, bw_img = cv2.threshold(img_gray, 1, 255, cv2.THRESH_BINARY) | |
rows,cols = bw_img.shape |
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 sys | |
# Cache is a data structure that stores the most recently accessed N pages. | |
# See the below test cases to see how it should work. | |
# | |
# Note: Please do not use a library (e.g., collections.OrderedDict). | |
# Implement the data structure yourself. | |
class Cache: |
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 sys | |
# Cache is a data structure that stores the most recently accessed N pages. | |
# See the below test cases to see how it should work. | |
# | |
# Note: Please do not use a library (e.g., collections.OrderedDict). | |
# Implement the data structure yourself. | |
class Node: | |
def __init__(self, url, contents): |
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, sys, time | |
if (len(sys.argv) != 2): | |
print("usage: python %s N" % sys.argv[0]) | |
quit() | |
n = int(sys.argv[1]) | |
a = numpy.zeros((n, n)) # Matrix A | |
b = numpy.zeros((n, n)) # Matrix B | |
c = numpy.zeros((n, n)) # Matrix C |