LEADTOOLS Support
Imaging
Imaging SDK Questions
How to acquire multiple (or all) images from an attached Camera using WIA (with no UI!)
#1
Posted
:
Wednesday, February 17, 2016 2:52:04 PM(UTC)
Groups: Registered
Posts: 1
I have searched the documentation carefully, and am looking for a way to acquire all the images on a device.
It seems that I should be able to use WiaSession.Acquire to do this, but when I call the method like this:
_wiaSession1.Acquire(Handle, null, WiaAcquireFlags.None);
I get only the first image back.
I am using Version 19 (.NET) if it matters.
Help!
#2
Posted
:
Tuesday, February 23, 2016 12:59:04 AM(UTC)
Groups: Registered, Tech Support
Posts: 14
I assume you’re trying to get multiple images stored on the device’s internal memory through WIA, not trying to capture new images. Is this correct?
When you pass null to the Acquire method as the second parameter, the device will internally enumerate all items within and the first enumerated item will be used as the source item. This is the first image that you are seeing.
To obtain other images, you will have to enumerate the available items and pass each of the the enumerated items the Acquire method
To enumerate the items in your device, you can use the following methods:
- WiaSession.GetRootItem Method: Passing null to this method will return the root object
- WiaSession.EnumChildItems Method: Pass the root object to this method to enumerate its child objects. You will get each enumerated item through the EnumItemsEvent event. You can then pass the child objects to this method recursively to access their child objects, and so on.
- EnumItemsEvent Event: Each object enumerated by the WiaSession.EnumChildItems will trigger this event. Use the Acquire method in this event to get each image.
You can also use the GetPropertyString to determine the name of each object.
Before you try to write your own code for all of this, take a look at our WIA C# demo. Simply select the device then disable the default user interface from the Options menu. After that, select Acquire from the WIA menu and see how the demo’s code builds the tree of all items and images. You can modify the code to obtain all the images form the sub-items without displaying the window or adding the items to a visual tree like our demo does.
Hussam Barouqa
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Imaging
Imaging SDK Questions
How to acquire multiple (or all) images from an attached Camera using WIA (with no UI!)
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.