Last active
May 31, 2017 01:18
-
-
Save mohanadkaleia/343f8dbedeed8ae54797ecf33d3012d6 to your computer and use it in GitHub Desktop.
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 os.path | |
import os | |
from PIL import Image | |
from os.path import basename | |
import sys | |
from decimal import Decimal | |
from __builtin__ import str | |
isfile = os.path.isfile | |
join = os.path.join | |
BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | |
input_path = BASE_DIR + '/cropped/' | |
print 'Start resizing process..' | |
for root, dirs, files in os.walk(input_path): | |
for filename in files: | |
img = cv2.imread(BASE_DIR + '/cropped/' + filename,3) | |
img = cv2.resize(img, (400, 250)) | |
cv2.imwrite(BASE_DIR + '/cropped_resize/' + filename, img) | |
print filename + ' is resized.' | |
print 'The process is finished successfully' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script is used to resize a set of images inside a folder, using opencv with python,