Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Image Display Size

Hi All,

I have a window whose front panel is completely covered with the new Image
Display control in IMAQ 7.

Ideally this window would act as a image display. So as the operator
changes the size of the window, the image display control would resize
itself to cover the entire window.

Our initial iteration of this uses the property "Scale all objects on front
panel as the window resize". Setting this property for the VI achieves the
required behavior of resizing the image control when the window is resized,
however, we are finding that the size of the image display never exactly
matches the window size. Specifically, when the window is sized 'small' the
image display takes up less then the whole window. When the window is sized
'large' the image d
isplay takes up more then the window size.

We could not get this to work properly so we thought that we could manually
watch for a panel resize, and programmatically resize the image display.
The problem with this is that there is no property available to WRITE the
size of the image display.

So I am hoping that someone here as managed to get something similar to this
to work. If you can offer any advice, please do so.

Also, if anyone has answers or insight to the following questions, please
share them:

1) why don't ALL controls have a writable BOUNDS property.
2) why doesn't "Scale all objects on front panel as the window resize"
maintain proper scale for the control on the front panel..

Thanks in advance.

Denis
0 Kudos
Message 1 of 2
(3,392 Views)
Hi, Denis,

To answer your questions:
1. The Bounds property includes all the different components of a control, such as the control itself, label, caption, graph legends, and so on, which you can move around in relation to one another. The Bounds attribute returns the dimensions of the rectangle that encloses all of the components; it does not refer specifically to the height and width of the control component. In most cases, users want to alter the height and width of an object and not all of its associated features; hence the Bounds property being read only. Most controls have other properties you can use to change their size, such as Text Width and Plot Area:Size. As you pointed out, there is currently no such property for the image display control.

2. When the front panel is resized, LabVIEW must calculate the factor by which the panel grew or shrunk, and apply this factor to the panel�s controls; however, applying this factor may cause a control to be, for example, 106.7 pixels wide. Since a control can only be drawn using integer pixel sizes, LabVIEW must round to 107 pixels. When the panel is then grown very large, the effect of this round-off is amplified. The round-off effect is most pronounced when the panel is resized to be very small, because the loss of resolution is greatest in this case. Try setting a minimum size for your panel in VI Properties to prevent this effect. By default, the panel�s minimum size is set to the current size of the panel when "Scale All Objects on Panel" is enabled.

Alternatively, maybe you could use the IMAQ WindDraw window to display the image instead. You could use the IMAQ WindSize VI to set the WindDraw window size programmatically as you wanted to do with the image display control. In the meantime, I will make a suggestion that we add a property to set the size of the image display control.

Hope this helps. Best wishes with your application!

Best wishes,
D. Putnam
Applications Engineer
National Instruments
Message 2 of 2
(3,392 Views)