genesis mendoza
genesis mendoza

Reputation: 63

how to resize frame of ip camera opened in python opencv

i cant seem to resize the frame output of my ip camera opened in opencv python3

    import cv2

    cap = cv2.VideoCapture('rtsp://admin:[email protected]/1')

    cap.set(3, 176)
    cap.set(4, 144)

    while(True):
        ret, frame = cap.read()
        cv2.imshow('frame',frame)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            cv2.destroyAllWindows()
            break

outputting a large frame

Upvotes: 0

Views: 7994

Answers (1)

Mauro Dorni
Mauro Dorni

Reputation: 487

Your issue looks very similar to other questions posted here Try to take a look on this one and see if it can helps you: similar question

Basically you must check if :

  1. your camera drivers support this feature
  2. the property codes you use for setting the output resolution match the ones expected from the vendor drivers
  3. the resolution is actually supported by your camera

An alternative workaround, very easy but consider it as worst case, could be resize the frame after the aquisition:

success,image = cap.read()
resize = cv2.resize(image, (176, 144)) 

Upvotes: 2

Related Questions