Python Forum
New to Python, help with saving image from camera
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New to Python, help with saving image from camera
#2
The cv2.imwrite("who.jpg", img) is inside the loop, so every img shown on the screen
is written into that filename. I don´t think that is what you want and i assume the code can´t write that fast.
In addition cv2.imwrite() returns an integer, if i´m not wrong 0 means ok, 1 means error.

Untested and only an idea:
    # Display the resulting frame
    img = cv2.imshow('Server Room', frame)
 
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
    if cv2.waitKey(1) & 0xFF == ord('p'):
        err = cv2.imwrite("who.jpg", img)
        print(error)
        break
Should save an image if you press p key and then quit.
Reply


Messages In This Thread
RE: New to Python, help with saving image from camera - by ThomasL - Aug-27-2019, 12:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Saving progress in a Python program to use later Led_Zeppelin 9 2,211 Sep-11-2022, 01:32 PM
Last Post: snippsat
  Get image from PI camera and analyze it korenron 0 1,178 Apr-28-2022, 06:49 AM
Last Post: korenron
  Upload image to Instagram using python/selenium using image URL failed, need help greenpine 5 5,531 Feb-22-2022, 09:42 PM
Last Post: snippsat
  saving and loading text from the clipboard with python program MaartenRo 2 1,680 Jan-22-2022, 05:04 AM
Last Post: MaartenRo
  Create RTSP stream from camera? korenron 1 3,286 Jan-04-2022, 10:38 AM
Last Post: Larz60+
  Showing and saving the output of a python file run through bash Rim 3 2,508 Oct-06-2021, 10:48 AM
Last Post: gerpark
  How to get OpenCV to display entire camera frame? George713 1 3,283 Aug-12-2021, 02:45 AM
Last Post: Pedroski55
  saving only one line of a figure as an image (python matplotlib) nitrochloric 0 2,045 Nov-23-2020, 01:41 PM
Last Post: nitrochloric
  Wifi Camera Connection MeenAg 2 3,128 Oct-02-2020, 06:35 PM
Last Post: MeenAg
  PIL Image / python-resize-image AttributeError sallyjc81 1 5,036 Aug-02-2020, 12:06 AM
Last Post: scidam

Forum Jump:

User Panel Messages

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