images from device server to client, DevEncoded, attribute

I'm back slowly learning Tango Controls …
For this purpose, I'd like to manually control a beam position with motorized mirrors and camera (640x480). So, I'm writing a simple gui with buttons and display of the target.
I try two solutions to get images :
- first, I acquire frames with opencv, encode them to gray scale, and put the results in an image attribute. Client side, with Taurus widget, I'm able to display them. But the frame rate is awful : I think this is the large numpy array which slows the try (0.2 fps)
- second, same acquisition but I encode with 'encode_jpeg_gray8' and put the result in an DevEncoded scalar attribute. The frame rate is better but not terrific (4 fps)
Do you think I'm on the right way ? Is there another solution ? In a second stage, I'd like to write an auto control device servers side : is it a good idea to process image this way ?
Many thanks for your help !
Pierre Héricourt
CELIA/CNRS/Université de Bordeaux

We display 640x480 image (but with Java ATK, using RawImageViewer) at 15Hz for beam monitoring using DevEncoded and jpeg_gray8 without problem. I'm not using Taurus.


Hello Pierre,

Could you send the code for the server and the client?

I would use a step by step approach to pin point the bootleneck. Here is a example of things you can try
  1. profile the server: try the same code that you have in the server in an ipython console with timeit. Example:
    %timeit get_image()
  2. try the same as above but using a tango proxy:
    import tango
    dev = tango.DeviceProxy('…')  
    %timeit dev.image                # replace with the name of your attribute
    … compare the times with the ones above
  4. if client: …

Edited 10 months ago
Dear Pierre,

I would like to explain you our setup:

Our Image source is LimaCCDs DS that expose DevEncode color Images, 1294x964, up to ~30 fps.
The DS is configured to send Tango Event for counters and new images.

We are using TaurusImageDialog widget for the propose that you explained, adding an OpenCV codec made inhouse to decode the images using opencv lib.

from taurus.core.util.codecs import CodecFactory
cf = CodecFactory()

Also, we register an extension in taurus to manage LimaCCD images,

What does? Instead to subscribe to Image attribute (that contains the Image data) we subscribe to video image counter, the extension reads the imagen data when the video image counter tango event is receive, discarting events if there is one being processed (avoid cpu overload).

Now, some questions to find where is the bootleneck, in the server or in the client:

Are you using events? if yes, the event contains the image data? Are you using polling?
Could you put some kind of log to determine the fps in the server side? also in the client side?

Let me know if you need more info.

at DESY we use to display images online from detectors (Lambda, Eiger, Pilatus, LimaCCD, …)
LaVue. It is based on pyqtgraph.
It can also view images with 15Hz speed (depending on the image size).
You can set a frame rate in its configuration. For viewing purpose it should be OK.

On debian/ubuntu linux you can install it from DESY repo, e.g. for stretch:

curl | apt-key add -
add-apt-repository "deb stretch main" -y
apt-get  update
apt-get install python-lavue python3-lavue
More info you can get at:

Best regards,
many thanks and … so sorry : my device server and client (DevEncoded version) now run perfectly but I didn't make any change just restarted my computers (for another reason).
I'll however test your solutions for learning purpose and/or to improve the code (I never test ATK, ipython nor LIMA I'm really a beginner !)
Many thanks
Best regards

Register or login to create to post a reply.