'program displays blank screen when using cv2 in Python

My program is displaying a blank screen when I run it. How can I fix it?

import cv2
import mediapipe
import time

cap = cv2.VideoCapture(1)

while True:
    success, img = cap.read()


    cv2.imshow("Image", img)
    cv2.waitKey(1)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source