Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

DNN Superres & Video

DNN Superres works fine on images but when I try and use video it creates a 1KB empty video file? (No errors otherwise)

sr = dnn_superres.DnnSuperResImpl_create()

path = "FSRCNN_x3.pb"
sr.readModel(path)
sr.setModel("fsrcnn", 3)

capture = cv2.VideoCapture('./outtest.mp4')

width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT))
currentfps = int(capture.get(cv2.CAP_PROP_FPS))
frames = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
Duration = int(frames/currentfps)
fps = 2*currentfps 

out = cv2.VideoWriter('./Output.mp4', cv2.VideoWriter_fourcc(*'avc1'), (currentfps), (width,height), 0)

while(capture.isOpened()):
    ret, frame = capture.read()
    if ret == True:

        result = sr.upsample(frame)
        out.write(result)

    else:
        break

capture.release()
out.release()