LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I be sure the new picture zoom value has taken affect?

Hi,

I'm writing a LV prog that displays a series of pictures (jpegs) one after the other.

The pictures are passed one at a time from the main vi to a sub vi that outputs the picture on its front panel.

Also passed to the sub vi is the smaller of the two dimensions of the picture whichever it may be (width or height). This varies from picture to picture.

The sub vi uses this dimension to calculate the zoom factor to use so that the picture will fill the whole of the picture box on the front panel.

I've used a flat sequence struture to:

1. Caluculate the required zoom factor and write this to the picture box property node.

2. Read the zoom factor from the property node of the picture and wait until it has changed to within 1/100th of the new value. (The reason for not waiting until it is equal to the new value is because they are floating point data types and even if they were minutely out it would wait forever. Anyway, 1/100th is close enough).

3. Write the picture to the picture box.

Even after including step 2 above I still occasionally found that it has displayed the picture before changing the zoom value.

Any ideas? I've attached the sub vi in question. The two inputs: 'PicInput' is the picture to be displayed and 'ZoomDim' is the smallest of the width,height dimensions in pixels determined by the calling vi.

Also, as I said my program sets the zoom value using the smallest of the two dimensions of the jpeg so as it entirely fills the picture box. This means that the other dimension will overspill outside of the box, can this cause any problems such as memory corruption?

Thanks,
Dave.
0 Kudos
Message 1 of 3
(2,226 Views)
Dave,

I could not duplicate your problem. On my system (LV 7.1.1, Mac OS X 10.3.9, 450 MHz G4) the while loop always executes only once. The read Zoom Factor is always exactly equal (within Probe display resolution) to the written Zoom Factor. If your system needs several iterations to get the Zoom Factor right, I would try putting in some delay, perhaps enough time to allow the display system to update (i.e, the frame rate).

As for the memory overwrite issue, I do not have any experience. Usually LV's memory manager is pretty good about such things, but someone else will have to answer that question.

Lynn
Message 2 of 3
(2,219 Views)


@johnsold wrote:
Dave,

I could not duplicate your problem. On my system (LV 7.1.1, Mac OS X 10.3.9, 450 MHz G4) the while loop always executes only once. The read Zoom Factor is always exactly equal (within Probe display resolution) to the written Zoom Factor. If your system needs several iterations to get the Zoom Factor right, I would try putting in some delay, perhaps enough time to allow the display system to update (i.e, the frame rate).

As for the memory overwrite issue, I do not have any experience. Usually LV's memory manager is pretty good about such things, but someone else will have to answer that question.

Lynn




Hi Lynn,

Thanks for your reply,

Dave.
0 Kudos
Message 3 of 3
(2,206 Views)