python 2.7 - when resizing a image set only resizing one image -


when trying resize image set, resizing first image.how resize images? code:

import numpy np import os import cv2 pic_num = 1 img = cv2.imread("e:\ele/"+str(pic_num)+'.jpg',cv2.imread_grayscale) resized_image = cv2.resize(img,(100,100)) cv2.imwrite("e:\eye/"+str(pic_num)+'.jpg',resized_image) pic_num += 1 

if looping through files , change it, , don't worried time.

then can use loop in python

for example have pics 1 100

then can following:

import numpy np import os import cv2  pic_num in range(1,100):     img = cv2.imread("e:\ele/"+str(pic_num)+'.jpg',cv2.imread_grayscale)     resized_image = cv2.resize(img,(100,100))     cv2.imwrite("e:\eye/"+str(pic_num)+'.jpg',resized_image) 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -