Skip to content

Instantly share code, notes, and snippets.

@Mukosame
Last active May 15, 2019 23:32
Show Gist options
  • Save Mukosame/ebf52baee412bcc7e155485a8d282aa8 to your computer and use it in GitHub Desktop.
Save Mukosame/ebf52baee412bcc7e155485a8d282aa8 to your computer and use it in GitHub Desktop.
bic.py
import cv2
import os
input_folder = '/data/xiang/ddd/'
img_list = []
for root, _, file_list in sorted(os.walk(input_folder)):
path = [os.path.join(root, x) for x in file_list] # assume only images in the input_folder
# print(path)
for item in path:
print(item)
img_raw = cv2.imread(item)
# img_raw = cv2.resize(img_raw,(0,0),fx=1/4,fy=1/4,interpolation=cv2.INTER_CUBIC)
print(img_raw.shape)
# img_crop = img_raw[:,20:425,:]
# print(img_crop.shape)
# cv2.imwrite(item.replace('.png', '_crop.png'), img_raw)
img_bic = cv2.resize(img_raw,(0,0),fx=4,fy=4,interpolation=cv2.INTER_NEAREST)
cv2.imwrite(item.replace('.png', '_x4.png'), img_bic)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment