I'm trying to convert images to video, but it wasn't getting the right sequence, so I'm using glob to organize it. After this I was getting erros, and then I reduced my code to this:
import re
import glob
import cv2
numbers = re.compile(r'(\d+)')
def numericalSort(value):
parts = numbers.split(value)
parts[1::2] = map(int, parts[1::2])
return parts
for infile in sorted(glob.glob('*.jpg'), key=numericalSort):
img1 = cv2.imread(infile)
cv2.imshow('image', img1)
exit()
And for some reason it isn't showing 'img1'.
I think I can't call "cv2.imread" for a variable, because in my previous code it was saying something like "its not a valid array" when I called an opencv function to work with 'img1'.
So, my questions is, why isn't imshow running, and how could I use the image """behind""" infile and work with this file.