You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I finally reached to work with the animated.gif file. I had thought that ffmpeg will be used, this was not the case. After installing the gstreamer plugin, I was able to see the last image for the GIF file.
The plugin has, on my distribution, two errors. This is probably the same for other distributions.
The returned FPS has a value of 100 and shall be approximately 45.
The loop indication is not taken into account, so that the stream is closed after the last retrieved frame.
Within bacground.cc we don't take into account, that the last valid frame is reached.
Fixing the frame rate is not simple, I don't have a way to get the correct value.
I have write a little python script which shown what happen:
import cv2 as cv
import numpy as np
print("Opencv version:", cv.__version__)
info = cv.getBuildInformation()
video, parallel = info.index('Video'), info.index('Parallel')
print(info[video:parallel])
cap = cv.VideoCapture('../backgrounds/animated.gif')
#cap = cv.VideoCapture('../backgrounds/rotating_earth.webm')
fps = cap.get(cv.CAP_PROP_FPS)
# return 100 for the fif file, should be ~ 45 as per ffmpeg or 43.903 as
# calculated with the output from exiftool, see below
print("FPS:", fps)
cnt = cap.get(cv.CAP_PROP_FRAME_COUNT)
print("CNT:", cnt)
# 36 for animated.gif 916 for rotating_earth.webm
wait = int(1000/fps)
print("Waittime", wait, "ms");
nr=0
while cap.isOpened():
ret, frame = cap.read()
nr += 1
# the Frame is empty (902), set the frame pos. to 0 (rotating_earth.webm)
if np.shape(frame) == ():
print("Set to frame Pos 0, empty frame at", nr)
cap.set(cv.CAP_PROP_POS_FRAMES, 0)
nr=0
continue
# if the check is not done the gif file is closed after reading
# past the last frame. We set the frame pos to 0 before this happen.
if nr == cnt:
print("Set to frame Pos 0 frame", nr)
cap.set(cv.CAP_PROP_POS_FRAMES, 0)
nr=0
cv.imshow('frame', frame)
if cv.waitKey(wait) == ord('q'):
break
cap.release()
cv.destroyAllWindows()```
The text was updated successfully, but these errors were encountered:
I finally reached to work with the animated.gif file. I had thought that ffmpeg will be used, this was not the case. After installing the gstreamer plugin, I was able to see the last image for the GIF file.
The plugin has, on my distribution, two errors. This is probably the same for other distributions.
The returned FPS has a value of 100 and shall be approximately 45.
The loop indication is not taken into account, so that the stream is closed after the last retrieved frame.
Within bacground.cc we don't take into account, that the last valid frame is reached.
Fixing the frame rate is not simple, I don't have a way to get the correct value.
I have write a little python script which shown what happen:
The text was updated successfully, but these errors were encountered: