04-11-2014 09:33 AM
Perhaps I haven't had enough coffee this morning. Perhaps there is a IE submission fermenting. Its also entirely possible I've just missed something basic.
So what exactly is a picture control or a picture constant?
A quick search of the help tells me :
To display an image in a 2D picture control, you must write an image to the control programmatically. You cannot copy an image to the clipboard and paste it into the 2D picture control. You can use the Picture Functions VIs to specify a set of drawing instructions. Each VI takes a set of inputs that describes a drawing instruction. Based on these inputs, the VI creates a compact description of these specifications that you pass to the 2D picture control for display.
By default, the 2D picture control clears its display before drawing an image. If you want the 2D picture control to draw the new image over the previous image, right-click the control and remove the checkmark next to the Erase First shortcut menu item.
Among other things the line "You cannot copy an image to the clipboard and paste it into the 2D picture control." gave me pause. I wanted to do just that! I can drop my clipboard on the BD and get a picture on the BD but not into a picture constant???? Ditto the FP I can drop a picture from my clipboard and get a picture on the FP but not into a Picture control??? But try it with a picture ring..... Pictures import from clipboard WITH OPTIONS!
OK I said to myself I'll just grab the picture out of the picture ring and use it as a picture.....uhm....What property is that? OK, Next I'll invoke the get image method to get a picture from the picture ring.........No thats "Get Image"! a different beast entirely
So, I went and smoked a cigarette (I live in Minnesota not Colorado) LabVIEW is a graphical programming language, How can it be that hard to work with pictures? There has got to be an easy way I didn't think of.
04-11-2014 10:34 AM
The 2D picture functions in LabVIEW are bizarre, I feel your pain.
I think of the indicators as renderers, which receive a set of instructions on what to draw. Therefore, when it comes to drawing bitmaps from file it has to receive a 2D array of RGB values, which it presumably draws pixel by pixel like little individual rectangles. Not particularly elegant, but it does appear to be fairly quick.
However, this means it's lacking when it comes to front panel options. You can't drop into it from a filepath, or paste from the clipboard, it just doesn't work like that.
I suspect NI will not advance these basic functions while IMAQ sells so well. The image manipulation functions in there are plentiful, so it sells well.
Maybe there's room here for a new type of XControl that embeds a 2D picture in it's front panel, but recognises clipboard paste and mouse drops? In all other respects it's like a picture control, but with enhanced functionality?
04-11-2014 10:50 AM
04-11-2014 10:59 AM - edited 04-11-2014 11:09 AM
You might naively think a picture wire acts like a reference and place it in shift registers without really thinking.
You need to be very careful, because you can fill all avaliable memory in no time.
I've written about that many hears ago here. Important to know!
Here's a VI with a gigantic memory leak (from the linked post). Note that the picture itself is always exactly the same size (500x500 pixels), but the picture tools are not smart enough to overwrite. Instead they append the new picture to the end of all the old pictures forever. You would think it could just maintain a single bitmap and overwrite the pxels instead.
04-11-2014 11:02 AM - edited 04-11-2014 11:17 AM
Thanks Richard! That helps a lot with the what and why's! I was having the devils own time attempting to figure out what that beast was as it lived in memory. And a nice pointer from the master too.
Obviously I don't work with pictures often.
The key takeaway is tha "Picture" as in picture control and "Picture" as in Picture ring are about as related as a black cat and 12:00AM even though the are both refered to as "Midnight"
04-11-2014 04:22 PM - edited 04-11-2014 04:23 PM
Norm posted about this topic on LAVA a few months back, he offers a video and some VIs that talk about the internal picture data type format in relation to moving stuff around within a picture:
And here's another post from Norm going into more detail about the picture control opcodes:
04-11-2014 06:44 PM
Oddly the entire line of questioning started when working with a chart plot image property.
Now, I'm often guilty of confussing people with poorly chosen words but, my confussion was certainly enhanced by the image is a picture (but not a picture) choices of nouns that have been made. I couldn't imagine what a first timer user would make of all those miss-used terms. I did consider mentioning the odd noun usage discrepancies in a more open forum but I can't guess what that would break in localizations and it may be an "english only" feature.
Thanks again all for helping me straighten that out.
OpenG Toolkit does have a rather useful function that can be used to create a picture from jpeg, gif, png, bmp file (Picture as in the data type of a chart plot image kind) Picture ring element types of pictures export to file fairly easilly even if you use the clipboard and paint.
So that satisfies my "you learn something new everyday" quota for a while.
04-12-2014 11:01 AM - edited 04-12-2014 11:14 AM
On the theme of picture constants, Darin made me an xnode tool a few years ago:
Drag and drop target for a BD picture constant
Edit: More info on LAVA