We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

WIA Automation SDK and Multithreading

Hi to all, I'm using the WIA Aut. Library http://www.microsoft.com/downloads/details.aspx?familyid=a332a77a-01b8-4de6-91c2-b7ea32537e29&displaylang=en , trying to capture photos from 5 digital cameras (Nikon D90) USB-connected to my pc. Now, I partially achieved my goal, what I do is:
- loop through the attached devices, connecting to every camera;
- fotocamera.ExecuteCommand (WIA.CommandID.wiaCommandTakePicture) ;
- other image processing operations...
Everything works fine but... the workflow is camera1 -> connect -> grab pic. => camera 2 -> connect -> grab pic. => camera 3.....

What I'd like is to make them shoot all at the same moment (...why? well, D90 waits around 1 sec. after a shoot... 1sec * 12 cameras * 500 photo sessions.. :'( )
I told myself... what's the problem? You can create "shooting-threads" while looping through the device then launch 'em all.
Done.
It's still in a 'serial' way... :-(((
Why? is executeCommand() a synchronized method?
If I madly-fast click on two 'grab pictures' button of windows XP WIA dialog it works.. Is there something about .NET multithreading I don't know?

Please help me if you can!!

5
Contributors
6
Replies
2 Years
Discussion Span
5 Months Ago
Last Updated
7
Views
fabio.bozzo
Newbie Poster
8 posts since May 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Oh I forgot about it...
If I create a little command-line exe which only takes photo, and make threads call it... all works.
why putting the photo command inside the thread cause synchronization?

fabio.bozzo
Newbie Poster
8 posts since May 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Hi Fabio,

could you please give me sample code to get image from digital camera?

I have problem doing it with WIA. It gives me error right from

Imports WIALib

and it underline any thing i call from that library. I am using VB.NET 2008

my email is ntagrafix@yahoo.com

Thanks

ntagrafix
Newbie Poster
5 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
fabio.bozzo
Newbie Poster
8 posts since May 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

hello Fabio!

i have the same issue (with delphi6 and nikon d3000). I would like two cameras to take photo at the same time.
but now I have to open the connection to the cameras before each shot (because of multithread. with only one camera I can take photo immediately, I open the connection at the starting, and without threading), and it takes 2-3 seconds, and they start and finish not the same time :(
have you any idea, how to solve this? and how did you solve your problem?
to exe-starting,I also tried this, but it was the same result, before each shot I have to connect to the camera. Or how did you do this?

thanks

klatzi
Newbie Poster
1 post since Aug 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

You could cheat a little and create buttons for each take picture, then hide them.

Then create one more button, and on that button.click event call the:

Camera1Button.performclick
Camera2Button.performclick

ect....

They wont be EXACTLY the same time, but they will be extremely close.

Begginnerdev
Practically a Posting Shark
861 posts since Apr 2010
Reputation Points: 184
Solved Threads: 141
Skill Endorsements: 8

Hello,
I'm not sure if anyone still reads this but I would like to do the same thing with scanners :

scan from scanner1
scan from scanner2

wait 60minutes

scan from scanner1
scan from scanner2

etc

all automatically.
I managed to have the first scan but then it looks like the connection with the scanners remains active because for the second scan, when scanner 1 is supposed to scan, scanner #2 starts flashing and remains blocked like that for ever, without scanning.
It looks like WIA is happy to switch from scanner 1 to 2 but refuses to come back to scanner 1 for the next round.

I'm not sure I can post a link, but I have tried so many thing that if I post everything here, my post would be 2km long.
Can anyone help me with that, i'm a little desperate right now.

vince8290
Newbie Poster
3 posts since Dec 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0832 seconds using 2.9MB