Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, June 27, 2007 5:04:50 PM(UTC)
Prabahar

Groups: Registered
Posts: 1


Hi,

We are using leadtool 11. And we used twainproperties to get the image in black and white, but the image we got, has more missing sections. So we decided to increase the L_INT nContrast, from default 2000 to 5000. And we get good image.

 

I would like to know, which is the recommended value for nContrast???

I attached your leadtool head file which consist of Twainproperties, for your reference

 

Twainproperties struct from Lttwn.h

typedef struct tagTWAINPROPERTIES

{

L_UINT32 lSize; /* the size of TWAINPROPERTIES - use sizeof(TWAINPROPERTIES) */

L_CHAR AppManufacturer[36];

L_CHAR AppProdFamily[36];

L_CHAR AppProdName[36];

L_CHAR SourceName[36];

L_INT nMaxPages;

L_INT nPixelType;

L_INT nBits;

L_INT nRes;

L_INT32 nXPos;

L_INT32 nYPos;

L_INT32 nWidth;

L_INT32 nHeight;

L_INT nBrightness;

L_INT nContrast;

L_INT nOrientation;

L_INT nFeederEnabled; /* enable the auto feeder */

L_INT nEnableAutoFeed; /* enable the automatic feeding */

L_INT nDuplex; /* detect whether duplex scanning is possible */

L_INT nEnableDuplex; /* enable the duplex scanning */

#ifdef WIN32

L_UINT32 dwReserved[3]; /* reserved fields, do not use */

#else

L_UINT32 dwReserved[4]; /* reserved fields, do not use */

#endif

} TWAINPROPERTIES, L_FAR * pTWAINPROPERTIES;

 

 

Best Regards

Prabahar

IPG R&D Hub, Hewlett-Packard

60 Alexandra Terrace,

The ComTech, SG 118502

TP: 672 72970

Registration No: 197000137C

 

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, June 28, 2007 4:08:53 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)


Prabahar,


There is no single value that
will fit all different documents in different scanners. The optimum value
depends on different factors, such as the lighting conditions, the paper and ink condition, the scanner used, and so on.


 


This means you should set the value to whatever suits your particular case.
 
#3 Posted : Wednesday, July 4, 2007 5:30:22 PM(UTC)
zhangliang

Groups: Registered
Posts: 7


Hi,

I am using leadtool v13, and my settings is similar to Prabar's. but I cannot set the contrast value to any number bigger that 2000. and after go throught the help file, I found that

Positive values up to +1000 Increase the contrast.
Negative values down to -1000 Decrease the contrast.
TWAIN_DEFAULT_CONTRAST [2000] Use the default.

So does this means that the default value is 2000, and the biggest Positive value is 1000? after reading this help file I am more confused.

please kindly help

thank you

zhang liang

 

 
#4 Posted : Wednesday, July 4, 2007 9:40:50 PM(UTC)
zhangliang

Groups: Registered
Posts: 7


Hi,

Problem resolved, it is because that i have a function to check the return value of setProperty() method.

thank you.

 

zhang liang

 
#5 Posted : Wednesday, July 4, 2007 9:53:16 PM(UTC)
zhangliang

Groups: Registered
Posts: 7


hi,

I am not sure whether this is an known issue in leadtool,

the problem is if I set the contrast rate to a value highter that 2000, then the setProperties() method will return -87 vaule "ERROR_TWAIN_BADVALUE -87 Data parameter out of range". allthought it returns a error, but the contrast rate is much better. and we can do a successful scan with this error message.

So the reason that last time I fail to set a value bigger that 2000 is because that, when I call setProperties() method, I will check whether leadtool will return an error message, if an error message is returned then I will cancel the scan job.

Just wondering, why leadtool return an error, but still set the value?

zhang liang

 
#6 Posted : Sunday, July 8, 2007 5:30:52 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)


When LEADTOOLS returns an error
from a Twain function, the error is usually sent by the Twain source (driver) or Twain Source Manager.


Did you try this with different Twain drivers?
 
#7 Posted : Monday, July 9, 2007 11:44:48 PM(UTC)
zhangliang

Groups: Registered
Posts: 7


hi,

when I set the contrast rate to a value larger than 2000, then leadtool will have a problem to handle this, and all the parameters will be reset to default value.

So I cannot increase the contrast rate to improve the image quality. so is there any other method we can use to improve this at application level?

thank you

zhang liang

 
#8 Posted : Wednesday, July 11, 2007 4:24:57 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

You could try using
the SetCapability2 method of the RasterTwain2 COM object, to control the L_ICAP_CONTRAST capability value.
 
#9 Posted : Thursday, July 12, 2007 5:13:47 PM(UTC)
zhangliang

Groups: Registered
Posts: 7


Thank you, and could you please provide more information on this, it will be best if you can provide an example.

my structure now is:

SetProperties()

Acquire()

AcquireCallBack()

any suggestion, how could I integrate your method into my code?

thank you

zhang liang

 
#10 Posted : Sunday, July 15, 2007 9:12:31 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)


Here's some VB code that I tested with the latest version of LEADTOOLS 13 and it worked:


 


'global variable defined as:


'Dim WithEvents tw As LEADRasterTwain2


 


Set tw = New LEADRasterTwain2


tw.InitSession (Me.hWnd)


tw.SelectSource


'tw.TwainAcquire Nothing, Me.hWnd


Dim cap As New LEADTwainCapability


cap.CapInfo.Capability = L_ICAP_CONTRAST


cap.CapInfo.ConType = LTwainContainerTypeConstants.L_TWON_ONEVALUE


Dim contrstVal As Single


contrstVal = 500


 


cap.CapOneValue.OneValItemType = LTwainItemTypeConstants.L_TWTY_FIX32


cap.CapOneValue.OneValCapValue = contrstVal


 


tw.SetCapability2 cap, LTwainCapabilitiesSetConstants.L_LTWAIN_CAPABILITY_SET


 


Dim capGetter As New LEADTwainCapability


capGetter.CapInfo.Capability = L_ICAP_CONTRAST


capGetter.CapInfo.ConType = LTwainContainerTypeConstants.L_TWON_ONEVALUE


tw.GetCapability2 capGetter, LTwainCapabilitiesGetConstants.L_LTWAIN_CAPABILITY_GETCURRENT


MsgBox capGetter.CapOneValue.OneValCapValue


 


tw.EndSession
 
#11 Posted : Monday, July 16, 2007 5:04:00 PM(UTC)
zhangliang

Groups: Registered
Posts: 7


Hi,

thank you and sorry for the late reply,  I do not have much experience with VB, do you set the contrast value to 500 in your code? if it is so, then we still did not solve my problem, since the value 2000 is still not good enough for our device, 500 sure cannot, actually I want to check with you whether we can set a value that much bigger that 2000, for example 5000.

and i have checked leadtool library, it seems that when we use setProperties() method, the max contrast value we can set mannuly is 1000, and the defalut value is 2000.

so by using your method what is the max value we can set?

thank you for your support.

zhang liang

 
#12 Posted : Monday, July 16, 2007 10:25:31 PM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)


Zhang,


I used 500 because the Twain driver I have here does not allow 2000.


In the Twain 1.9 specification document, the topic about ICAP_CONTRAST states:


 


Allowed Values: -1000 to +1000


 


Are you sure your Twain driver allows values above 1000?
 
#13 Posted : Tuesday, July 17, 2007 10:27:06 PM(UTC)
zhangliang

Groups: Registered
Posts: 7


yeah, you are right, twain driver will not allowed any value above 1000 except the value 2000 which is default.

and it seems that we cannot improve this at applicatino level, then I will see whether I can improve this in driver level.

thank you

zhang liang

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

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.109 seconds.