LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Vision: image display in type definition

Solved!
Go to solution

Hi,

 

I have several type definition control on the front panel, i.e. one for buttons to press (BUT.ctl), one for settings (CFG.ctl), etc. Each type definition is a cluster with several distinct data types.

I normally also have one type def for the 'outcomes' (PRCs.ctl) like a graph or a numeric indicator. And the references of each type definition control are gathered together in one type definition called 'REF'.

 

However, this time I have a Basler camera and I want to continuously acquire images and show those on the front panel in the 'outcomes' type definition (PRCS.ctl). Unfortunately, the frame rate is shown but the images are not.

I can get it work just placing the 'Image Display' control (from vision palette) solely on the front panel, but not together with the frame rate in one type definition control.

 

Does anyone have an idea why? Maybe you just simply cannot put an 'image display' control in a type definition?

 

For quick understanding, see the following items:

VT; Main.vi

VT; PRCS; IO.vi ("ShowImage" state)

VT; PRCS.ctl

 

Kind regards,

DvdM

 

0 Kudos
Message 1 of 11
(3,741 Views)

I could not view it because I'm on LV 2016, if you back-save I will take a look though.

It should be fine, though it tightly couples your UI and underlying code, which I don't like.

 

Also, I would recommend slightly longer, more descriptive names. All the shortened acronyms are a bit confusing.

0 Kudos
Message 2 of 11
(3,732 Views)

I always though the Image display was an odd animal that did not fit into the data flow paradigm.

 

It would freak me out when data would flow backwards through a wire to update an image.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 11
(3,724 Views)

I think I don't understand the problem.  I put a Vision Image (Modern) on my desktop, opened a Cluster, dragged the Image into it, added a Dbl Indicator called Frame Rate, and had no problems.  I'll attach my cluster (2018), which looks like this:

Image and Frame Rate.png

Bob Schor

0 Kudos
Message 4 of 11
(3,713 Views)

It looks to me like you are just writing to the wrong indicator. In the AnalyzeImage state of VT;PRCS;IO.vi you are bundling the image out back into the Analyzed Image ref which is an indicator behind the big image display. The image display is called Camera image so I would imagine you just need to bundle the output of Vision Assistant into Camera image.

Matt J | National Instruments | CLA
0 Kudos
Message 5 of 11
(3,707 Views)

Hi Matt,

 

I can imagine you would think that. However, in the “ShowImage” state of VT; PRCS; IO.vi I make a choice which image to display, i.o. whether to display the original camera image or the analyzed image (by vision assistent). Now, it is done by the boolean in the ShowImage state. However, in the future pressing a button will set this choice.

 

Therefore, one of those two images (original vs. analyzed) has to be put into rPRCS of PRCS.ctl. And there it goes wrong, whereas the frame rate is doing fine.

Message 6 of 11
(3,684 Views)

Hi Bob,

 

That is pretty much like my PRCS.ctl 🙂

The probleem is writing to the vision image in the cluster. In my ShowImage state of VT; PRCS; IO.vi I am trying to write the analyzed image (analyzed image due to boolean set to false) to the PRCS.ctl by means of a property node. Whereas the frame works fine in this way, the image does not.

 

Therefore I thought maybe an image isn’t allowed in this manner??

 

I hope this clarifies things to you. Otherwise, please let me know.

 

Kind regards.

 

 

 

 

0 Kudos
Message 7 of 11
(3,682 Views)

Thanks for the "klop" to my head!  Of course, I knew (but forgot) that!  IMAQ is so "different" from other LabVIEW offerings, and so "under-documented", that we can fool ourselves!

 

I'm attaching "The Solution".  What I'd forgotten (since I did much of my playing with IMAQdx several years ago) was that the Front Panel "Image" indicators are not really the same kind of "indicators" we are used to thinking move on wires.  It is better to think of them as "complex routines that take an IMAQ Image, traveling on a wire, and render it so we can view and manipulate it".

 

There is another "Image" that truly is something that travels on wires -- it is what happens when we use IMAQ Create Image -- it makes something that travels on a wire.  That you can put in a Cluster.  I've done just this, creating a sub-VI called UTIL Get Image that puts a stock Image (I used "Desert.jpg") into an Image TypeDef with a Frame Rate of 1 (a silly, but recognizable, number).  This gets called by TEST Image TypeDef that unbundles the Cluster and wires the "Image" part to the "visualing" Image "Thing" we use to see the Image.  Sure enough, a picture of the Desert appears.

 

You raised a very good question -- sorry I stumbled around it ...

 

Bob Schor

Message 8 of 11
(3,673 Views)

 

Thank you very much for your time and help with my issue Bob. And I am glad to hear this is not a stupid question.

 

And I think you are getting close. Unfortunately, this is not exactly what I meant. To be honest, your solution is what I meant with "I can get it work just placing the 'Image Display' control (from vision palette) solely on the front panel, but not together with the frame rate in one type definition control."

 

As you can see, on the front panel of my 'main.vi' I also have other type definition controls, like for instance 'VT;BUT.ctl'. With this one, operations on one of the buttons in sub-vi's are updated directly on the front panel. To conclude, I want to place the 'TYPE Image Info.ctl' (in your example) directly on the front panel of 'TEST Image TypeDef.vi'. I hope you can see the parallel with the 'VT; BUT.ctl' (in my example).

 

However, from your "What I'd forgotten (since I did much of my playing with IMAQdx several years ago) was that the Front Panel "Image" indicators are not really the same kind of "indicators" we are used to thinking move on wires.", I have such a clue that indeed things work different for images than for other data types (like buttons).

 

Could you please have another look? That would be great.

 

DvdM

 

 

0 Kudos
Message 9 of 11
(3,644 Views)
Solution
Accepted by topic author DvdM

The simple answer is "You can't do that!".  There is definitely a virtue in creating a Cluster TypeDef that can "freeze" a nice arrangement of Controls (or Indicators) that one wants to fit on a Top-Level VI Front Panel, but that does not work for the Vision Front Panel Image "Indicators", as these are not "Indicators" in the usual LabVIEW "Give me Data in a Wire and I'll do something with it", but rather more complex entities that want a reference to an "IMAQ Image", a reference to a memory construct created by IMAQ Create Image.

 

What is an "Image"?  At one level, it is an Array of Pixels representing Grey or RGB values, along with supporting information such as the size of the Image and the internal representation.  When you use a Camera to take Images, they are stored in the IMAQdx Driver in "buffers".  To get to them, you create a Storage Location in your program that you call an "Image" with IMAQ Create Image and use Snap or Grab to get a reference to this Image (in some cases, copies of the Image Representation may occur, but in others, I suspect all that's being passed around is the Pointer).  This is the "Image" (a reference to where the Pixels are stored) that the "Display" (I'm not calling it an Image, but a "Display" which renders the Image visible to you) shows you.

 

So how do you get to have a nice Front Panel design for your Top-Level VI that incorporates a fixed organization between a Vision Display and other Controls and Indicators?  And why am I (incorrectly, I might add) emphasizing "Top-Level VI"?  A Vision Display only makes sense if you can view the Front Panel.  This is, of course, true for Top-Level VIs.  It can also be true if you display the VI's Front Panel in a sub-Panel (a technique I frequently use when I have multiple cameras whose output I want to view, one at a time).  Here's how to do this:

  • Lay out your Front Panel.  Include the Vision Display, with the Tools and View Options you want.  Put other controls and/or indicators that you want to group with it and align and space them properly.  You might also consider enclosing this "View" in a Decoration, such as a Raised Frame.
  • Select the items you want to "lock" into a Group.  On the group of icons on the Tool Bar in the group of 4 to the right, the last "ReOrder".  Select it and choose "Group".  You have now "locked" your chosen Front Panel objects so that they move as a group.  If you need to adjust the grouping, you can select, "UnGroup", re-arrange, and re-"Group".   

I hope this answer both your question ("It can't be done") and solves what I think you might have been attempting ("Do it another way").

 

Bob Schor

Message 10 of 11
(3,632 Views)