03-16-2009 09:25 AM
smercurio,
Sorry, I got it wrong what you wanted.
Here is the VI: Webcam.vi.zip
The VI show the image acquired from a USB Webcam and show it in the Front Panel using PictureBox. and I want to save a picture.
Thanks.
03-16-2009 09:54 AM
03-16-2009 08:10 PM
smercurio_fc, I tried to do what you suggested, but the return of the VM_CAP_FILE_SAVEAS is False (0) that means ERROR!
And the command don't save any file.
Can somebody see if there is any mistake in this VI?
Mike, I'm trying to understand your advise. I'm trying to make a VI with your advise. If you have any other advise to make it easier, its helpful!
Thanks a lot!
03-17-2009 09:26 AM - edited 03-17-2009 09:27 AM
There's nothing explicitly wrong with the VI as far as I could tell. The thing you have to keep in mind is that the WM_CAP_FILE_SAVEAS message saves a video, not an image. The method of using the WM_CAP_EDIT_COPY message seems to be the only way to do it since the avicap32 API is not explicitly updating the Image property of the control. It makes sense that it wouldn't since that DLL is not .NET aware. It's probably writing directly to the window. Not sure if the following will work, but it's worth a try:
Off-hand, doesn't the webcam you have come with any software?
03-18-2009 08:14 PM
smercurio_fc, could you post your VI. I'm having trouble trying to do it.
And I don't have any driver or software from the Webcam.
Thanks for help!
03-19-2009 09:13 AM
03-19-2009 07:36 PM
smercurio_fc, in the output of the GetDataObject() I visualized with probe and I got the folowing message:
"Not A Refnum
Refnum (in hex): 0x00000000"
Anybody knows this error?
It seems that the WM_CAP_EDIT_COPY is not working, but the return of the function is TRUE (that means that its working).
It's really hard to work
Thanks for helping so much!
03-20-2009 09:36 AM
I'm not an expert on this specific issue, but based on what I've read and past experience with some .NET functions I think the problem has to do with making sure that all of the calls are running in the same thread. The CLFN functions are setup to run in the UI thread. Thus, I believe that you have to explicitly configure the VI to run in the user thread. To do this select File->VI Properties. Then select "Execution" from the dropdown. Set the "Preferred Execution System" to "user interface".
Unfortunately, I have no web cam so there's no way for me to test this on my own, so the best that I can do is to provide suggestions. If the above doesn't work we'll have to find another solution.
07-08-2009 11:24 AM
I'm having some similar problems with the .NET picturebox in LabVIEW 8.6.1. I can get it to display an image, but I cant seem to save that image to a file no matter what method I try.
I've searched quite a bit and it seems that everyone typically uses either the PictureBox.Image.Save(String filename, ImageFormat format) or the PictureBox.Image.Save(String filename) methods. I get the same error either way. Good old 1172:
********
Error 1172 occurred at Error calling method System.Drawing.Image.Save of ObjectId handle: 0xA7E1520 for obj 0x3C2413D[System.Drawing.Bitmap] in domain [LabVIEW Domain for Run] and thread 4704, (System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
) in DMSDK test.vi
Possible reason(s):
LabVIEW: A .NET exception occurred.
********
Has anyone used these methods successfully? I attached my vi if anyone feels like checking it out. Maybe there's something obvious that I'm missing...
07-08-2009 01:00 PM
I don't get any error when I use the Save method. See attached example.
Note: When creating paths you should not use string functions. Use the Build Path function in the File I/O palette.