TWAIN Working Group

Newsletter Signup
Donate
Help keep TWAIN free
  • About TWAIN
    • What’s New?
    • News
    • Events
    • Membership
    • Consider a Donation
    • Contact Us
  • Why TWAIN?
  • Developers
    • Driver Developer
    • Application Developer
    • TWAIN Features
    • Specification & Tools
    • Self Certification Process
  • Support Forums
  • Scanner End-User
  • Find Certified Drivers
    • Facebook
    • LinkedIn
    • Vimeo

Newcomer to TWAIN

Forums › TWAIN Classic › Newcomer to TWAIN

  • This topic has 7 replies, 5 voices, and was last updated 5 years ago by evanpan.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • May 12, 2012 at 10:30 pm #22750 Reply
    resool
    Participant
    • Topics - 1
    • Replies - 1
    • Total Posts - 2

    Hi, I’m writing an application that is supposed to retreive and process image from USB board camera in real time. In Datasheet it’s written that it supports TWAIN and DirectX.
    I have spent weeks browsing web and reading, and so far i have understod following:
    1) DirectShow(with DitectX) isn’t compitable with GnuC++ (MinGW)
    2) TWAIN should be compitable with GnuC++
    but specfication is enormous and the isn’t any tutorial about twain that i was able to find.
    So, I ask fr your help, to guide me through this.
    correct me if I’m wrong:
    i should load some dll file , that contains SourceManager, and it should be downloadable trom Twain.org. I downloaded sampleSourceManager, but am not able to find that dll file πŸ™ , also don’t know the definitions of functions i should call;

    P.S.
    all I have to do is : select correct input device (VideoLogy USB board camera)->select correct resolution -> acquire bitmap data of image -> pass bitmap data for further processing. Algotirhms there are pretty heavy, thats why GnuC++, as it allows for best optimization , not counting asm.

    Thanks for your help in advance.

    May 13, 2012 at 9:33 am #25605 Reply
    resool
    Participant
    • Topics - 1
    • Replies - 1
    • Total Posts - 2

    Ok, so far I have loaded the dll file acquired Functions from it, but i don’t quite understand that callback function stuff, i understand that i need to implement it, but in specification itΕ‘ mentioned only fopr linux or Mac, but I’m on windows

    July 26, 2012 at 7:27 pm #25606 Reply
    si_ben
    Participant
    • Topics - 7
    • Replies - 22
    • Total Posts - 29

    Hey, Im new as well… It seems like none of these “Pros” want to help us.
    I code in Visual Basic so I have had to transfer everything form c#. There is a good
    project that might help get you started I think at Code Guru . com or something. The program is called TwainGui project. Helped me so far. I would start by Trying to create a project to do some simple queries to the source and then retrieve the values and display them. I have been working on this for nearly a month and I still have gotten as far as Querying what supported capabilities there are for a device (No thanks to my post on how to help with CAP_SUPPORTEDCAPS). Now Im trying to read their ‘values’.

    That TwainGUI app should help you at least aquire an image and save it if thats what your looking for and you can try to build from there. Also, very helpful is the

    TWAIN SPEC 2.2 PDF you can get from the site.

    Hope any of this helps.

    Here is the site for the twain proj.

    http://www.codeproject.com/Articles/1376/NET-TWAIN-image-scanner

    July 31, 2012 at 8:10 pm #25607 Reply
    spike
    Participant
    • Topics - 10
    • Replies - 139
    • Total Posts - 149

    @si_ben – Sorry you haven’t received more support here, but I can tell you why: The TWAIN ‘pros’ mostly don’t use Visual Basic or are not fluent in it, and looking at your other posts I can tell you that your problems all look like VB and marshalling problems. Not that these aren’t real problems, just that the TWAIN API is designed VERY strongly for C, so you’ll have to become quite expert in marshalling to use it from VB. It will be worth weeks of your time to either use C# to talk to TWAIN, or to find or buy a 3rd party library or component to wrap around TWAIN.


    @Resool
    (Belatedly) I offer three bits of advice:

    1. Don’t expect TWAIN to give you real-time image capture from a camera. If you are thinking TWAIN will deliver an image in 100ms… HIGHLY unlikely. You might see 1-2 seconds between images. You won’t know until you try it with your camera.
    Also, many camera TWAIN drivers only work correctly in interactive mode. If you need to capture images completely under program control, it may not work.
    So at the least, before spending more time & money, you should verify that your camera can deliver images at the speed you need, automatically, through TWAIN.
    I think Irfanview has an automatic scanning mode? Or you could use my Acquire program:
    http://eztwain.com/acquire.htm
    Note that we don’t sell Acquire anymore, but you could use it in trial mode to experiment.

    2. Unless your time is basically free, writing your own TWAIN code from scratch is hugely inefficient – and that goes double if you are not fluent in C or C++, because the TWAIN API is completely designed and documented for C programmers. Start with somebody else’s code – Google, search Code Project, use the example code from the TWAIN Working Group, license a commercial library or control.

    3. You should be using DirectShow, or maybe Video for Windows – those are suitable interfaces for capturing images from a camera in (something like) real-time. Maybe WIA, I don’t know. If you can’t talk to one of those with your compiler, switch compilers: If you aren’t using the most speed-efficient image processing algorithms & data structures, compiler optimization will not save you. AFTER you get everything working the way you want, using the most speed-efficient algorithms, THEN if it’s still too slow, then you could analyze carefully and recode a small section into assembly language. Or just buy a faster computer. Or multi-thread. Or add more RAM. Or drop the frame rate by 20%. Etc. Etc. Etc. IMHO Picking your compiler because it has the best optimization is like choosing a car because it has the highest top speed. It is *extremely* unlikely to make an important difference in your success.

    July 31, 2012 at 8:38 pm #25608 Reply
    si_ben
    Participant
    • Topics - 7
    • Replies - 22
    • Total Posts - 29

    Thanks for your Response.

    I actually have been working on my own from scratch (and yes its been a few weeks). Most of everything I have coded so far has been interpretation from the Twain Spec book and C# code. Its not hard to convert from C# to VB they are nearly the same in many ways. There is even a site where you can convert the code directly:

    http://www.developerfusion.com/tools/convert/csharp-to-vb/

    The reason I started coding with twain is because I developed my own class coded with WIA and when we went to install our software the client had recently obtained a new Canon scanner. Cannon is a TWAIN type scanner so didn’t work with WIA. I have gotten basically what I need to be able to [Select] and [Aquire] converting those C# projects wasn’t very difficult. I’m trying harder to understand TWAIN. I have made some progress, but its been difficult. Converting the TWAIN.H file from C (or C++) is really what has proven the most difficult.

    So basically I have gotten to the point where I would like to Negotiate the capabilities of a scanner and (not using CAP_SUPPORTEDCAPS) have been able to fill a ListBox with all the Sources supported capabilities. I have also been able to successfully reference a structure of types :
    (TW_ARRAY,TW_ENUMERATION,TW_RANGE,TW_ONEVALUE)

    I know that most of the people code in C# with this, but they both use .NET so, It shouldn’t be hard to look at the code and interpret it (if your completely unfamiliar with VB its not hard to throw it in the converter site i provided)…

    I looked into getting licenses and stuff but that’s not financially reasonable for us. We are a small company with 2 Employees supporting about 5 big software programs.

    July 31, 2012 at 8:49 pm #25609 Reply
    spike
    Participant
    • Topics - 10
    • Replies - 139
    • Total Posts - 149

    Hmm, well… if you ask management how much they would spend to save two weeks of your time, then at least you know how much they think your time is worth πŸ˜‰

    I’ll go post a comment on your thread “Get Current, Default, Available Values”.

    August 1, 2012 at 3:17 pm #25610 Reply
    MaeA
    Participant
    • Topics - 0
    • Replies - 1
    • Total Posts - 1

    Thanks a lot for the advice given and for the links)
    I’m working on the same stuff now,
    so this info is really of great help for me.

    _________________
    typing words per minute test

    March 31, 2016 at 10:12 am #25611 Reply
    evanpan
    Participant
    • Topics - 0
    • Replies - 7
    • Total Posts - 7

    Hi, MaeA.
    Thanks for your nice sharing. As you see, there are many free conversion tools online. But I don’t suggest you to use them to do with your conversion work. Because I always believe that the free tools online do not have so many professional functions as the paid ones. And it is said that some of them might contain some virus. Check some free trials of the paid professional conversion tools to
    convert pdf to jpg using C#.NET first before you make your final decision if possible. I also suggest you choose one whose way of processing is simple and fast. It can save a laot of time for you. Remember to do your conversion work according to its tutorial page about PDF to image conversion. I hope you success. Good luck.

    Best regards,
    Pan

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Newcomer to TWAIN
Your information:




Quick Links

Service Providers
TWAIN Support Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

TWAIN Working Group
TWAIN Direct®
TWAIN Resources
TWAIN Certified Drivers
PDF/raster

  • Facebook
  • GitHub
  • LinkedIn
  • Vimeo

Recent Topics

  • TWAIN for dental imaging integration
  • PDF/R For who and where?
  • Making searchable PDF with PDF/R
  • Backward compatibility with PDF/A and traditional PDF
  • could not open the twain source. Make sure there is a valid source for your sca
  • Quarterly Newsletter
  • TWAIN Working Group Membership
  • Logo Usage
  • TWAIN License
  • Contact Us
Privacy Policy β€’ Privacy Tools β€’ Copyright © 2021 TWAIN Working Group β€’ by iHwy, LLC β€’ Log in

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.