Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a8940da7b | ||
|
|
f0b35991e8 |
14
.idea/workspace.xml
generated
14
.idea/workspace.xml
generated
@@ -16,7 +16,7 @@
|
||||
<entry file="file://$PROJECT_DIR$/index.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="450">
|
||||
<caret line="42" column="46" lean-forward="true" selection-start-line="42" selection-start-column="46" selection-end-line="42" selection-end-column="46" />
|
||||
<caret line="42" column="46" selection-start-line="42" selection-start-column="46" selection-end-line="42" selection-end-column="46" />
|
||||
<folding>
|
||||
<element signature="e#0#21#0" expanded="true" />
|
||||
</folding>
|
||||
@@ -32,8 +32,8 @@
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/camera.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="75">
|
||||
<caret line="5" column="40" selection-start-line="5" selection-start-column="40" selection-end-line="5" selection-end-column="40" />
|
||||
<state relative-caret-position="240">
|
||||
<caret line="16" column="29" selection-start-line="16" selection-start-column="29" selection-end-line="16" selection-end-column="29" />
|
||||
<folding>
|
||||
<element signature="e#0#13#0" expanded="true" />
|
||||
</folding>
|
||||
@@ -191,7 +191,7 @@
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="bottom" id="Version Control" order="7" />
|
||||
<window_info active="true" anchor="bottom" id="Terminal" order="8" visible="true" weight="0.32972974" />
|
||||
<window_info anchor="bottom" id="Terminal" order="8" weight="0.32972974" />
|
||||
<window_info anchor="bottom" id="Python Console" order="9" />
|
||||
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
@@ -254,7 +254,7 @@
|
||||
<entry file="file://$PROJECT_DIR$/index.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="450">
|
||||
<caret line="42" column="46" lean-forward="true" selection-start-line="42" selection-start-column="46" selection-end-line="42" selection-end-column="46" />
|
||||
<caret line="42" column="46" selection-start-line="42" selection-start-column="46" selection-end-line="42" selection-end-column="46" />
|
||||
<folding>
|
||||
<element signature="e#0#21#0" expanded="true" />
|
||||
</folding>
|
||||
@@ -277,8 +277,8 @@
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/camera.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="75">
|
||||
<caret line="5" column="40" selection-start-line="5" selection-start-column="40" selection-end-line="5" selection-end-column="40" />
|
||||
<state relative-caret-position="240">
|
||||
<caret line="16" column="29" selection-start-line="16" selection-start-column="29" selection-end-line="16" selection-end-column="29" />
|
||||
<folding>
|
||||
<element signature="e#0#13#0" expanded="true" />
|
||||
</folding>
|
||||
|
||||
29
camera.py
29
camera.py
@@ -2,16 +2,27 @@ import pygame
|
||||
import pygame.camera
|
||||
import time
|
||||
|
||||
import cv2
|
||||
|
||||
def capture(camera_stream = "/dev/video0", camera_res = (1920, 1080)):
|
||||
pygame.camera.init()
|
||||
pygame.camera.list_cameras()
|
||||
cam = pygame.camera.Camera(camera_stream, camera_res)
|
||||
cam.start()
|
||||
time.sleep(5)
|
||||
img = cam.get_image()
|
||||
pygame.image.save(img, './capture.jpg')
|
||||
cam.stop()
|
||||
from SimpleCV import Image, Camera
|
||||
|
||||
def capture(camera_stream = 0, camera_res = (1920, 1080)):
|
||||
# cam = cv2.VideoCapture(camera_stream)
|
||||
# s, img = cam.read()
|
||||
#
|
||||
# if s:
|
||||
# cv2.imwrite('./capture.jpg', img)
|
||||
cam = Camera()
|
||||
img = cam.getImage()
|
||||
img.save('./capture.jpg')
|
||||
# pygame.camera.init()
|
||||
# pygame.camera.list_cameras()
|
||||
# cam = pygame.camera.Camera(camera_stream, camera_res)
|
||||
# cam.start()
|
||||
# time.sleep(5)
|
||||
# img = cam.get_image()
|
||||
# pygame.image.save(img, './capture.jpg')
|
||||
# cam.stop()
|
||||
return './capture.jpg'
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user