Jump to content

Saving an aquired image as a BMP?


Recommended Posts

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.

Link to comment

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

Link to comment

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.

Link to comment

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

Link to comment

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

Link to comment

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

Link to comment
  • 3 weeks later...

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. :)

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.