How to display smart camera images in real time in mappView interface?

Hello everyone.
I’m doing some smart camera development with mappVision, and I’d like to display the camera image in real time in my mappView interface, any recommendations on how to do this? If possible, it would be nice to provide a simple routine for reference. Thanks a lot!

Hi Wenjie!

From my point of view there are two solutions to this:

  • First one, no official library, but easiest to implement
  • Second one, official approach

First solution

From B&R Spain @javier.novella developed a library with two function blocks: ViEsGetCameraImage (uploads the camera image to a buffer) and ViEsStoreImage (saves the camera image in a File Device). Those function blocks are really easy to implement. The library has documentation included, to open press F1 above the library in AS, inside the help you will find also examples. Afterwards, once you have the image saved you can show it in mappView visualization. I attach it here:
ViEsTools_v1.0.0.zip (160.4 KB)

Second solution

From mappVision 5.20 function block ViBaseGetImage was released.

With function block ViBaseGetImage, the last acquired image can be retrieved from the camera and stored in a data buffer in DRAM memory on the PLC. This image can then be displayed in a mapp View HMI application or persisted using library FileIO.

There is an entire use case of this:
B&R Online Help - Use cases: Backing up, displaying or providing the camera image

Whatever solution you choose, please share it with us. Good luck :slight_smile:

4 Likes

Another possibility (with a big caveat) is to use the Image widget in mapp View. While this is a pretty straight-forward way to show the image on the HMI, the caveat is that the HMI client will have to be configured with the correct routing to be able to reach the camera directly.

To get this to work, start by binding the attribute “image” to the url of the camera:

http://IP_ADDRESS_OF_CAMERA:8080/jpg?q=QQ&t=TS

  • IP Address of the Camera: You’ve already specified a subnet for Ethernet traffic in your PLK network, e.g. 192.168.200.240 as shown below. In this example, for a camera that is configured for node number 1 on PLK, its IP address will be 192.168.200.1

image

  • QQ: Quality/compression factor for the JPG (try 50% to reduce the size of the image)

  • TS: this “timestamp” should be incremented once a new image is available to refresh the image on screen

On Windows, you can set the route by executing the following command on the CMD window:

route add 192.168.200.0 mask 255.255.255.0 PLC_IP_ADDRESS
(note that the subnet mask above is the same as configured for the PLK network)

In the near future, we’ll have a dedicated widget to make this whole process much easier.

7 Likes

@ghizonid you should create article to share info and ideas about it :slight_smile:

3 Likes

One additional hint: You have written “real time”. Please be aware that you can not create a “video stream”. You can only load and show image after image.
We made in the past some tests similar to the mentioned method from Daniel. With a jpg-compression of about 30% and a 1.3MP camera you should get about 5 fps (images per second). Therefore we switched PLK to 800µs and MTU (Powerlink) to 1500. I think more image per second is not possible.

3 Likes

Thank you very much for your reply, I was originally using the second method you suggested to receive the image data, now that I’ve tried it with the first method, I think it’s a very simple and useful feature block. :grinning:
However, the problem I’m currently experiencing is mainly with the mappView display, where there is a flickering image problem when displaying with the paper widget in the mappView, I’m not sure if you’ve encountered a similar problem.
You can see the attached picture, I set the timer to refresh the picture once every 1 second.
gif4

1 Like

Thank you very much for your reply!
This is what I tried at first, I was using mappVision 5.23 in my project and tried to use the function block ViBaseAxisBasedAcquisition() to trigger the shot at a fixed position.
At first I put the ViBaseAxisBasedAcquisition() function block into a 0.4ms loop, and I would encounter the problem of the picture not refreshing out, then I started to put this function block into a 40ms loop, which was able to refresh out the picture. However, the problem of the image not refreshing still occurs intermittently. If I don’t use this function block to trigger a fixed position shot the display is fine.
I am using image weiget in mappView. the image is in jpg and compression is 50%.

gi5