Jump to content



Photo
- - - - -

Webcam Scanner Interface Demo


  • Please log in to reply
15 replies to this topic

#1 destruk

destruk

    VPF Veteran

  • VPF Staff
  • 6,338 posts
  • Location:Colorado Springs, CO

  • Flag: United States of America

  • Favorite Pinball: Ultrapin!



Posted 07 January 2012 - 11:47 AM

Webcam Scanner Interface Demo



Version: 1.0.0
Category: Essential Visual Pinball Files

Author(s): destruk

Description:
Use any TWAIN device to capture and save image data from VP smile.gif


View File

Submitted by destruk, on Jan 7 2012, 07:47 AM

Edited by destruk, 07 January 2012 - 11:49 AM.

Build a fire, vipers love the heat.


#2 destruk

destruk

    VPF Veteran

  • VPF Staff
  • 6,338 posts
  • Location:Colorado Springs, CO

  • Flag: United States of America

  • Favorite Pinball: Ultrapin!



Posted 07 January 2012 - 12:06 PM

I'd appreciate if anyone can tell me if this works with their webcam for taking a still image and saving it - I don't have a webcam to test here.

If you require a twain-compatible driver for your webcam - try this one - http://www.eztwain.c...video_twain.htm

Edited by destruk, 07 January 2012 - 12:28 PM.

Build a fire, vipers love the heat.


#3 rascal

rascal

    two-faced as they come

  • VIP
  • 1,374 posts
  • Location:Indiana USA

  • Flag: United States of America

  • Favorite Pinball: Bally Eight Ball



Posted 08 January 2012 - 11:18 AM

I'm trying this out to let you know, but right now I have a few errors. First I get "Can't Load Imaging Control". Then "Registration Failure!". Then "Can't Load VPinMAME, Object required". And finally "Line: 20 Oject required:"

Line 20 reads:
NumSoures=Imaging.TwainGetSourceCount

Do I have to register the other two dll files along with the ocx? The ocx said it registered successfully. Windows XP by the way.

EDIT: I tried registering the other two dll with no success.

Edited by rascal, 08 January 2012 - 11:32 AM.

Posted Image


#4 The_Raven

The_Raven

    Hobbyist

  • Members
  • PipPip
  • 29 posts
  • Location:Rochester, New York, USA

  • Flag: United States of America

  • Favorite Pinball: High Speed

  • PS3 Gamer Tag: aramil_nubin

Posted 08 January 2012 - 11:34 AM

tried to register the file per your instructions, and got this error:


did it both with admin rights and without, got the same error both times.
The problem with America is stupidity. I'm not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself?

#5 destruk

destruk

    VPF Veteran

  • VPF Staff
  • 6,338 posts
  • Location:Colorado Springs, CO

  • Flag: United States of America

  • Favorite Pinball: Ultrapin!



Posted 08 January 2012 - 12:50 PM

Since XP is the same as 2000, you might need to copy gdiplus.dll to windows\system32 too.
Are the files in the correct directory?

Build a fire, vipers love the heat.


#6 The_Raven

The_Raven

    Hobbyist

  • Members
  • PipPip
  • 29 posts
  • Location:Rochester, New York, USA

  • Flag: United States of America

  • Favorite Pinball: High Speed

  • PS3 Gamer Tag: aramil_nubin

Posted 08 January 2012 - 01:20 PM

I did that, too, and I'm still getting the same error (I'm on Windows 7, btw)

Edited by The_Raven, 08 January 2012 - 01:26 PM.

The problem with America is stupidity. I'm not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself?

#7 rascal

rascal

    two-faced as they come

  • VIP
  • 1,374 posts
  • Location:Indiana USA

  • Flag: United States of America

  • Favorite Pinball: Bally Eight Ball



Posted 08 January 2012 - 05:04 PM

Ok, yes I have everything in their right directory (c:\windows\system32\). I have some progress now.
On line 6 you have the following:
Set Imaging=CreateObject("GdTwain2S.Twain") 'load control

I changed it to:
Set Imaging=CreateObject("GdTwain2.Twain") 'load control

Removed the S and now the table doesn't error on loading the control.

Now I get a Type mismatch error on line 297, complaining about dips().


Line 297 reads:
cItems(ii)(1).Value = -((dips(cItems(ii)(0) And &H01) And cItems(ii)(4)) = cItems(ii)(3))

Posted Image


#8 s1500

s1500

    Enthusiast

  • Members
  • PipPipPip
  • 396 posts
  • Location:twin cities

  • Flag: ---------

  • Favorite Pinball: Fun House

Posted 08 January 2012 - 06:33 PM

I'll have to give this a try as I have several webcams laying around + netbook with built-in webcam. Ah stuff to do outside of Skyrim. Heh

#9 destruk

destruk

    VPF Veteran

  • VPF Staff
  • 6,338 posts
  • Location:Colorado Springs, CO

  • Flag: United States of America

  • Favorite Pinball: Ultrapin!



Posted 08 January 2012 - 08:30 PM

According to the documentation - the correct control class name is -
Class 1: Twain (Non-Visual Class)
-> Access string: GdTwain2S.Twain
-> CLSID: {A240B805-D70B-4B80-A585-28739B88BD68}

That's why on line 6, I had that. It works here.
The dip menu breaks down each twain compatible device you have on your computer and sets the vpm dip switch menu to both a value and a name for each twain device found in your system. It expects an even number of array values, as - if you have a single twain device it needs a numeric value for the menu as well (for 2 array positions) - if it finds two, then that's 4 positions, 3 is 6 positions in the array, etc etc.
The dips error is because it's generating an odd number of values, or empty sets rather than the expected type.

You can check this by inserting -
at line 47 after Next -
msgbox numsources 'display number of twain devices found in system
msgbox FinalAR(0)'device value 1
msgbox FinalAR(1)'device name 1
msgbox FinalAR(2)'device value 2
msgbox FinalAR(3)'device name 2
...etc etc

If you have more than 10 twain compatible devices on your system, you'll need to change the dim above for
Dim SourceNames(10) 'create room for number of possible sources


Build a fire, vipers love the heat.


#10 destruk

destruk

    VPF Veteran

  • VPF Staff
  • 6,338 posts
  • Location:Colorado Springs, CO

  • Flag: United States of America

  • Favorite Pinball: Ultrapin!



Posted 08 January 2012 - 09:09 PM

Actually, perhaps you're missing some dependency from the full install package - try downloading and installing this.

http://www.gdpicture...oad-gdtwain.php

Build a fire, vipers love the heat.


#11 The_Raven

The_Raven

    Hobbyist

  • Members
  • PipPip
  • 29 posts
  • Location:Rochester, New York, USA

  • Flag: United States of America

  • Favorite Pinball: High Speed

  • PS3 Gamer Tag: aramil_nubin

Posted 08 January 2012 - 11:38 PM

Sweet. I downloaded and installed that full package, and then I tried to register the .ocx file, and it worked. I ran the table, selected the input source, pressed S to capture the image, and it worked. Here's the picture it took:


Edited by The_Raven, 08 January 2012 - 11:40 PM.

The problem with America is stupidity. I'm not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself?

#12 wildman

wildman

    Pinball Fan

  • Platinum Supporter
  • 617 posts
  • Location:massachusetts

  • Flag: United States of America

  • Favorite Pinball: all

Posted 08 January 2012 - 11:46 PM

QUOTE (The_Raven @ Jan 8 2012, 06:38 PM) <{POST_SNAPBACK}>
Sweet. I downloaded and installed that full package, and then I tried to register the .ocx file, and it worked. I ran the table, selected the input source, pressed S to capture the image, and it worked. Here's the picture it took:


nice job Raven otvclap.gif



 


#13 destruk

destruk

    VPF Veteran

  • VPF Staff
  • 6,338 posts
  • Location:Colorado Springs, CO

  • Flag: United States of America

  • Favorite Pinball: Ultrapin!



Posted 09 January 2012 - 12:15 AM

Very cool Raven - thanks for testing it. Now, one problem with this - the license key is only valid for a month - so we'd either have to pay them for a full license key, or we'd need to keep getting free 1-month keys after this expires.
I asked them on their forum about that and they banned me, so they aren't the friendly type.

But now it's possible to have a vpm table take your picture when you get a replay with a solenoid callback and a webcam - or you can have it fully reproduce the photo experience on MarsaPlay New Canasta or FlashDragon.

Build a fire, vipers love the heat.


#14 rascal

rascal

    two-faced as they come

  • VIP
  • 1,374 posts
  • Location:Indiana USA

  • Flag: United States of America

  • Favorite Pinball: Bally Eight Ball



Posted 09 January 2012 - 09:47 AM

I install the trial version too, but am still hanging on the dip() line. Sorry, just can't figure out what is wrong. Maybe someone else can try it on a Windows XP box.

Posted Image


#15 destruk

destruk

    VPF Veteran

  • VPF Staff
  • 6,338 posts
  • Location:Colorado Springs, CO

  • Flag: United States of America

  • Favorite Pinball: Ultrapin!



Posted 09 January 2012 - 07:31 PM

QUOTE (rascal @ Jan 9 2012, 02:47 AM) <{POST_SNAPBACK}>
I install the trial version too, but am still hanging on the dip() line. Sorry, just can't figure out what is wrong. Maybe someone else can try it on a Windows XP box.


You know you don't need the dip line if you know what the name is of the device that you want to use?
At line 74 of the script -
If NumSources=1 Then 'one twain device present, so use that one
Imaging.TwainOpenSource(SourceNames(1))

above that msgbox numsources - that will tell you the number of things in your system it can use
add something like
for i=1 to numsources
msgbox i
next

That will give you the names of the devices it can use in order from 1 to however many sources you have

Then go back and change it to
if numsources=whatever number total sources it found then
Imaging.TwainOpenSource(SourceNames(number of the source you want to use))


And then you bypass the entire dip menu selection box....

Build a fire, vipers love the heat.


#16 rascal

rascal

    two-faced as they come

  • VIP
  • 1,374 posts
  • Location:Indiana USA

  • Flag: United States of America

  • Favorite Pinball: Bally Eight Ball



Posted 10 January 2012 - 10:14 AM

QUOTE (destruk @ Jan 9 2012, 01:31 PM) <{POST_SNAPBACK}>
QUOTE (rascal @ Jan 9 2012, 02:47 AM) <{POST_SNAPBACK}>
I install the trial version too, but am still hanging on the dip() line. Sorry, just can't figure out what is wrong. Maybe someone else can try it on a Windows XP box.


You know you don't need the dip line if you know what the name is of the device that you want to use?
At line 74 of the script -
If NumSources=1 Then 'one twain device present, so use that one
Imaging.TwainOpenSource(SourceNames(1))

above that msgbox numsources - that will tell you the number of things in your system it can use
add something like
for i=1 to numsources
msgbox i
next

That will give you the names of the devices it can use in order from 1 to however many sources you have

Then go back and change it to
if numsources=whatever number total sources it found then
Imaging.TwainOpenSource(SourceNames(number of the source you want to use))


And then you bypass the entire dip menu selection box....

Ok, that worked. It showed I had two devices. If I put device 1 in the SourceNames, it opened the Logitech software for the camera, and if I put 2 in the SourceNames, it opened the Windows dialog for image capture. Both worked, bypassing the dip(). But if I hit F6 for the menu, it would crash on the dip() line again.



Now you just need it to automaically email yogi with the image to post on his pinball people gallery. dblthumb.gif

Edited by rascal, 10 January 2012 - 10:18 AM.

Posted Image