Ask Your Question

Revision history [back]

Why are my two other frames completely black?

 import cv2
import argparse
import datetime
import time
import numpy as np

cap = cv2.VideoCapture('test.mp4')

while(cap.isOpened()):
    ret, frame = cap.read()

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)

    high_gray = np.array([88,62,35])
    low_gray = np.array([149,122,99])

    mask = cv2.inRange(gray, low_gray, high_gray)

    res = cv2.bitwise_and(frame, frame, mask=mask)




    cv2.imshow('frame', gray)
    cv2.imshow('mask', mask)
    cv2.imshow('res', res)

    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()

cv2.destroyAllWindows()

The frame window shows the video but the other two are completely black