Skip to content

Commit

Permalink
Update queue_filter.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricve committed Aug 10, 2024
1 parent 623a488 commit 22ab7b3
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions queue_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,19 @@ def init():
FileNotFoundError('Unable to open video file')

# Initialize the video-writer if the SAVE_VIDEO is set to True.
if var.SAVE_VIDEO:
fourcc = cv2.VideoWriter.fourcc(*'avc1')
video_out = cv2.VideoWriter(
filename=var.OUTPUT_MEDIA_SAVEPATH,
fourcc=fourcc,
fps=var.CLASSIFICATION_FPS,
frameSize=(int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)),
int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
)
fourcc = cv2.VideoWriter.fourcc(*'avc1')
video_out = cv2.VideoWriter(
filename=var.OUTPUT_MEDIA_SAVEPATH,
fourcc=fourcc,
fps=var.CLASSIFICATION_FPS,
frameSize=(int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)),
int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
)

# Initialize the classification process.
# 2 lists are initialized:
# Classification objects
# Additional list for easy access to the ids.
# Classification objects
# Additional list for easy access to the ids.

# frame_number -> The current frame number. Depending on the frame_skip_factor this can make jumps.
# predicted_frames -> The number of frames, that were used for the prediction. This goes up by one each prediction iteration.
Expand Down Expand Up @@ -211,7 +210,7 @@ def init():
print('8) Releasing video writer and closing video capture')
print("\n\n")

video_out.release() if var.SAVE_VIDEO else None
video_out.release()
cap.release()
cv2.destroyAllWindows()

Expand Down

0 comments on commit 22ab7b3

Please sign in to comment.