webcam-capture

Is it possible to read webcam frames in parallel?

为君一笑 提交于 2019-12-02 18:36:15
问题 I have a simple Python script that captures a webcam using OpenCV. My webcam has the potential to stream 30 FPS, but since my Raspberry Pi isn't powerful enough, I can only read ~ 20 FPS. When running the script, one core of my CPU is maxed to 100%, but the the rest of the cores are untouched, so I am trying to split up the reading into the most threads I can in order to use my CPU to it's maximum potential and easily reach 30 FPS. So is it possible to read webcam frames in parallel? This is

Is it possible to read webcam frames in parallel?

百般思念 提交于 2019-12-02 11:29:32
I have a simple Python script that captures a webcam using OpenCV . My webcam has the potential to stream 30 FPS, but since my Raspberry Pi isn't powerful enough, I can only read ~ 20 FPS. When running the script, one core of my CPU is maxed to 100%, but the the rest of the cores are untouched, so I am trying to split up the reading into the most threads I can in order to use my CPU to it's maximum potential and easily reach 30 FPS. So is it possible to read webcam frames in parallel? This is my attempt: import numpy as np import cv2 import time from threading import Thread CV_CAP_PROP_FPS = 5

Convert image from pygame to PIL image

夙愿已清 提交于 2019-11-29 15:29:02
we are using a Raspberry Pi + Python 3.4 + PyGame to capture an image from a specific USB webcam. We use this simple code to capture (it works ok): pygame.camera.init() cam = pygame.camera.Camera(pygame.camera.list_cameras()[0],(1280,720)) cam.start() time.sleep(1) webcamImage = cam.get_image() The problem comes here: we have to convert this webcamImage into a PIL image. We follow this link but unfortunately the function Image.fromstring() not exists anymore. So, we can't do that : pil_string_image = pygame.image.tostring(webcamImage, "RGBA",False) pil_image = Image.fromstring("RGBA",(1280,720

GStreamer - Webcam stream from Raspberry to VLC-PC

安稳与你 提交于 2019-11-26 23:17:45
问题 I'm trying to stream webcam video from a Raspberry to a VLC player using gstreamer 1.0. Right now i got the following command for the Raspberry: gst-launch-1.0 -vv -e v4l2src device=/dev/video0 \ ! videoscale \ ! "video/x-raw,width=352,height=288,framerate=10/1" \ ! queue \ ! x264enc \ ! h264parse \ ! rtph264pay config-interval=10 pt=96 \ ! udpsink host=239.255.12.42 port=5004 And the following sdp file to play the stream with vlc: c=IN IP4 239.255.12.42 m=video 5004 RTP/AVP 96 a=rtpmap:96