robmarkcole / mqtt-camera-streamer

Stream images from a connected camera over MQTT, view using Streamlit, record to file and sqlite
GNU General Public License v3.0
239 stars 55 forks source link

Add picamera support #15

Open robmarkcole opened 4 years ago

robmarkcole commented 4 years ago

Picamera example capturing to PIL

If using picamera we can also drop opencv requirement

robmarkcole commented 4 years ago

Should just be a case of swapping WebcamVideoStream (which uses openCV for accessing USB webcams) for https://github.com/jrosebr1/imutils/blob/master/imutils/video/videostream.py and passing usePiCamera=True.

Proposed update config and docs

camera:
  video_source: 0 # an int for built in or USB source (320, 240), or PiCamera (1280, 720) or PiCameraHQ 

Note the default resolution=(320, 240) will need to be overwritten

robmarkcole commented 4 years ago

Created branch https://github.com/robmarkcole/mqtt-camera-streamer/tree/support-rpi but getting issue https://github.com/robmarkcole/mqtt-camera-streamer/issues/20

robmarkcole commented 4 years ago

Might be simpler to have a seperate camera script for the picamera and not import cv2 at all

robmarkcole commented 4 years ago

Note that alternatively the rpi camera can be setup as an mjpeg stream -> https://github.com/waveform80/picamera/blob/master/docs/examples/web_streaming.py

image
robmarkcole commented 4 years ago

Added picamera-publish.py script, hangs after first frame published with error picameraruntimeerror: timed out waiting for capture to end. Also tried numpy capture, same issue, presumably https://github.com/waveform80/picamera/issues/242

robmarkcole commented 4 years ago

Example: https://github.com/google-coral/examples-camera/blob/master/raspicam/classify_capture.py

robmarkcole commented 3 years ago

Reference simple script in https://github.com/chardorn/cambia/blob/master/critter_cam/loop_pub.py