Forum Index

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Setting TWAIN Custom or Extended Capabilities

 
Post new topic   Reply to topic     Forum Index -> General TWAIN Discussion
View previous topic :: View next topic  
Author Message
Mike Kirkby



Joined: 06 Jan 2010
Posts: 6
Location: Australia

PostPosted: Mon Feb 08, 2010 10:20 pm    Post subject: Setting TWAIN Custom or Extended Capabilities Reply with quote

I am building my own TWAIN UI to run against mutliple different vendors scanners.

So instead of popping up the vendors TWAIN UI for a particular scanner, I'll pop up my own TWAIN UI.

I have been able to get my own TWAIN UI to negotiate most mandatory capabilities properly, so much so that my own UI now accurately represents most of the the features available on the scanner thats currently plugged into my PC.

One area that is not quite working out as I had expected is setting the correct thresholding options.

All scanners support Fixed Thresholding, whereby we can set the manual value of the threshold setting. This is often the default setting within the vendors TWAIN driver.

But many scanners also support addiitonal dynamic threhsolding options when scanning in Black and white to auto enhance the readability of the text on the image.

For example Kodak scanners use ICAP_HALFTONES to allow you to set other types of thresholding like ATP, or Ithresholding. So by setting the appropriate ICAP_HALFTONES value I can switch the scanner from Fixed Thresholding to ATP or Ithresholding instead. So I have been able to easily accomodate these Kodak options into my own TWAIN UI

Canon Scanners support several types of Dynamic Thresholding, but these options do not appear to all be implemented using CAP_HALFTONES (e.g. Error Diffusion is set using ICAP_HALFTONES , whereas are, whereas Advanced Text Enhancement and Advance Text Enhancement II are not set using ICAP_HALFTONES). I am looking for information from Canon that shows how to set the dyanmic thresholding to Advanced Text Enhancement using TWAIN advanced or extended capabilities.

Does anyone know how to do this for Canon Scanners?. At present I can set this by writing direct to the Canon Scanner ini file, but I should not have to do this.

Avision scanners also support several types of Dynamic Thresholding but in their UI they refer to this as binarization. Their options include Fixed proxessing, Dynamic Threshold, Halftone 1, Halftone 2, Halftone 3, Halftone 4, Halftone 5, Diffusion.

They have implemented Halftone 1, Halftone 2, Halftone 3, Halftone 4, Halftone 5, Diffusion using ICAP_HALFTONES, but Fixed proxessing and Dynamic Threshold have been implemented by some other method. At present I can set this by writing direct to the Aviision Scanner inii file, but I should not have to do this.

I have approached Avision for the information as to which specific scanner capabilities I should query/set so I can build the correct list of dynamic thresholding options for their scanners.

Why do Vendors implement features in their TWAIN UI's and not provide easy advanced TWAIN capability access to them?

If anyone else out there has specific knowledge on this I'd appreciate having a dialog with you.

Thanks Mike
Back to top
View user's profile Send private message
clivew



Joined: 29 Jan 2010
Posts: 10
Location: Carlsbad, CA

PostPosted: Tue Feb 09, 2010 11:46 am    Post subject: Reply with quote

Quote:
Why do Vendors implement features in their TWAIN UI's and not provide easy advanced TWAIN capability access to them?

For the same reason they don't bother to implement many of the capability getters Sad
Back to top
View user's profile Send private message Visit poster's website
fct



Joined: 19 Dec 2008
Posts: 23
Location: Spain

PostPosted: Wed Feb 10, 2010 4:26 am    Post subject: Reply with quote

I faced the same problem and ended up using twirl to reverse-engineer the UI and "sniff" which CAPS it was using.

I even wrote a small guide for that:
http://fmct.blogspot.com/2009/09/guessing-twain-custom-capabilities.html

Be aware that sometimes you might still have to write to the .INI/CUSTOMDSDATA settings depending on the scanner. For Fujitsu scanners I found there is no other way for features like their dynamic thresholding solution.
Back to top
View user's profile Send private message Visit poster's website
Mike Kirkby



Joined: 06 Jan 2010
Posts: 6
Location: Australia

PostPosted: Wed Feb 10, 2010 2:10 pm    Post subject: Setting TWAIN Custom Capabilities Reply with quote

Problem is solved.

I thought I'd say how I'd actually fixed the problem over the weekend.

I figured out a way to get all of the info I need regarding setting custom capabilities, without having to pull teeth getting the info from vendors.

1. Select Twain source
2. Open a TWAIN session
3. Build an array of all SUPPORTED CAPS and their current value (before array)
4. Launch the vendor TWAIN UI
5. Change the capabilities you want to change on the scanner
6. Scan a page to make sure settings stick
7. Open the TWAIN session again
8. Build an array of all SUPPORTED CAPS and their current value with the new settings (after array)
9. Compare the before and after capability arrays
10. The differences will be what we need to set to force the scanner into the mode we wanted to use.
11. Add code to my app that will set those changed custom capabilities just before we start the session.

Thanks to those who took the time to respond,escpecially the person who used Twirl to do a similar thing.

The guys at Dosadi have some very useful diagnostic tools on their website don't they! I'd like to thank them for helping the TWAIN community by having those tools online.

By the way the people who write the TWAIN drivers at Avision and Canon were very helpful in providing some hints on how to get around this. I can't name them here, but thanks also to them.

Hope others will find this info very useful.

Mike
Back to top
View user's profile Send private message
jimwatters



Joined: 04 Nov 2005
Posts: 89
Location: Ottawa, Canada

PostPosted: Thu Feb 11, 2010 7:42 am    Post subject: Reply with quote

This is one of the things the sample TWAIN2 application on SourceForge does.
https://sourceforge.net/projects/twain-samples/

Jim Watters
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Mike Kirkby



Joined: 06 Jan 2010
Posts: 6
Location: Australia

PostPosted: Thu Feb 11, 2010 3:20 pm    Post subject: Setting TWAIN Custom Capabilities Reply with quote

Thanks Jim,
I'll check it out

Mike
Back to top
View user's profile Send private message
Mike Kirkby



Joined: 06 Jan 2010
Posts: 6
Location: Australia

PostPosted: Mon Feb 15, 2010 5:39 pm    Post subject: Setting TWAIN capabilities Reply with quote

Just wanted to give my latest update on this topic. I ended up building a form in my application that allows me to capture TWAIN capabilities changes and also Ini File settings changes that are invoked after using the Vendor TWAIN UI.

Behind the scenes I just simply take before and after snapshots of the TWAIN CAPS and before and after snapshots for ini file settings. Then I compare before with after and display a list of changes to the operator, who then selects the changes they want to record. These changes are then played back by my app at the appropriate point in the actual scanning process.

Using a combination of these 2 approaches allows me to now set all of the scanner features that the Vendors show in their TWAIN UI, but have implemented using poorly documentated custom capabilities or ini file settings.

Thanks to all those who contributed to this topic.

Regards Mike
Back to top
View user's profile Send private message
gabe



Joined: 26 Jan 2006
Posts: 585
Location: I'm standing right behind you

PostPosted: Mon Feb 22, 2010 1:46 pm    Post subject: Reply with quote

Quote:
Why do Vendors implement features in their TWAIN UI's and not provide easy advanced TWAIN capability access to them?


asked another way, why don't more of them support CustomDsData which is built specifically for this purpose. the answer to this is kinda sad. but not as sad as the general state of most twain drivers out there.

.
Back to top
View user's profile Send private message Visit poster's website
Mike Kirkby



Joined: 06 Jan 2010
Posts: 6
Location: Australia

PostPosted: Wed Mar 10, 2010 7:15 pm    Post subject: Reply with quote

I sent an email to Fujitsu raising the fact that they are setting dynamic thresholding via the ini file only and not using custom caps.

They initially said they would not fix it, but after pointing out that Kodak and Canon provide TWAIN capabilities or custom caps to do this, they have agreed to address the issue in the next release of their TWAIN driver, where they will add a custom cap to allow you to flick between Fixed Processing, SDTC and Advanced DTC modes.

Mike
Back to top
View user's profile Send private message
Thierry



Joined: 19 Oct 2005
Posts: 61
Location: Montreal, Qc, Canada

PostPosted: Thu Mar 11, 2010 11:37 am    Post subject: Reply with quote

Mike Kirkby wrote:
I sent an email to Fujitsu raising the fact that they are setting dynamic thresholding via the ini file only and not using custom caps.

They initially said they would not fix it, but after pointing out that Kodak and Canon provide TWAIN capabilities or custom caps to do this, they have agreed to address the issue in the next release of their TWAIN driver, where they will add a custom cap to allow you to flick between Fixed Processing, SDTC and Advanced DTC modes.

Mike


I hope you're right, they never agreed to do anything like that before ...
Also if you obtain the 'FTS' file specification you'll be very lucky. I had to reverse engineered it (this way I can set the Advanced DTC' mode or any GUI option not provided directly as a capability).
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> General TWAIN Discussion All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group