Python Forum
How to get OpenCV to display entire camera frame?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get OpenCV to display entire camera frame?
#2
I never used cv2 with a webcam. I only use cv2 for marking multiple-choice questions.

Got the code from here.

This seems to show the whole picture, no cropping:

def camON():
    import cv2

    cap = cv2.VideoCapture(0)

    # Check if the webcam is opened correctly
    if not cap.isOpened():
        raise IOError("Cannot open webcam")

    while True:
        ret, frame = cap.read()
        # smaller window
        frame = cv2.resize(frame, None, fx=0.5, fy=0.5, interpolation=cv2.INTER_AREA)
        # bigger window
        #frame = cv2.resize(frame, None, fx=1, fy=1, interpolation=cv2.INTER_AREA)
        cv2.imshow('Input', frame)

        c = cv2.waitKey(1)
        if c == 27:
            break

    cap.release()
    cv2.destroyAllWindows()
Reply


Messages In This Thread
RE: How to get OpenCV to display entire camera frame? - by Pedroski55 - Aug-12-2021, 02:45 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Make entire script run again every 45 mo NDillard 0 327 Jan-23-2024, 09:40 PM
Last Post: NDillard
  How to display <IPython.core.display.HTML object>? pythopen 3 46,043 May-06-2023, 08:14 AM
Last Post: pramod08728
  Get image from PI camera and analyze it korenron 0 1,176 Apr-28-2022, 06:49 AM
Last Post: korenron
  Reiszing figure to occupy entire frame fishbackp 0 1,388 Jan-06-2022, 10:33 PM
Last Post: fishbackp
  Create RTSP stream from camera? korenron 1 3,279 Jan-04-2022, 10:38 AM
Last Post: Larz60+
  How to apply a class method to an entire dataframe column tirtha9 1 5,168 Jan-03-2021, 04:44 AM
Last Post: klllmmm
  2d Array adds last element to entire list waiteup 2 2,112 Nov-19-2020, 08:25 PM
Last Post: bowlofred
Information Unable to display joystick's value from Python onto display box MelfoyGray 2 2,260 Nov-11-2020, 02:23 AM
Last Post: MelfoyGray
  Wifi Camera Connection MeenAg 2 3,126 Oct-02-2020, 06:35 PM
Last Post: MeenAg
  encrypt entire project mattc 2 2,434 Jul-21-2020, 07:05 AM
Last Post: mattc

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020