LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Capture USB camera with user32.dll

Dear all,

 

I have edited a VI that was already discussed in the forum (here) to be able to select one usb camera at a time and be able to switch between them.

Now I am trying to capture and save the images using the sendmessageA function from user32.dll {WM_CAP_GET_SEQUENCE and WM_CAP_GET_SEQUENCE_SETUP}.

 

Although I could capture the .avi but I cannot control the parameters (for example capture time) with WM_CAP_GET_SEQUENCE_SETUP, the timing is always random and computer freezes during the capture.

 

So my question is that Could anyone check my program and see if there is anything that I am not doing right?

Since I wrote a .dll (my first Smiley Happy ) to send the struct of parameters to user32.dll, my own guess is that this one is not properly set but since I have no prior experience on that I am not sure.

 

Attached is the VI (WebCam.Example05.vi) plus the code.cpp which I used for "wrapper dll"

 

Best,

Arash

0 Kudos
Message 1 of 7
(7,277 Views)

Hi,

It would be better if you continue this in the old post.

For this post you've made, would you be able to explain a bit more in detail? What is not working? And what are the issues you are facing in the code? Are you able to switch between the cameras?

 

-FraggerFox!
Certified LabVIEW Architect, Certified TestStand Developer
"What you think today is what you live tomorrow"
0 Kudos
Message 2 of 7
(7,270 Views)

Hi,

 

😄 well in the old post it was suggested that I start a new discussion.

 

I CAN switch between cameras. But I cannot control the capture time, and when I start capturing the image everything in LabView freezes till the end of capturing.

 

{ Correction to first post: the msgs are (WM_CAP_SET_SEQUENCE_SETUP and WM_CAP_SEQUENCE ) }

 

Best,

Arash

0 Kudos
Message 3 of 7
(7,266 Views)

It looks like the subVI which is being used to capture the image is taking a long time, giving an impression of LabVIEW freezing till the image is captured. And as a matter of coding convention fact, while loop must have a wait function inside it, but since your subVI itself is doing the wait functionality, its OK. Could you check your processor usage (from task manager)? If its above 80%, then putting a delay inside the while loop would be good.

What do you want to do with Capture Time? If its just adding time stamp programatically, you can use time stamp functions to add the timing of the captured image

-FraggerFox!
Certified LabVIEW Architect, Certified TestStand Developer
"What you think today is what you live tomorrow"
0 Kudos
Message 4 of 7
(7,261 Views)

Well, the processor usage is less than 10% during the capture and only LabView freezes and everything else is fine.

 

For the timing I want to tell the camera to capture images only, for example, for 10 seconds. This should be possible with WM_CAP_SET..., but it is not working.

 

And the reason I want to use WM_CAP_SET... it that once it works I can extend my wrapper dll and control other parameteres such as frame-rate and ...

 

Best,

Farzad

0 Kudos
Message 5 of 7
(7,254 Views)

I have tested this with my webcam(converted it into one cam only) and have found that if you start the examble03.vi and run it, then stop it(using stop button or abort), then try to run it again, it will ask you which usb camera you want to use, even though you may have the right camera selected, it still won't work again until you restart your computer because the reference to the webcam is still active. Can someone please find a way to close that reference so I can run it, stop it, then start it again many times in a row without having to restart my pc?

0 Kudos
Message 6 of 7
(6,888 Views)

 

I am having the same problem.  I don't know much about using dll's but I am wondering

if the message WM_CAP_DRIVER_DISCONNECT should be going to avicap32.dll rather

than user32.dll.  Is anyone familiar enough with this to clarify?

 

What I would really like is not to have to select the webcam through a dialog box every time

but automatically open preset webcams.  Any ideas how to do that?

 

Oh, one more wish.  How can I overlay some crosshairs on the video image?

 

Thanks for any help.

 

Albrecht

0 Kudos
Message 7 of 7
(6,434 Views)