From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Erase First in picture controls with transparency

Hi All,

 

As far as I can find, picture controls cannot both have transparent elements and also have Erase First unchecked. This is a problem as for my program I need to be able to see certain elements behind the picture controls. The reason erase first needs to be disabled is because many subvi's are making changes to several picture controls several times a second, and retreiving the current value through property nodes is causing very severe lag that is not present if all I am doing is writing on top of the existing image.

 

Does anyone know a way of getting around this issue?

 

Cheers,

 

Gazebo.

______________________________________________________________


______________________________________________________________
0 Kudos
Message 1 of 9
(3,640 Views)

Have you tried these methods?

1. use shift register instead of property nodes.

2. disable panel update until all changes done.

 

 

George Zou
0 Kudos
Message 2 of 9
(3,612 Views)

Yeah it sounds like you are trying to use the picture control as a video control.  Picture controls are alright for displaying a static image and even can be updated several times a second but the IMAQ line of software tools is probably better equip at doing what sounds like a video stream.

 

Also post some code, as mentioned already optimizations could be done like using shift registers to reduce the number of memory buffers made, and can improve speed, rather than reading the value from a property node which forces a thread swap to the UI.  If nothing else using a local variable would probably make the update smoother.

0 Kudos
Message 3 of 9
(3,584 Views)

Hey all, sorry for the late reply. The problem arises as these picture controls are generated by a VI, and thereby can't be wired into shift registers.

______________________________________________________________


______________________________________________________________
0 Kudos
Message 4 of 9
(3,498 Views)

@Gazebo wrote:

Hey all, sorry for the late reply. The problem arises as these picture controls are generated by a VI, and thereby can't be wired into shift registers.


This is not true.  For a second time please post a VI demonstrating what you are having difficulty doing.

0 Kudos
Message 5 of 9
(3,488 Views)

I believe I've solved the problem by using this VI. I do not have the lag caused by reading the 'Value' property node each update (only once on initialisation), thus enabling me to use transparency as the Erase First is no longer needed. Thanks for steering me towards shift registers, for some reason they didn't seem viable to me at first.

picsarebetter.png

______________________________________________________________


______________________________________________________________
0 Kudos
Message 6 of 9
(3,470 Views)

Okay. This is the VI I am now using (the VI above didnt work for obvious reasons). However, as you can see I'm using the concatenate strings to write updates to the picture controls. However, this is leading to quite the memory leak after many pictures are updated many times. What is the best way to get around this? (retaining transparency)

 

picsarebetter2.png

______________________________________________________________


______________________________________________________________
0 Kudos
Message 7 of 9
(3,426 Views)

A 2D picture control is just a string in it's low level, and continually appending data means the string continues to grow.  I posted a while ago about this and a simple technique to get around this, is to basically flatten the image removing all this information periodically.

 

http://forums.ni.com/t5/LabVIEW/2D-Picture-Control-Memory-Growth/td-p/2882124

 

Basically use Picture to Pixmap, then Draw Flattened Pixmap.

0 Kudos
Message 8 of 9
(3,405 Views)

 


Hooovahh wrote:

 

Basically use Picture to Pixmap, then Draw Flattened Pixmap.



This was my first thought. However, picture to pixmap removes transparency.

______________________________________________________________


______________________________________________________________
0 Kudos
Message 9 of 9
(3,401 Views)