Video monitoring in different shapes and forms is trending in diverse applications — from traditional security and public safety to more innovative insurance telematics and smart driving assistant. The next step of evolution represents the cameras with artificial intelligence functionality that can deliver a lot more value than simple video streaming and recording. They are widely used for facial recognition and consequent matching of the recognized face with the ID and related personal data. Today we’ll be talking about how to get the required data from the AI camera into the target application via flespi.
One of our long-time customers (KloudIP from Sri-Lanka) was kind enough to share his experience getting the employee data from a Howen Hero camera into the cloud server (flespi) and then into their customer-facing front-end application.
The original text was posted on our forum.
Howen Hero-TD01-G camera supports HTTP or MQTT upload, so the KloudIP guys decided to receive the data into the flespi MQTT channel and then manipulate them as they need.
Before you begin
Here’s some basic stuff you have to set up before going further. You will need:
a flespi account if you don’t have one (Free account should be fine for testing)
Two valid flespi tokens
one for Howen MQTT configuration settings to connect the camera to the flespi MQTT broker.
second for the flespi MQTT channel.
Configuring Howen TD01-G
The configuration of the Howen camera is pretty straightforward. Simply add
MQTT posting URL: mqtt.flespi.io:1883
MQTT username: your flespi token.
Configuring flespi
Now that we have the Howen camera pointed to the flespi MQTT broker we can set up flespi to correctly collect and process the relevant data.
Verify if the camera connects to Flespi MQTT broker
Log in to your flespi account and open Toolbox -> MQTT. Here you will be able to see if the MQTT session from the camera reached the flespi MQTT broker.
Note: if you don’t see an active session in Toolbox, restart the camera and do some action (e.g. simply appear before the camera) — this should trigger the creation of a new MQTT session with Flespi).
Once you see the session, we can move on to parsing MQTT messages from the camera.
Setting up an MQTT channel
Navigate to Telematics hub -> Channels -> “+” to create a new channel. Below is the config as per the requirements KloudIP had, so might need to adjust it to your needs. The most important field is the topic to consume the data from.
Understanding what is sent by the Howen camera
Open MQTT Board tool and show up before the Howen AI camera. The camera should detect your face and send some MQTT messages to flespi. You should be able to find it under the topic "facenotify". Click on this topic and you will see the device ID; click on the device ID and you will see more details like camid, devid, devmac, faces, etc.
Now you can proceed with the configuration of your flespi MQTT channel to parse MQTT messages from the Howen camera.
Open your MQTT channel and add the configuration as shown on the screenshots below.
Subscribe to the proper MQTT topic and configure the field to identify device ID:
Next is the most interesting part: we need to extract useful parameters from the MQTT message.
You can use the following command to create the MQTT channel, specify the parameters you need and the source of values for these parameters (don’t forget to replace the FLESPI_TOKEN_TO_CREATE_MQTT_CHANNEL, FLESPI_TOKEN_WITH_ACCESS_TO_HTTP_CHANNEL_MESSAGES, HTTP_CHANNEL_ID with the actual values):
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: FlespiToken FLESPI_TOKEN_TO_CREATE_MQTT_CHANNEL' -d '[{"configuration":{"clean_session":true,"client_id":"MQTT-CHANNEL-CAMERA","message":{"ident":{"index":1,"segments":3,"source":"topic"},"parameters":[{"name":"age","type":"manual","value":"/faces/0/age"},{"name":"temperature","type":"manual","value":"/faces/0/Temperature"},{"name":"personUuid","type":"manual","value":"/faces/0/personUuid"},{"name":"name","type":"manual","value":"/faces/0/name"},{"name":"workid","type":"manual","value":"/faces/0/certificateNumber"},{"name":"mask","type":"manual","value":"/faces/0/respirator"},{"name":"attrGlass","type":"manual","value":"/faces/0/attrGlass"},{"name":"attrMustache","type":"manual","value":"/face/0/attrMustache"}],"payload_type":"json"},"skip_invalid":false,"ssl":true,"subscribe":[{"qos":0,"topic":"flespi/message/gw/channels/HTTP_CHANNEL_ID/+"}],"uri":"mqtt.flespi.io:8883","username":"FLESPI_TOKEN_WITH_ACCESS_TO_HTTP_CHANNEL_MESSAGES"},"name":"MQTT parameters","protocol_id":39}]' 'https://flespi.io/gw/channels'
Information sent by Howen Thermal Camera
When the camera detects a face, it sends a lot of information in MQTT messages all nested in the "faces" topic. This information can be logically split into two categories.
Parameters for any "face" detected by camera
You can get the detected temperature of a person, whether they are wearing a mask or not, and a lot of AI-based data like age, gender, wearing specs or not, skin color, hair color, calm, etc.
By the way, the device also sends the image but KloudIP did not need it for their project.
Parameters for registered "faces" (employees) on the camera
In addition to all the data you can get for "any face" described above, as well as the employee-specific information like name, work ID, personsUUID, etc., which you can use in an employee attendance application or the like.
Open the Toolbox tab for your MQTT channel to view the received data:
We have the data in flespi, what’s next?
It depends on your needs. You can send this data to Wialon using a dedicated stream, use parameters like workID or personsUUID, and build an employee attendance system using Wialon "passenger module"
Or use the flespi API to create your own application. It could be an app to log the temperature of each person who visited a building on an app to get foot-fall count in a showroom or building.
***
Once you get the data, you are the king and you decide how to maximize its value for the customers.
In case you have questions about this you can ask them to Yasintha (KloudIP) in this forum thread or to the flespi team in the Helpbox chat.