Top Ad unit 728 × 90


Capture Photo By USB Camera in Raspberry

We have some methods to use USB Camera, Webcam in Raspberry pi for Photo taken. You can see as bellow: 

Method 1: You need to install fswebcam too [sudo apt-get install fswebcam]

import time
import os
imageName = '%d-%m-%H%M%S' 
os.system('fswebcam -r 640x480 -S 15 --jpeg 80 --save /home/pi/Documents/raspberryProgram/'+imageName+'.jpg')
time.sleep(1)
Method 2: PyGame
import pygame, sys
from pygame.locals import *
import pygame.camera
import time
pygame.init()
pygame.camera.init
count = 0
while count < 5:
   width = 640
   height = 480
   cam = pygame.camera.Camera("/dev/video0",(width,height))
   cam.start()
   image = cam.get_image()
   cam.stop()
   pygame.image.save(image,str(count ) +'.jpg')  
   time.sleep(1) 
Method 3: OpenCV
import cv2
cam=cv2.VideoCapture(0)
img=cam.read()

cv2.namedwindow("camera", cv2.CV_WINDOW_AUTOSIZE)
cv2.imshow("camera",img)
cv2.waitKey(0)
cv2.destroywindow("camera")
Capture Photo By USB Camera in Raspberry Reviewed by Unknown on February 23, 2017 Rating: 5

1 comment:


  1. Great article by the great author, it is very massive and informative but still preaches the way to sounds like that it has some beautiful thoughts described so I really appreciate this article. Best sprechanlage mit kamera service provider.

    ReplyDelete

All Rights Reserved by JackyLe © 2018 © 2017
Edit bởi: Jacky Le | Youtube Channel: JACKY LE

Send email form

Name

Email *

Message *

Powered by Blogger.