0

I want to run a python file in google colab. The file will also show an image in a loop. But whatever I do, I am not able to show the image.

cam = cv2.VideoCapture('etcs/waste_2.mp4')
ret_val, image = cam.read()
while i<50:
    ret_val, image = cam.read()
    i+=1
    image,new_centers = TfPoseEstimator.draw_humans(image, humans, imgcopy=False)

    logger.debug('show+')
    cv2.putText(image,
                "FPS: %f" % (1.0 / (time.time() - fps_time)),
                (10, 10),  cv2.FONT_HERSHEY_SIMPLEX, 0.5,
                (0, 255, 0), 2)
    cv2_imshow(image)
    imshow(np.asarray(image))
    plt.show()
    sleep(1)
    
    fps_time = time.time()
    if cv2.waitKey(1) == 27:
        break
    logger.debug('finished+')

Output:

no image

1 Answer 1

1

Use the command 'run' instead of '!python' to execute .py file. enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.