def pos_images():
#Edit this for new path of positive imges
pos_path = '/path/folder'
files = [f for f in listdir(pos_path) if isfile(join(pos_path,f)) ]
#empty array with the size of the amount of files we have
images = numpy.empty(len(files), dtype=object)
pos_num = 1
#cycle throw positives
for n in range(0, len(files)):
img[n] = cv2.imread( join(pos_path,files[n]),cv2.IMREAD_GRAYSCALE)
img_resize = cv2.resize(img[n], (45, 45))
cv2.imwrite("pos/"+str(pos_num)+".jpg",img_resize)
pos_num+=1
#Use to pull and resize negative images from image-net
评论列表
文章目录