Skip to content

Instantly share code, notes, and snippets.

@Luxato
Last active April 23, 2024 06:34
Show Gist options
  • Save Luxato/384a7c8a6bfdeba09d54cb5bd6b2c9fb to your computer and use it in GitHub Desktop.
Save Luxato/384a7c8a6bfdeba09d54cb5bd6b2c9fb to your computer and use it in GitHub Desktop.
Take picture from USB camera with python
import cv2
import imutils
import time
cap = cv2.VideoCapture(0)
ret, frame = cap.read()
def takePicture():
(grabbed, frame) = cap.read()
showimg = frame
cv2.imshow('img1', showimg) # display the captured image
cv2.waitKey(1)
time.sleep(0.3) # Wait 300 miliseconds
image = 'C:\Users\Lukas\Desktop\REMOVE\capture.png'
cv2.imwrite(image, frame)
cap.release()
return image
print(takePicture())
@bneigher
Copy link

bneigher commented Feb 7, 2021

same search from google. this code is about to blow up dawg 🔥

@Javedbbcc
Copy link

How i can access my USB camera through python script for live video capturing...

@krizada1
Copy link

Google search: control of usb camera python

Thanks 🥇

@KyleJFischer
Copy link

Google Searched: "USB camera python" and found this! Thank you dude!

@Javedbbcc
Copy link

Javedbbcc commented Sep 7, 2021 via email

@mjfountain
Copy link

I found this on Google using "python usb camera capture"
1st: Stackoverflow
2nd: YT Nicholas Renotte
3rd: Your Link!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment