-
Notifications
You must be signed in to change notification settings - Fork 0
IOI = Image over internet
= camera image and video sharing over LAN internet
camera
- Usb webcam
- Raspberry pi camera module (rpcm)
share via
- LAN = local only
- net = world (not done yet - scary)
- periodically write camera image as jpeg file
- load this jpeg file and reload it in web interface
- writing file over and over will corrupt your sd card in the end
+ semi-simple
- grab video from camera and directly stream it to web interface
+ not writing to the fs = better fps and sd card life expectancy
+ good for simple streaming
- not interactive
- yes
- after grabbing the image you run your computer vision magic on it and than stream it
+ you can do whatever you want with your stream
The first solution i found is to use mjpeg_streamer
and raspistill
.
-
raspistill
was periodically saving image to harddrive -
mjpeg_streamer
was loading this file and displaying it on web
+ simple = just run two programs
- not interactive
- writing to fs
- streamer
sudo mjpg_streamer -i "/usr/local/lib/input_file.so -f /home/pi/stream/ -n out.mjpg" -o "/usr/local/lib/output_http.so -w /usr/local/www -p 8080
- camera image writer
sudo raspistill --nopreview -w 640 -h 480 -q 75 -o /home/pi/stream/out.mjpg -tl 100 -t 9999999 -th 0:0:0
just create your program in whatever (python / C) and using opencv (or whatever) write altered image to the disk
- you can use
picamera
to load raspicam image to opencv
- still writing to fs
+ computer vision magic
+ possible python
read the image directly from the raspicamera without writing to the filesystem
+ not writing to the fs = better fps and sd card life expectancy
- cannot alter the stream from raspicam
- cannot use other streams (webcam)
- official
- example
mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so -x 1280 -y 720 -fps 15 -ex night
- read the image directly from opencv compatible streams (webcam = yes, raspicam = no)
- possibly do some opencv magic over it (with precreated filter)
- stream it to web interface
+ not writing to the fs = better fps and sd card life expectancy
- cannot read raspicam
+ can alter the stream from cam
- cannot change the opencv filter on the fly
(not tested) imho you cannot change the opencv filter dynamically cause it is probably loaded when you run the mjpeg-command
- use opencv
- save it to jpeg file
- to display it via flask
- like this guy Ruchir Sharma
- though he is lying he is not using
picamera
just opencv stream (not compatible with opencv)
- though he is lying he is not using
- you really do not want to write the file!
+ no jpeg file write
+ python
+ opencv
- only opencv streams (no raspicam)
i found in some discussion snippet for loading camera image and using flask for displaying it directly
- it works with opencv stream encoding it into jpeg
- then setting the Content type as
image/jpeg
and it works
it looks alot like the previous solution from Ruchir
but without the saving jpeg as file part
I got this functional - the cv2.VideoStream
is loading data continuously
and flask is displaying them.
Maybe, i will create example out of this - though idk maybe i will have general solution for usbcam / raspicam soon..
Before that - the function webcam flask stream is in this branch
now it is getting interesting
+ no jpeg file write
+ python
+ opencv
+ raspicam over picamera
-
well there is this nice picamera documentation with almost all possible solutions for
picamera
- brilliant, read it through
- the code examples can use a few comments, though if you read them thoroughly it is understandable
- start at Rapid capture and processing
- read all the way to Rapid capture and streaming
- you will now everything
-
now to implement it...