Implement a people counter

Hi, I have an Rpi 4 and I need to make a people counter from a live video using opencv and python. I'm new to node red, what's the best way to do this?
sorry about my English.
Thank you

Hi @gpretto

Node-RED is not very suitable for doing real-time video analytics. If you already know how to do it with OpenCV and Python, then do it with those. You could then use an Exec node in Node-RED to run your python code and do things with the results.

Ok, I already did it with python and opencv, I wanted to do it with node red to be able to create a screen that transmits it live over the network, would it be possible?

You could do that in Python too of course. However, yes this is achievable in several ways in Node-RED.

The simplest is probably to run your Python app as a service but add a link to a local MQTT server (using Mosquitto for example). This is very low overhead and easy to achieve, there are Python libraries.

Then in Node-RED, you can subscribe to the appropriate topic you've published to and output that direct to a simple Dashboard page.

You may want to read and digest this thread - Standalone Raspberry Pi Security Camera with AI "person detection"


Okay, but how do I add the link to a local mqtt?
could you explain it better?

In your python? or in node-red?

In python - example

in node-red - example

1 Like

This helped me a lot, thank you for your help.
Another way would be to implement the people counter in python and create the screen with the functions of the flask library.

Then you lose a bit of the flexibility node-red brings & lose the IoT opportunities MQTT brings.

But yes - of course you can.

Hey Dave,
I'm wondering why you are not making more advertisement for your node-red-contrib-coco-ssd node here. Seems that people use tensorflow for object counting as in this video, based on the guy's Github repository. If I'm not mistaken he uses object tracking too...

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.