A couple of weeks ago, we discussed how to use the Bosch security cam to monitor the occupancy level of a parking lot. In today’s article, we’ll discuss how to integrate the camera image into a Peakboard application.
There are two different methods:
- Regularly download and refresh a web image.
- Use the RTSP stream from the camera.
By embedding a web image rather than a stream, we reduce the technical complexity and network bandwidth. But the best choice is determined by the use case.
For monitoring a parking lot and its occupancy, the web image is the best choice, because the situation doesn’t change within seconds. Refreshing the image every minute is sufficient for the viewer.
The story is different when we monitor moving traffic or even a machine with moving parts. Here, the use of streaming makes much more sense, because we want to give new information to the viewer immediately.
Embed the camera picture
To embed the Bosch cam image, we use a web page control. In the URL field, we enter the URL of the image.
To authenticate against the source, we enter our credentials into the URL, just in front of the IP address or server name: UserName:Password@ServerName/...
. Here’s an example for our current demo environment:
We can set the refresh time in seconds, as a control property. No need for any programming to manage the automatic refresh.
Configure the stream
Before we use the camera stream in our application, we need to configure it carefully. It’s important to set the stream resolution and the frame rate to reasonable values. In our case, 512x288 pixels at 6 FPS (frames per second) is totally sufficient.
The default values are often ridiculously high (Full HD or even 4K resolution with frame rate of 30 FPS). This unnecessarily wastes bandwidth and could even cause the stream to fail, if the network can’t handle the bandwidth.
The Bosch cam comes with 4 streaming endpoints to support 4 different stream settings. This screenshot shows our configuration as the second stream:
Embed the stream in Peakboard
To embed the stream in the video control of our Peakboard application, we use a similar URL to the web image option, but with a different protocol. For streaming, we use RTSP. Actually, all professional-grade cameras support this protocol.
The inst
parameter defines the stream endpoint, as configured in the back end (in our case, it’s stream endpoint 2), along with the username and password:
In case we want some more metadata to be displayed directly in the stream (e.g. the recognized types of vehicles), we can use the parameters meta
and vcd
. Then, the URL would look like this:
To find out more about the parameters and their usage, see the PDF documentation.
Result
Here’s the result of our demo board for the parking lot. You can see that the quality of the static image is actually better than the stream, because we configured the stream with a very low resolution.