BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

I'm Stumped: Picture constants

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.


"Should be" isn't "Is" -Jay
0 Kudos
Message 1 of 8
(8,431 Views)

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?

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 2 of 8
(8,424 Views)

I've always been intrigued by the fact the picture datatype is a list of commands, not of a picture. If you take a simple "Line" function, you can see the settings stored in the binary:

2dpicture.jpg

Thoric (CLA, CLED, CTD and LabVIEW Champion)


Message 3 of 8
(8,417 Views)

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.

 

Message 4 of 8
(8,408 Views)

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.Smiley Very Happy

 

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"


"Should be" isn't "Is" -Jay
Message 5 of 8
(8,407 Views)

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:

 

http://lavag.org/topic/17138-2d-picture-translation-movement/

 

And here's another post from Norm going into more detail about the picture control opcodes:

 

http://forums.ni.com/t5/LabVIEW/Darren-s-Weekly-Nugget-10-30-2006/m-p/435378?view=by_date_ascending#...

Message 6 of 8
(8,363 Views)

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.Smiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 8
(8,344 Views)

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

_____________________________
- Cheers, Ed
Message 8 of 8
(8,326 Views)