Loading...

OCR: setRoi pixel

Support for GdTwain ActiveX and GdTwain Pro ActiveX/SDK.

OCR: setRoi pixel

Postby ctn » Wed Dec 17, 2008 6:36 pm

Dear all

I m using OCR and want to call the function setROI (left, top, width and height) to set the OCR region.
How do I know which pixel values are valid for the setRoi function?

Is there a function to get the X and Y pixels of the current picture?

Thank you for feedbacks.
Br,
Toan
ctn
 
Posts: 57
Joined: Thu Dec 04, 2008 6:20 pm

Re: OCR: setRoi pixel

Postby Loïc » Thu Dec 18, 2008 5:10 pm

Hi Toan,

I don't understand what you means by:

Is there a function to get the X and Y pixels of the current picture?


Could you give me more details ?


Best regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4441
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: OCR: setRoi pixel

Postby ctn » Mon Jan 05, 2009 10:37 am

Hi Loïc

My question was if there is a function the return the X and Y pixel values of the current picture which has been scanned?
The reason why I would like to know this is to set proper and valid values for the setROI (left, top, width and height pixels) function since im not using a GUI to select a region.

Br, ctn
ctn
 
Posts: 57
Joined: Thu Dec 04, 2008 6:20 pm

Re: OCR: setRoi pixel

Postby Loïc » Mon Jan 05, 2009 2:47 pm

Hi,

The SetRoi() function defines a region of interest into the native image.

Therefore :
- the minimum value for left parameter & top parameter is 0.
- maximum value for height parameter is image height
- maximum value for width parameter is image width
- maximum value for with parameter is image width - left
- maximum value for height parameter is image height - left


Best regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4441
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: OCR: setRoi pixel

Postby ctn » Fri Jan 09, 2009 11:49 am

Hi,

Whats the behaviour of gdTwain at setRoi if the values (left, top, width and height) are out of range (e.g. setRoi region bigger than TwainGetImageLayout region)?
I don't use GUI to set the region (setRoi) therefore all value are possible as input parameters.

Br, ctn
ctn
 
Posts: 57
Joined: Thu Dec 04, 2008 6:20 pm

Re: OCR: setRoi pixel

Postby ctn » Fri Jan 09, 2009 3:47 pm

Hi,

How can I check, if _gdTwain.SetROI() has been successfully set or not?
Thanks, ctn
ctn
 
Posts: 57
Joined: Thu Dec 04, 2008 6:20 pm

Re: OCR: setRoi pixel

Postby Loïc » Fri Jan 09, 2009 4:39 pm

Hi,

How can I check, if _gdTwain.SetROI() has been successfully set or not?


You need to check that yourself.

It's simple, the region (a rectangle) must be a part of the image. Therefore you have just to check if the points of coordinate of the rectangle are inside the image.

IE:

if left < 0 or left > ImageWidth- 1: ERROR
if top < 0 or top > ImageHeight -1: ERROR
if width < 0: ERROR
if height < 0: ERROR
if left + width > InageWidth: ERROR
if top + height > ImageHeight: ERROR

Best regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4441
Joined: Tue Oct 17, 2006 10:48 pm
Location: France


Return to GdTwain [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 2 guests