Sonic_Soul Posted October 22, 2008 Report Share Posted October 22, 2008 Hi everyone, I'm brand new to LabVIEW, and I'm having a few problems getting my head around what appears to be very basic function in LabVIEW (8.5.1). I'm working with machine vision and imaging and have the Vision addon pack for LabVIEW. I'm trying to learn by using VI's that have a similar function to my needs, and adapting them. So, I've installed the IMAQ USB drivers to let me use a USB webcam as my input. I've also found some very useful code on this website that lets me continuously acquire images, see attached. What I need to do is add a feature to allow me to save whatever is on the screen as a BMP. When I press a button ("Save BMP" for example) I need the program to capture whatever is on screen as a BMP and ask me where to save the file. It seems a very simple in theory, but I've spent a few days playing around with no success! Can anyone help me get this working please, it's driving me nuts! Many thanks. Quote Link to comment
Antoine Chalons Posted October 22, 2008 Report Share Posted October 22, 2008 QUOTE (Sonic_Soul @ Oct 21 2008, 04:38 PM) Hi everyone,I'm brand new to LabVIEW, and I'm having a few problems getting my head around what appears to be very basic function in LabVIEW (8.5.1). I'm working with machine vision and imaging and have the Vision addon pack for LabVIEW. I'm trying to learn by using VI's that have a similar function to my needs, and adapting them. So, I've installed the IMAQ USB drivers to let me use a USB webcam as my input. I've also found some very useful code on this website that lets me continuously acquire images, see attached. What I need to do is add a feature to allow me to save whatever is on the screen as a BMP. When I press a button ("Save BMP" for example) I need the program to capture whatever is on screen as a BMP and ask me where to save the file. It seems a very simple in theory, but I've spent a few days playing around with no success! Can anyone help me get this working please, it's driving me nuts! Many thanks. What I would do is a second loop in parallel to the acquire/display loop you have in your VI. Just before starting that loop create another image that you could call "temp", and inside the "save loop" when the "save" button is pressed use IMAQ image copy to copy the image you called "IMAQ USB Example" into the "temp" image and then ask the user where to save it. This way you have all the time you want to chose where to save the image and the acquisition keeps running. Hope my explanations are clear enough, have a try and post back if you face issues. Hope this helps Quote Link to comment
PaulL Posted October 22, 2008 Report Share Posted October 22, 2008 For the record, it is also possible to simulate a press of the PrintScreen key in Windows with a call to the keybd_event in the user32.dll. Quote Link to comment
Neville D Posted October 22, 2008 Report Share Posted October 22, 2008 Do you have the IMAQ or vision package installed? I don't think you would be able to save the images unless you have them. There is a VI Under Vision Utilities>Files>IMAQ write File. It is polymorphic and can save images as jpg, png, bmp, tiff and jpg2000. Neville. Quote Link to comment
Sonic_Soul Posted October 22, 2008 Author Report Share Posted October 22, 2008 QUOTE (Neville D @ Oct 21 2008, 06:33 PM) Do you have the IMAQ or vision package installed? I don't think you would be able to save the images unless you have them.There is a VI Under Vision Utilities>Files>IMAQ write File. It is polymorphic and can save images as jpg, png, bmp, tiff and jpg2000. Neville. Yes I do Neville. I see a file called "IMAQ Write File 2", but I've been unable to get it workin properly. It will only let me enter a fixed filepath. I wish it to prompt me where to save the file each time I request an image. Many thanks. Quote Link to comment
Shaun Hayward Posted October 22, 2008 Report Share Posted October 22, 2008 QUOTE (Sonic_Soul @ Oct 21 2008, 03:22 PM) Yes I do Neville. I see a file called "IMAQ Write File 2", but I've been unable to get it workin properly.It will only let me enter a fixed filepath. I wish it to prompt me where to save the file each time I request an image. Many thanks. You can get around the need to supply a fixed path by using the File Dialog express VI from the File IO -> Adv File Funcs pallet. This function will cause a file popup and will output a file path which you can then wire to the IMAQ Write File 2.vi Shaun Quote Link to comment
Antoine Chalons Posted October 22, 2008 Report Share Posted October 22, 2008 QUOTE (Sonic_Soul @ Oct 21 2008, 09:22 PM) Yes I do Neville. I see a file called "IMAQ Write File 2", but I've been unable to get it workin properly.It will only let me enter a fixed filepath. I wish it to prompt me where to save the file each time I request an image. Many thanks. instead of feeding a constant path for the image save function you can use the prompt file dialog located in the file palette. Hope this helps Quote Link to comment
Antoine Chalons Posted October 23, 2008 Report Share Posted October 23, 2008 QUOTE (Antoine Châlons @ Oct 21 2008, 10:48 PM) instead of feeding a constant path for the image save function you can use the prompt file dialog located in the file palette.Hope this helps i took a little break and implemented what i had in mind yesterday. feel free to ask questions. hope this helps PS : i couldn't test it because i don't have the USB driver installed, hope it will work :-o Quote Link to comment
Sonic_Soul Posted November 13, 2008 Author Report Share Posted November 13, 2008 Hi all! Apologies for the late reply but I've been busy and also a bit ill! But I'm fine now. Anyway, I just though I'd post the solution I found incase anyone else has the same problem as myself - see attached. So here's what it does... (it's probably extremely simple for all you experts!) When the button is pressed it will retrieve and image from a USB camera using IMAQ and save it in BMP format using the filename specified in the dialog box. Simple as! Hopefully someone will find this useful, and many thanks to everyone who contributed to this thread. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.