I am running a pose tracking application on Colab (with mediapipe). It does not show a continuous video, instead it runs my video frame by frame, showing them in succession in the output section below my block of code. So it becomes very slow at processing a single video and I have the output section full of frames, so I have to scroll a lot of stuff to check the top or the bottom of the output section. The goal is to have a video stream like a normal linux application on my PC.
This is the main() file of my application
cap = cv2.VideoCapture('1500_doha.mp4')
pTime = 0
detector = poseDetector()
while cap.isOpened():
success, img = cap.read()
width,height, c=img.shape
img = detector.findPose(img)
lmList = detector.findPosition(img, draw=False)
angle=detector.findAngle(img, 11, 13, 15) #attenzione, cambia braccio ogni tanto!!
cTime = time.time()
fps = 1 / (cTime - pTime)
pTime = cTime
text=cv2.putText(img, str(int(fps)), (70, 50), cv2.FONT_HERSHEY_PLAIN, 3,
(255, 0, 0), 3)
cv2_imshow(img)
cv2.waitKey(10)
The problem is clearly in cv2_imshow()
, because if I run a YOLO-V4 box detector I don't need this command and I obtain a continuous stream. Have you any suggestions? Is there already a solution online?
Here you find part of the output box of my google colab.
Here you find the complete file https://colab.research.google.com/drive/1uEWiCGh8XY5DwalAzIe0PpzYkvDNtXID#scrollTo=HPF2oi7ydpdV