If you have any questions about the code or how it works then feel free to drop a comment. BTW I misspoke when explaining the Gaussian Blur. The reason why it's used is to reduce noise and give more consistent results. Also I recently modified the receive_frames function so that the program can handle disconnected cameras. Up until now the program would halt if your camera disconnects, requiring you to restart the program. But now after this update, if the camera disconnects then the program will print a message indicating this and it will automatically try to reconnect every 5 seconds.
Hey, this code is amazing. But I am using an rtsp endpoint to do object detection. There is 30 seconds of latency during the process. How I can reduce this? Your support will be helpful. Thanks.
Thanks! The latency will depend on your camera source. It might be possible to reduce the latency in your setup but I don't know the details of what you're using. I used MediaMTX with a Raspberry Pi to make my RTSP stream and latency is around 1 second or less.
@@PhazerTech can you please share configuration for your camera and raspberry pi device. Also, did you run your code on linux machine or windows and with gpu?
@@harshitagupta9876 I made a guide showing how to do it: phazertech.com/tutorials/rtsp.html I ran my code on a Linux machine with GPU but it should probably work on Windows with an Nvidia GPU.
You can use a simple text editor, any of them should work. To run the program you would start it inside a terminal window. In this video I used Kate which is the default editor that comes with KDE desktop.
OMGGGG you are a God sent brother I was working on something like this but you have saved me a lot of time. Please how can we get this to work with multiple camera at the same time?
Hey that's great to hear man! Glad you found it useful. For multiple cameras you can run multiple instances of the program. Just create a separate folder with a copy of the program for each camera. It might not be the most memory efficient way to do it but this way it guarantees each copy will run as a separate process for better CPU utilization with multiple cores.
@@ngomapa It's probably something to do with your camera's configuration. I set up my RTSP cameras using a Raspberry Pi and latency is only around 1 second. Here's the guide showing how I did it: phazertech.com/tutorials/rtsp.html
@@PhazerTech when I stream from my phone camera app, I have a real time footage or maybe just one second. I suspect the queue you included in the code to hold each frame from the streaming source. That will mean for frames that came late, the code will be stock waiting to process them. I will try to see if I can skip frames that came late. Even though this shouldn't be giving me a 1minute 33 seconds delay between the Camera and the code
Any IP cam that supports the RTSP protocol should work. Alternatively you can also use a webcam with a PC or Raspberry Pi to setup an RTSP stream by following my guide I made: phazertech.com/tutorials/rtsp.html
If you have any questions about the code or how it works then feel free to drop a comment.
BTW I misspoke when explaining the Gaussian Blur. The reason why it's used is to reduce noise and give more consistent results.
Also I recently modified the receive_frames function so that the program can handle disconnected cameras. Up until now the program would halt if your camera disconnects, requiring you to restart the program. But now after this update, if the camera disconnects then the program will print a message indicating this and it will automatically try to reconnect every 5 seconds.
Hey, this code is amazing. But I am using an rtsp endpoint to do object detection. There is 30 seconds of latency during the process. How I can reduce this? Your support will be helpful. Thanks.
Thanks! The latency will depend on your camera source. It might be possible to reduce the latency in your setup but I don't know the details of what you're using. I used MediaMTX with a Raspberry Pi to make my RTSP stream and latency is around 1 second or less.
@@PhazerTech can you please share configuration for your camera and raspberry pi device. Also, did you run your code on linux machine or windows and with gpu?
@@harshitagupta9876 I made a guide showing how to do it: phazertech.com/tutorials/rtsp.html
I ran my code on a Linux machine with GPU but it should probably work on Windows with an Nvidia GPU.
Great concept and info
Thanks, glad to hear it was helpful
On linux... What do you use to write code? Is there something other then vs code to use?
You can use a simple text editor, any of them should work. To run the program you would start it inside a terminal window. In this video I used Kate which is the default editor that comes with KDE desktop.
@@PhazerTech Alright. Thank you.
OMGGGG you are a God sent brother
I was working on something like this but you have saved me a lot of time.
Please how can we get this to work with multiple camera at the same time?
Hey that's great to hear man! Glad you found it useful. For multiple cameras you can run multiple instances of the program. Just create a separate folder with a copy of the program for each camera. It might not be the most memory efficient way to do it but this way it guarantees each copy will run as a separate process for better CPU utilization with multiple cores.
@@PhazerTech thanks very much
@@PhazerTech I have also noticed a whole 2 minutes of latency, do you have an idea what could be the problem?
@@ngomapa It's probably something to do with your camera's configuration. I set up my RTSP cameras using a Raspberry Pi and latency is only around 1 second. Here's the guide showing how I did it: phazertech.com/tutorials/rtsp.html
@@PhazerTech when I stream from my phone camera app, I have a real time footage or maybe just one second.
I suspect the queue you included in the code to hold each frame from the streaming source. That will mean for frames that came late, the code will be stock waiting to process them.
I will try to see if I can skip frames that came late. Even though this shouldn't be giving me a 1minute 33 seconds delay between the Camera and the code
what ip cam that we can use for this?
Any IP cam that supports the RTSP protocol should work. Alternatively you can also use a webcam with a PC or Raspberry Pi to setup an RTSP stream by following my guide I made: phazertech.com/tutorials/rtsp.html