LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Making Intensity Graph Proportional to X and Y dimensions of array

Before possibly reinventing the wheel, figured I would ask about this one before coding it up.  (In fact, I think I have coded it up but for some reason cannot find it in my resuable code library).  If I find it first, I will post.

As a default, Intensity graphs do not display images proportional to the image dimensions. For example, if you place an intensity graph on the front panel and your image is 80 x 160 (X x Y), the image will display just as wide in the X dimension as in the Y dimension. You really want it to display twice as wide in the Y dimension as in the X dimension in this case.  I am sure someone has programmatically addressed this as there should be a generic subvi involving property nodes that addresses this.  If so, can you post the code?

As a side note, IMAQ Vision image controls have even worse default behavior as they require scroll bars if pixel dimensions are larger than the image control you have placed on the front panel.

Thanks in advance,

Don
0 Kudos
Message 1 of 10
(3,814 Views)
Well, that's why we have the picture indicator. 😉
 
If you want to stay with an intensity graph, simply create a property node and set the plot area size to your desired values.
0 Kudos
Message 2 of 10
(3,812 Views)

No, on the intensity graph property node 'plot area size' setting the plot area dimensions does not give you a proportional image (i.e, you physically see that the Y dimension is twice the size of the X dimension).  In fact, I see this method as giving you nothing different than than autoscaling.  See attached.  By the end of today I should be able to figure out where I have my subVI that does give one the correct, proportional representation.

I'll admit, I have underutilized the picture control over the years because the intensity graph has nice cursor palette features.

Don

0 Kudos
Message 3 of 10
(3,803 Views)


@DonRoth wrote:

No, on the intensity graph property node 'plot area size' setting the plot area dimensions does not give you a proportional image (i.e, you physically see that the Y dimension is twice the size of the X dimension).  In fact, I see this method as giving you nothing different than than autoscaling.  See attached. 



This statement is incorrect. The plot area size property does exactly what you need. Open a few 24bit jpegs of various sizes with the attached VI to see for yourself (LabVIEW 7.0).

(Note that "loose fit" is disabled on x and y and z is set to autoscale. I did not bother to set the color ramp.)

0 Kudos
Message 4 of 10
(3,797 Views)
It is not as simple as this when working with straight arrays (vs.picture images).  Using your method, look at what I ended up with.....Don
0 Kudos
Message 5 of 10
(3,788 Views)
Well, after I unflattern pixmap, I end up with a "straight 2D array" (whatever that means). We need to know what else is different. It would help much more if you could show an image of your code, or even attach a simplified VI.
 
(Or paste your array in my VI as a diagram constant and repost. This way we're at least dealing with the same data.)
0 Kudos
Message 6 of 10
(3,782 Views)
Well I couldn't find my legacy code from way back when so I just redid the subVI for scaling.  Here is what I am trying to accomplish and it does what I need it to do.  Hopefully it will help someone else.
 
Sincerley,
 
Don
0 Kudos
Message 7 of 10
(3,777 Views)
Sorry here it is, forgot the attachment last time.....Don
0 Kudos
Message 8 of 10
(3,776 Views)

This seems rather incomplete, because it makes assumptions on the plot are size of the intensity graph. If one would resize the graph, you're distorted again. 😞

OK, so you don't want to resize the actual plot (as I first thought), but keep the intensity graph constant while settings the scales such that you get the right increment and aspect ratio, padding or clipping the visible portion as needed.

If you want a 1:1 element/pixel ratio in both dimensions, you would need two property nodes in your subVI. First, you need to read the plot area size, then calculate the scales such that you get the right visible apperance. Notice also that you have your intensity graph set to "transpose" (and I don't). This might also explain some of the different behavior.

 

0 Kudos
Message 9 of 10
(3,771 Views)
Yes, it seems transposition of the intensity graphs is always necessary (either programmatically or by prior setting on the intensity graph itself using right-click menu option). I am noting that in my subVI now.
 
I hardcoded (to 1) the magnification (multiplication) factors for the X and Y scales in the test.llb example but of course you could change these to controls and play with these to see the effect.  On a related note, I also have 2d interpolation code that works well to provide smoothing if magnifiying significantly.
 
I am reposting the example with an intensity graph default image for those who want to play.
 
Sincerely,
 
Don
0 Kudos
Message 10 of 10
(3,765 Views)