Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

opencv python image capture

import cv2

# 1.creating a video object
video = cv2.VideoCapture(0) 
# 2. Variable
a = 0
# 3. While loop
while True:
    a = a + 1
    # 4.Create a frame object
    check, frame = video.read()
    # Converting to grayscale
    #gray = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
    # 5.show the frame!
    cv2.imshow("Capturing",frame)
    # 6.for playing 
    key = cv2.waitKey(1)
    if key == ord('q'):
        break
# 7. image saving
showPic = cv2.imwrite("filename.jpg",frame)
print(showPic)
# 8. shutdown the camera
video.release()
cv2.destroyAllWindows
Comment

PREVIOUS NEXT
Code Example
Python :: set index in datarame 
Python :: python how to create dict from dataframe based on 2 columns 
Python :: rnadom number python 
Python :: as type in pandas 
Python :: convert decimal to hex python 
Python :: python file reading 
Python :: python pyqt5 sleep 
Python :: converting int to binary python 
Python :: scipy euclidean distance 
Python :: python reserved keywords 
Python :: python create sqlite db in memory 
Python :: python check if 3 values are equal 
Python :: python open and read file with 
Python :: ipywidget datepicker 
Python :: how to know the length of a dataset tensorflow 
Python :: how to calculate sum of a list in python 
Python :: python file open 
Python :: how to connect wifi using python 
Python :: np array to tuple 
Python :: import math sqrt python 
Python :: python install jedi 
Python :: os.chdir python 
Python :: python package version 
Python :: csv writer python 
Python :: print boolean in python 
Python :: read file into list python 
Python :: how to make a stopwatch in python 
Python :: python set remove if exists 
Python :: convert all items in list to string python 
Python :: python iterate set 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =