Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Re: Set TwainCapability ImageBrightness v15
Started by Mikes at 06-26-2008 16:13. Topic has 12 replies.

Print Search « Previous Thread Next Thread »
  06-26-2008, 16:13
Mikes is not online. Last active: 7/17/2008 10:14:12 PM Mikes

Top 500 Posts
Joined on 06-26-2008
Posts 7
Set TwainCapability ImageBrightness v15
Reply Quote

Hi,  I am in the process of demoing the TWAIN interface.
Having just downloaded the v15 demo.
Developing in VS2005 VB.NET   Dotnet framework 2.0

I do  have it working to some extent.

However I have been trying to set the ImageBrightness.

I have been using the vbTwainHighDemo as a starting point and the sample is having problems.

I call up the template and it displays the settings.
On a Lexmark the brightness and contrast value is showing up as decimal values, which seems incorrect.
i.e -3.9999847412109375
I have two HP scanners that both show a range of 1000 to -1000 with no decimals

I click, Okay, the check the errors and it notes that it failed.
(some other settings fail also i.e. contrast)

In the SetBrightnessCapability sub

1) the .selecteditem is being returned instead of the .selectedvalue
2) Brightness is being defined as a single
3) the session.imageeffects.brightness looks to be a single

As I have been totally unable to get that method to work.

I found the twaincapability way to do it using the onevaluecapability.
I've got two HP scanners where this works with Brightness as an Int32 with positive and negative numbers.
Both HP  Returns a range of 1000 to -1000
I've got a Lexmark x2690 w/scanner that works with this method with INT32 positive numbers, but not negative.

1) Any comment on my comments on the VBTwainHigh sample program?

2) Any idea on why the Lexmark is returning decimals and how to work around it?

Thanks

Mike


   Report 
  06-26-2008, 16:40
jigar is not online. Last active: 10/3/2008 1:08:01 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 421
Re: Set TwainCapability ImageBrightness v15
Reply Quote
Hello Mike,

1.  I have a Panasonic and I too get -1000 to 1000 for the brightness values.  I haven't worked with a Lexmark scanner before so I'm not sure on what type of value it is supposed to return.  You can do this, get Twacker (http://www.twain.org/devfiles/twainkit.exe).  Run Twack_32 from the start menu.  Then follow these steps:

     a.  File > Select Source > Select your Lexmark
     b.  Special > 1 Load/Open SM
     c.  Special > 2 Open Source
     d.  Special > 3 Send
          1.  Select Capability to equal ICAP_BRIGHTNESS
          2.  Select Container to equal TWON_RANGE
     e.  Click Send

Copy and paste what it returns in that Structure box here.  I want to see what it returns.

2.  If Twacker gets decimals above, our TwainSession will get the same thing.  We'll see if we can find a workaround based on the results you get in Twacker.


LEADTOOLS Technical Support
   Report 
  06-26-2008, 17:02
Mikes is not online. Last active: 7/17/2008 10:14:12 PM Mikes

Top 500 Posts
Joined on 06-26-2008
Posts 7
Re: Set TwainCapability ImageBrightness v15
Reply Quote

Thanks,

Here is Twacker Result Lexmark x2690 all in one printer scanner

ItemType=TWTY_FIX32
Min=-4.000
Max=4.000
StepSize=1.000
Default=0.000
Current=0.000

The LEAD Template from the VBTwainHigh shows for both contrast and brightness

-3.99998474121094
-2.99998474121094
-1.99998474121094
0.99998474121093
1.52587890625e-05
1.00001525878906
2.00001525878906
3.00001525878906   

It also defaults to resolution of 75 75
It also defaults to orientation of ROT0


 

 


   Report 
  06-27-2008, 10:12
jigar is not online. Last active: 10/3/2008 1:08:01 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 421
Re: Set TwainCapability ImageBrightness v15
Reply Quote
Check Lexmark's website to make sure you have the latest driver.  Then check the values to see if they differ in Twacker and in LEADTOOLS.  Also try hard-coding a value in the SetBrightnessCapability subroutine.  Like hardcode the value to be 3or -2, and see if that works.
LEADTOOLS Technical Support
   Report 
  06-27-2008, 12:06
Mikes is not online. Last active: 7/17/2008 10:14:12 PM Mikes

Top 500 Posts
Joined on 06-26-2008
Posts 7
Re: Set TwainCapability ImageBrightness v15
Reply Quote

The Driver for the Lexmark was already the latest from their web.
v1.2.8.1 Core Driver Package from April of 2008.

Here is my code for reference
Dim twCap As TwainCapability = New TwainCapability()
Dim capType As TwainCapabilityType = TwainCapabilityType.ImageBrightness
Dim Bright As Single = -2
twCap.Information.ContainerType = TwainContainerType.OneValue
twCap.Information.Type = TwainCapabilityType.ImageBrightness
twCap.OneValueCapability.ItemType = TwainItemType.Fix32
twCap.OneValueCapability.Value = Bright
_twainSession.SetCapability(twCap, TwainSetCapabilityMode.Set)

The Lexmark will work with positive whole numbers i.e. 0, 1, 2 3 4 
As expected by the Range it does not accept anthing greater than 5

I have been unable to get it to work with negative numbers. 
The exception, see below,  happens on the SetCapability line.

The HP Scanner works fine with Negative/Positive numbers.

Is this a Lexmark driver problem?
Any idea how I should report it to them?
Why does the LEAD View dialog show Decimals?

Hmm, thats interesting, I can use TWACKER to send negative numbers to the lexmark.
A subsequent GET shows the change took effect.
I did make sure the Lexmark is the source, course you can tell from the Range it is not the HP

ItemType=TWTY_FIX32
Min=-4.000
Max=4.000
StepSize=1.000
Default=0.000
Current=-3.000
 

Leadtools.Twain.TwainException was caught
  Message="Invalid capability value"
  Source="Leadtools.Twain"
  StackTrace:
       at Leadtools.Twain.TwainException.CheckErrorCode(Int32 code)
       at Leadtools.Twain.TwainSession.SetCapability(TwainCapability capability, TwainSetCapabilityMode mode)
       at PVI.PVI.pviImage.SetBrightnessCapability() in C:\Documents and Settings\RANDY\My Documents\Visual Studio 2005\Projects\PVI Imaging Leadtools\pviImaging.vb:line 323


   Report 
  06-27-2008, 16:09
jigar is not online. Last active: 10/3/2008 1:08:01 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 421
Re: Set TwainCapability ImageBrightness v15
Reply Quote
For twCap.OneValueCapability.ItemType try TwainItemType.Int32, or TwainItemType.Int16.  If Twacker can take a negative value then LEADTOOLS should be able to also.  Most of the time I use Int32 or Int16 for my value types, even for BOOL value type sometimes.

LEADTOOLS Technical Support
   Report 
  06-27-2008, 16:19
Mikes is not online. Last active: 7/17/2008 10:14:12 PM Mikes

Top 500 Posts
Joined on 06-26-2008
Posts 7
Re: Set TwainCapability ImageBrightness v15
Reply Quote

Been there, done that [:(]

Was wondering in my last post if I should have metioned it.

I did try as Int32 and it did not work.

Tried setting Brightness as an Int32 instead of single also.

HP has no problem with Int32

and Lexmark works as Int32 with positive numbers, but not negative.

Will play more over the weekend, see if I can hit upon a combination.

Thanks for you help so far.

 

 


   Report 
  06-27-2008, 16:30
jigar is not online. Last active: 10/3/2008 1:08:01 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 421
Re: Set TwainCapability ImageBrightness v15
Reply Quote
By chance do you have another Lexmark to test its behavior?  We don't have any Lexmark scanners here unfortunately.

LEADTOOLS Technical Support
   Report 
  06-29-2008, 10:01
Mikes is not online. Last active: 7/17/2008 10:14:12 PM Mikes

Top 500 Posts
Joined on 06-26-2008
Posts 7
Re: Set TwainCapability ImageBrightness v15
Reply Quote
No I do not have access to another Lexmark, only the one Lexmark x2690 and an HP7650.

However, this is not necessarily the scanner that we will be recommending to clients. Just one I had that I could test with. So this is not a critical problem to us. As I am new to leadtools and twain scanning in general, just making sure I was not doing something wrong.

I have been unable to find a combination that would work to send negative numbers to the Lexmark.

I have used the GetCapability (taken from a sample program) to look at the Brightness values returned and I am getting -3.99998474 {Single} for the MinValue.

To sumarize the observations on the lexmark are:
1: Twacker can send negative numbers
2: Leadtools fails when sending negative numbers
3: Twacker returns negative integer for the minvalue
4: Leadtools returns negative decimal number for the minvalue
5: Positive numbers work fine.
6: Leadtools is successful when sending negative numbers to the HP.

Using Leadtools.Twain.Dll v15.0.1.0
VS2005/VB.Net DotNet 2.0

Thanks, Mike
   Report 
  06-29-2008, 10:50
Mikes is not online. Last active: 7/17/2008 10:14:12 PM Mikes

Top 500 Posts
Joined on 06-26-2008
Posts 7
Re: Set TwainCapability ImageBrightness v15
Reply Quote
Hmm not wanting to confuse things,
but I was checking twain files and noticed that both the twunk_16.dll and twunk_32.dll are from HewlettPackard. both are v8.1.0.52

The twunk_16(v1.7.0.0) and twunk_32(v1.7.1.0) are from the twain working group.

The twain.dll and twain_32.dll are from twain working group also.

These are all in C:\windows.
I do not have other versions in different locations.

System is Windows XP Pro / SP2
   Report 
  06-30-2008, 10:38
jigar is not online. Last active: 10/3/2008 1:08:01 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 421
Re: Set TwainCapability ImageBrightness v15
Reply Quote
I don't have twunk_16.dll or twunk_32.dll on my machine probably because I've never had a HP scanner installed.  Maybe that has an effect on the Lexmark scanner?  Rename those 2 dlls to something else and see if there is a difference with the Lexmark.  You can also uninstall the HP scanner completely.  I'm going to see if we can get a scanner from Lexmark to reproduce this issue here.

LEADTOOLS Technical Support
   Report 
  07-01-2008, 20:32
Mikes is not online. Last active: 7/17/2008 10:14:12 PM Mikes

Top 500 Posts
Joined on 06-26-2008
Posts 7
Re: Set TwainCapability ImageBrightness v15
Reply Quote

I would not worry about the Lexmark scanner and I am not going to waste any more time trying to figure it out. After more playing it is a really poor scanner anyway. A five year old HP2610 produces better scans. It might be okay for grayscale but forget color.

Also as a side note: I happened across another TWAIN SDK can gave it a quick look. It is also getting decimal numbers for Brightness and it would not even allow positive whole numbers to be sent. 

As Twacker appears to have no problem, it would appear that Lexmark is doing something unusual that SDK makers are not expecting.

I am proceeding with my scan application developement with Leadtools.

I will be looking into real scanner.
Ours is going to be an ad-hoc scanning process, not production.
Probably a Fujitsu or Panasonic.

BTW what do you use?
Presumably it has no problems with Leadtoools....[;)]

Thanks

Mike


   Report 
  07-02-2008, 14:52
jigar is not online. Last active: 10/3/2008 1:08:01 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 421
Re: Set TwainCapability ImageBrightness v15
Reply Quote
If you could send and email to support@leadtools.com I could recommend some scanners.  Put it to my attention so the other agents know it belongs to me.

Thanks.

LEADTOOLS Technical Support
   Report 
Post
LEAD Support Fo... » Developer » Scanning/Captur... » Re: Set TwainCapability ImageBrightness v15

Powered by Community Server, by Telligent Systems