From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Webcam configuration

I am using an auto focus webcam with my vision system.  I am having an issue that each time i take a picture it opens up a new camera session with random configurations.  I need a specific set up in order to see all the components i am looking for.

The algorithmi have for taking an image is:

        CurrentSession = New NationalInstruments.Vision.Acquisition.Imaqdx.ImaqdxSession(CurrentCamera)
        'get image
        CurrentSession.Acquisition.Configure(Acquisition.Imaqdx.ImaqdxAcquisitionType.SingleShot, 1)
        CurrentSession.Acquisition.Start()
        CurrentImage = CurrentSession.Snap(CurrentImage)

        'Stop, unconfigure, and close camera
        CurrentSession.Acquisition.Stop()
        CurrentSession.Acquisition.Unconfigure()
        CurrentSession.Close()

        CurrentImage.WriteJpegFile(Image_name)

 

Is there a function that sets up the camera? it is a logitec camera.

Thanks

0 Kudos
Message 1 of 14
(8,106 Views)

Is the camera configured correctly the first time you take an image? From the code you provided, it seems like you should be able to take multiple images during the same session and write them to file. Once you are done you can end the session and unconfigure the camera at that point.

 

What configuration are you trying to get with the camera?

Cameron T
Applications Engineer
National Instruments
0 Kudos
Message 2 of 14
(8,097 Views)

I am actually getting a timed out error quite frequently

0 Kudos
Message 3 of 14
(8,094 Views)

Where do you get the time out error? Is there an error code along with it?

Cameron T
Applications Engineer
National Instruments
0 Kudos
Message 4 of 14
(8,089 Views)

During the Snap Function

0 Kudos
Message 5 of 14
(8,087 Views)

Have you tried to use the camera from Measurement & Automation Explorer? This would help you know if it is an issue with the camera/driver or the code (because it eliminates the code aspect). Try to access the camera in Measurement & Automation Explorer and use the Snap function from there.

Cameron T
Applications Engineer
National Instruments
0 Kudos
Message 6 of 14
(8,085 Views)

I occasionallyget a timed out error from there too

0 Kudos
Message 7 of 14
(8,082 Views)

What is the error code that you get?

Cameron T
Applications Engineer
National Instruments
0 Kudos
Message 8 of 14
(8,080 Views)

0xBGG6901B

0 Kudos
Message 9 of 14
(8,077 Views)

Can you provide the entire error text that comes up? A screen shot would be helpful if possible.

Cameron T
Applications Engineer
National Instruments
0 Kudos
Message 10 of 14
(8,072 Views)