imwrite turns image upside down
Hello everyone.
I am reading all the frames from a video and saving them in .png picutres.
The imwrite command is saving all the images upside down.. how do I write them in righ orientation? I would try it with windows tool, but it takes more than 15minutes to turn all the 4600 images to the right orientation...
What am I missing? Below follows my code:
" import cv2 import math
def main():
cap = cv2.VideoCapture('finos.mp4')
i = 1
while (cap.isOpened()):
ret, frame = cap.read()
if (ret != True):
break
filename = './test/image' + str(int(i)) + ".png";i+=1
cv2.imwrite(filename, frame)
if cv2.waitKey(1) == 27: # exit on ESC
break
cap.release()
cv2.destroyAllWindows()
if __name__ == "__main__": main() "
Thanks in advance :)