LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I load a picture from the clipboard (either Windows clipboard or Labview clipboard) into image data that can then be processed in Labview?

I want to load a picture from the Windows clipboard (and if not possible, then from the Labview clipboard) into actual numerical image data so that it can be processed in lab view. When I'm at the main screen where I can add controls, I see a section of controls called "Vision" in the tool bar where all the different controls can can be added from. When I go to the control called "Image" and put that on my form, and then look at the flowchart/blockdiagram programing window to see what inputs and outputs it has, I only see one output, and no inputs. And when I right click on it, I see NO way to load an image into the Image control. PLEASE help me.
Message Edited by Ben321 on 11-09-2008 04:32 PM
0 Kudos
Message 1 of 12
(6,754 Views)

Hi Ben,

 

National Instruments has an image processing software called Vision and although I am not completely sure, I think the controls that you found in the control pallet are used in conjunction with the software. Depending on what kind of image processing you want to conduct in LabVIEW, you might want to consider purchasing that product.

 

If cost is an issue, there are functions in LabVIEW which allows you to take in image files and process them. However, please keep in mind that the capabilities are limited.

 

Images should be loaded onto LabVIEW not via the clipboard but through loading it from folders or directories. (There might be a way to and so if you find a way please let me know! I would like to know myself =D) If you open the function pallet by right clicking on the block diagram, in the programming folder you should find a directory called "Graphic and Sound". There, you'll find functions in which allows you to process images.

 

 In the "Graphic Type" directory there should be a function called Read JPEG file.vi. There are also others which allows you to read png and bmp files. Please note that there are functions which write as well. Set a file path on the block diagram and inside the "Grahic and Sound" there is a "Picture Function" directory and inside there, there should be a function called "Draw Flattened Pixmap.vi" That changes the image into a format where you can process on LabVIEW. Inside the "Picture Function" directory there are several functions which allows you to process the specified image. Play around with it and see how it goes. And don't forget to Write the file in the end to save any changes.

 

I hope this helps

 

-----------------------------------------------------------------

National Instruments Japan

Applications Engineer Taiki Hoshi

-----------------------------------------------------------------

 

 

Message 2 of 12
(6,732 Views)

Thanks for the info. However, is the Labview student version (which is what I have) capable of really integrating with the more professional Vision software? I got my copy of Labview student edition for free through the University of washington's UWare site (yes it actually was offered for FREE!).

 

And all I need is basic image processing such as brighten, darken, increase contrast, decrease contrast, and possibly some slightly more advanced functions (sharpen, blur, hue shift, saturation adjust, basically the stuff that's easy for Photshop to do). I would like to implement that into a labview program.

0 Kudos
Message 3 of 12
(6,692 Views)

...and if you are still looking for examples...

 

This thread has sample code for some games we have ben playing over the years. The Code Capture tool along with the "CC and Friends" code does a lot of realated tasks that you may find helpful.

 

Have fun!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 12
(6,663 Views)
With apologies for resurrecting a long-dead thread on my 1st post to the forums....

I've been playing with pcardinales code get_image_from_clipboard and it works well in the programming environment (v8.5). I'm taking a screenshot and saving it to file.

When I come to create an exe I find that in order to make the invoke node successfully grab the clipboard I have to wire in the reference of the invoke node. I've done this in the attached file.
In this way I can get the executable to function nicely on the machine that I'm using to program, however I can't make it work on other machines which only have the run-time engine installed.

I figure I either
a) Don't understand application references correctly
b) am missing something in the runtime engine installation on the other machines.
 
Any hints would be gratefully received...

Ian
0 Kudos
Message 6 of 12
(6,281 Views)

...After a little more playing I've refined the problem. In fact, my executable will operate only if the LabVIEW development system is running in the background.

I can start the exe up and it won't work correctly. If I leave it running and start up LabVIEW... hey presto - the exe starts to function as expected.

 

It seems the invoke node is no longer supported (might explain my problem!) but I am wondering if there is any way of getting around the problem of not having the development system running on my RTE machines.

 

Ian

0 Kudos
Message 7 of 12
(6,259 Views)

Here is my partial guess, from looking at your code:

 

  • The method is private (fact) and was never implemented in the RTE, so it only works in LabVIEW (guess).
  • When you didn't connect the refnum the RTE tried to run the method and failed (did you get an error?) (guess).
  • When you opened the application reference, one of two things happened: (fact)
    • LabVIEW wasn't running, so you got either the local app where it doesn't work, or you got an invalid app refnum.
    • LabVIEW was running, so your app connected to it, thus running the method in the IDE and working.

 

You can try searching RolfK's posts for "clipboard" or "DIB" or "BMP". He has some VIs which interact with the clipboard directly using the Windows API and should be able to read an image from the clipboard (I know that they can be used to write an image to the clipboard, so I assume he also implemented the reverse). This should probably work in the EXE as well.

 

If you search the LAVA forums for "screenshot" or something similar, I believe you should find an implementation of what you want which uses .NET.


___________________
Try to take over the world!
0 Kudos
Message 8 of 12
(6,243 Views)

Thanks for that. Yes, I did get an error in the exe if I didn't connect the refnum.

 

I've been looking for an excuse to get to grips with .NET things for a while so I'll see what I can dig up but will also go through some more of RolfK's posts - I had a good look but clearly not good enough!

 

Thanks again,

Ian

0 Kudos
Message 9 of 12
(6,240 Views)

Hey together,

 

Have you found a final solution?

If so, please load up an example VI.

Thanks for help Smiley Happy

 

 

 

Flobias

0 Kudos
Message 10 of 12
(4,410 Views)