Bart91

Image_is_jpeg.py

Dec 2nd, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. def main():
  2.   for directory in ['train','test']:
  3.     bilder_pfad = os.path.join(os.getcwd(), 'images/{}'.format(directory))
  4.     for bilder in glob.glob(bilder_pfad + '/*.*'):
  5.       if not bilder.lower().endswith(".xml"):
  6.         bild = cv.imread(bilder)
  7.         datei_type = imghdr.what(bilder)
  8.           if datei_type != 'jpeg':
  9.             cv.imwrite(bilder, bild)
Add Comment
Please, Sign In to add comment