0

So I am interested in using my raspi as a robot and I want to try to get a video stream from a camera attached to the raspi. I found a tutorial on how to get the video streamed over LAN using python code (https://randomnerdtutorials.com/video-streaming-with-raspberry-pi-camera/). I don't understand how it works much but I'm happy with it as it has little delay compared to the VLC method of streaming I've seen suggested to stream. My main question is would I be able to use this video stream in something like OpenCv and then use the video for facial recognition. I'm not super familiar with python (although I am learning) so if I have a fundamental misunderstanding just let me know. Thanks in advance!

1
  • the link that you provided has this program line <center><img src="stream.mjpg" width="640" height="480"></center> ........... google opencv mjpg ...... here is one of the hits .....stackoverflow.com/questions/14204185/…
    – jsotola
    Feb 24, 2019 at 5:05

2 Answers 2

0

Ok, the answer to the question is it possible to do that is yes, if you have a video stream you can run object detection algorithms on the stream.

Here's a result I get searching for opencv video object detection Here's one from opencv.org for opencv video facial recognition

I'm sure you could also do this with tensorflow, but I haven't done anything with tensroflow beyond basic object detection following this guide.

Python is the common language for a lot of machine learning, but you're not necessarily tied to python.

If you want more information on how to do it after some research, it's probably more of a question for one of the other SE sites since it's not raspberry pi related if you're doing it on another computer. And you probably do since performance on the pi is quite low.

0

PiCamera has a usefull library for this. Full camera functionality is an option, from varying light level, exposure, previews, network stream piggybacking, the works. Me personally: i use the pi zero-w h inside my bots, and remote in with VNC. Using preview windows (which display to the 'desktop') while remoted in i have a nearly streamline laggless video stream because of the way vnc remotes in and the speeds processed via thst method(most network streams are sorely delayed due to compression and decompression times with lags upwards of seconds, and that can be catastrophic for remote droids) at most ive noted a 5 ms delay and that was using my phone and its 4g network from a state away(actually ran that test just earlier this week while away from home for work) which can be easily compensated for by running the bot at reduced speeds

5
  • So I set up my pi to connect via VNC viewer, and I'm not sure how you get the camera setup to view via VNC, whenever I run a python script using PiCamera's camera.start_preview() the camera's preview show's up on the monitor connected to my pi but not my pc's VNC viewer. Feb 24, 2019 at 23:18
  • The function i use in my GUI is: def vid(): /n/ mystream = io.BytesIO() /n/ with picamera.Picamera() as camera: /n/ camera.start_preview(fullscreen=False, window=(100,200,300,400)) /n/ time.sleep(10) #/n/ indicates new line in the progra. This allows me to view over vnc Feb 25, 2019 at 0:32
  • Wrong code my apology. Thats from a new gui im testing out. Give me a few days to track down the gui with the working 1, my labs a total mess right now. Feb 25, 2019 at 0:44
  • This is an overview and howto guide for rpi cam web interface. Ita fully viewable remotely. Mar 13, 2019 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.