RecAPI
|
Image handling tools. More...
Classes | |
struct | IMG_INFO |
Structure of an image containing basic physical information. More... | |
struct | COMPRESSED_IMG_INFO |
Basic physical information of a compressed image buffer. More... | |
struct | CUT_INFO |
Structure for book images. More... | |
struct | PREPROC_INFO |
Information about preprocessing. More... | |
struct | RLINE |
Structure of a line. More... | |
Defines | |
#define | PHOLE_DETECT 1 |
Detect punch holes. It is combinable with PHOLE_REMOVE. | |
#define | PHOLE_REMOVE 2 |
Remove punch holes. It is combinable with PHOLE_DETECT. | |
#define | CROP_CLEARMARGIN 1 |
#define | CONVIMG_PALETTE 1 |
Create palette image. | |
#define | CONVIMG_ERRDIFF 2 |
Use error diffusion to simulate shades. | |
Typedefs | |
typedef IMG_INFO * | LPIMG_INFO |
Pointer to a structure IMG_INFO. | |
typedef const IMG_INFO * | LPCIMG_INFO |
Const pointer to a structure IMG_INFO. | |
typedef COMPRESSED_IMG_INFO * | LPCOMPRESSED_IMG_INFO |
Pointer to a structure COMPRESSED_IMG_INFO. | |
typedef const COMPRESSED_IMG_INFO * | LPCCOMPRESSED_IMG_INFO |
Const pointer to a structure COMPRESSED_IMG_INFO. | |
typedef struct RECPAGESTRUCT * | HPAGE |
Handle of a page in memory. | |
typedef IMG_CONVERSION * | LPIMG_CONVERSION |
Pointer to an enum type IMG_CONVERSION. | |
typedef DWORD | REC_COLOR |
Color type. | |
Enumerations | |
enum | IMG_COMPRESSION { COMPRESS_TIFHU = 0, COMPRESS_TIFG31, COMPRESS_TIFG32, COMPRESS_TIFG4, COMPRESS_JPEG, COMPRESS_JPG2K, COMPRESS_SIZE } |
Image compression types. More... | |
enum | JPG_RESOLUTION { JPG_RES_USEDEFAULTDPI = 0, JPG_RES_USEEXIF } |
Image resolution for JPEG files. More... | |
enum | JPG_ORIENTATION { JPG_ORIENTATION_IGNOREEXIF = 0, JPG_ORIENTATION_USEEXIF } |
Image orientation for JPEG files. More... | |
enum | IMG_CONVERSION { CNV_AUTO = 0, CNV_SET, CNV_NO, CNV_GLOBAL, CNV_GRAY } |
Image conversion types. More... | |
enum | IMG_ROTATE { ROT_AUTO = 0, ROT_NO, ROT_RIGHT, ROT_DOWN, ROT_LEFT, ROT_FLIPPED = ROT_NO + 0x80, ROT_RIGHT_FLIPPED, ROT_DOWN_FLIPPED, ROT_LEFT_FLIPPED } |
Available image transformations (rotation and/or mirroring). More... | |
enum | IMG_LINEORDER { TOP_DOWN = 0, BOTTOM_UP } |
Image line order. More... | |
enum | IMG_PADDING { PAD_BYTEBOUNDARY = 1, PAD_WORDBOUNDARY = 2, PAD_DWORDBOUNDARY = 4 } |
Image padding. More... | |
enum | IMG_RGBORDER { COLOR_RGB = 0, COLOR_BGR, COLOR_BGRA, COLOR_ARGB } |
Image color order. More... | |
enum | IMG_RESENH { RE_NO, RE_YES, RE_LEGACY, RE_STANDARD, RE_AUTO } |
Image resolution enhancement. More... | |
enum | IMG_INVERT { INV_NO = 0, INV_YES, INV_AUTO } |
Image inversion mode. More... | |
enum | IMG_DESKEW { DSK_2D = 0, DSK_AUTO = DSK_2D, DSK_NO, DSK_SET, DSK_3D, DSK_AUTO3D } |
Image deskewing mode. More... | |
enum | IMG_STRETCHMODE { STRETCH_DELETE = 0, STRETCH_OR, STRETCH_AND, STRETCH_AVG } |
Image stretching mode. More... | |
enum | IMAGEINDEX { II_UNDEFINED = -1, II_BGLAYER, II_ORIGINAL, II_CURRENT, II_BW, II_OCR, II_THUMBNAIL, II_OUTPUT, II_SIZE } |
Index of each image type in HPAGE. More... | |
enum | PREPROC_INFO_FLAGS { PREPROC_INFO_FAXCORRECTION = 1, PREPROC_INFO_INVERSION = 2, PREPROC_INFO_3DDESKEW = 4, PREPROC_INFO_STRAIGHTENED = 8, PREPROC_INFO_HALFTONE = 16 } |
Flags for the structure PREPROC_INFO. More... | |
enum | PROCESSING_MODE { PROCESSING_NORMAL = 0, PROCESSING_BOOK = 1 } |
Switching between processing modes. More... | |
enum | FILLAREA_FLAGS { FILL_INSIDE = 0, FILL_OUTSIDE = 1, FILL_FLEXIBLEBPS = 2 } |
Determining the area to be filled by kRecFillImgArea. More... | |
enum | DESPECKLE_METHOD { DESPECKLE_AUTO = 0, DESPECKLE_NORMAL, DESPECKLE_INVERSE, DESPECKLE_HALFTONE, DESPECKLE_MEDIAN , DESPECKLE_PEPPER = 8, DESPECKLE_SALT = 16, DESPECKLE_PEPPERANDSALT = (DESPECKLE_PEPPER | DESPECKLE_SALT) } |
Despeckle method used by kRecForceDespeckleImg. More... | |
enum | ERO_DIL_TYPE { ERO_DIL_3 = 0, ERO_DIL_4, ERO_DIL_8 } |
Type of neighborhood used by kRecImgErosion and kRecImgDilatation. More... | |
enum | IMG_FLAGS { IMG_FLAGS_CAMERAIMAGE = 0, IMG_FLAGS_NORESOLUTION } |
Image flags. More... | |
enum | RETAINCOLOR { RETAINCOLOR_NO, RETAINCOLOR_YES, RETAINCOLOR_INVERTED } |
Retain color. More... | |
Functions | |
RECERR RECAPIKRN | kRecSetImgDownsample (int sid, INTBOOL downsample) |
Changing the view downsample setting. | |
RECERR RECAPIKRN | kRecGetImgDownsample (int sid, INTBOOL *pdownsample) |
Getting the value of view downsample setting. | |
RECERR RECAPIKRN | kRecSetPreserveOriginalImg (int sid, INTBOOL preserve) |
Changing the keep original image setting. | |
RECERR RECAPIKRN | kRecGetPreserveOriginalImg (int sid, INTBOOL *pPreserve) |
Getting the value of the keep original image setting. | |
RECERR RECAPIKRN | kRecSetFaxCorrection (int sid, INTBOOL corr) |
Changing the fax correction setting. | |
RECERR RECAPIKRN | kRecGetFaxCorrection (int sid, INTBOOL *pCorr) |
Getting the value of fax correction setting. | |
RECERR RECAPIKRN | kRecSetThumbnailImgInfo (int sid, const IMG_INFO *pThumbnail, REC_COLOR color) |
Changing the thumbnail image info settings. | |
RECERR RECAPIKRN | kRecGetThumbnailImgInfo (int sid, IMG_INFO *pThumbnail, REC_COLOR *pColor) |
Getting the value of thumbnail image info settings. | |
RECERR RECAPIKRN | kRecSetImgBinarizationMode (int sid, IMG_CONVERSION BWConversion) |
Setting secondary image conversion mode. | |
RECERR RECAPIKRN | kRecGetImgBinarizationMode (int sid, LPIMG_CONVERSION pBWConversion) |
Getting secondary image conversion mode. | |
RECERR RECAPIKRN | kRecSetImgBrightness (int sid, int Brightness) |
Setting brightness. | |
RECERR RECAPIKRN | kRecGetImgBrightness (int sid, int *lpBrightness) |
Getting brightness. | |
RECERR RECAPIKRN | kRecSetImgThreshold (int sid, int Threshold) |
Setting the binarization threshold. | |
RECERR RECAPIKRN | kRecGetImgThreshold (int sid, int *pThreshold) |
Getting binarization threshold. | |
RECERR RECAPIKRN | kRecSetImgInvert (int sid, IMG_INVERT ImgInvert) |
Setting inversion mode. | |
RECERR RECAPIKRN | kRecGetImgInvert (int sid, IMG_INVERT *lpImgInvert) |
Getting inversion mode. | |
RECERR RECAPIKRN | kRecSetImgDeskew (int sid, IMG_DESKEW _ImgDeskew) |
Setting deskew mode. | |
RECERR RECAPIKRN | kRecGetImgDeskew (int sid, IMG_DESKEW *pImgDeskew) |
Getting deskew mode. | |
RECERR RECAPIKRN | kRecSetImgSlope (int sid, int Slope) |
Setting the slope. | |
RECERR RECAPIKRN | kRecGetImgSlope (int sid, int *lpSlope) |
Getting the slope. | |
RECERR RECAPIKRN | kRecSetImgRotation (int sid, IMG_ROTATE imgRotate) |
Setting rotation mode. | |
RECERR RECAPIKRN | kRecGetImgRotation (int sid, IMG_ROTATE *lpImgRotate) |
Getting rotation mode. | |
RECERR RECAPIKRN | kRecSetImgFormat (int sid, IMG_LINEORDER lineord, IMG_PADDING padding, IMG_RGBORDER ord) |
Setting image format. | |
RECERR RECAPIKRN | kRecGetImgFormat (int sid, IMG_LINEORDER *plineord, IMG_PADDING *ppadding, IMG_RGBORDER *pord) |
Getting image format. | |
RECERR RECAPIKRN | kRecSetImgStretchMode (int sid, IMG_STRETCHMODE ImgStretchMode) |
Setting stretching mode. | |
RECERR RECAPIKRN | kRecGetImgStretchMode (int sid, IMG_STRETCHMODE *pImgStretchMode) |
Getting stretching mode. | |
RECERR RECAPIKRN | kRecSetImgResolEnhancement (int sid, IMG_RESENH res) |
Setting resolution enhancement mode. | |
RECERR RECAPIKRN | kRecGetImgResolEnhancement (int sid, IMG_RESENH *res) |
Getting resolution enhancement mode. | |
RECERR RECAPIKRN | kRecSetImgDespeckleMode (int sid, INTBOOL bMode) |
Setting despeckle mode. | |
RECERR RECAPIKRN | kRecGetImgDespeckleMode (int sid, LPINTBOOL lpbMode) |
Getting despeckle mode. | |
RECERR RECAPIKRN | kRecSetImgConvMode (int sid, IMG_CONVERSION Conversion) |
Setting the primary image conversion mode. | |
RECERR RECAPIKRN | kRecGetImgConvMode (int sid, IMG_CONVERSION *pConversion) |
Getting primary image conversion mode. | |
RECERR RECAPIKRN | kRecPreprocessImg (int sid, HPAGE hPage) |
Image preprocessing. | |
RECERR RECAPIKRN | kRecGetPreprocessInfo (HPAGE hPage, PREPROC_INFO *pPreprocInfo) |
Returning information about the preprocessing. | |
RECERR RECAPIKRN | kRecRemovePunchHoles (int sid, HPAGE hPage, LPCRECT ROIs, int nROIs, LPRECT *Holes, int *nHoles, UINT flags, UINT minDiameter, UINT maxDiameter) |
Removing punch holes. | |
RECERR RECAPIKRN | kRecRemoveBorders (int sid, HPAGE hPage, UINT maxWidth) |
Removing marginal shadows. | |
RECERR RECAPIKRN | kRecDetectBook (int sid, HPAGE hPage, CUT_INFO *pInfo) |
Detecting facing book pages. | |
RECERR RECAPIKRN | kRecCreateBookPages (int sid, HPAGE hPage, HPAGE *phPage1, HPAGE *phPage2, const CUT_INFO *pInfo) |
Cutting each opened book image into two pages. | |
RECERR RECAPIKRN | kRecResetBookSize (int sid) |
Resetting the stored book page size. | |
RECERR RECAPIKRN | kRecDetectBlankPage (int sid, HPAGE hPage, INTBOOL *pIsBlank) |
Detecting blank pages. | |
RECERR RECAPIKRN | kRecAutoCropImg (int sid, HPAGE hPage, int lrMargin, int tbMargin, UINT flags) |
Cropping white border. | |
RECERR RECAPIKRN | kRecDetectFillingMethod (int sid, HPAGE hPage, FILLINGMETHOD *pocrType) |
Detection of filling method. | |
RECERR RECAPIKRN | kRecDetectImgSkew (int sid, HPAGE hPage, int *pSlope, IMG_ROTATE *pImgRotate) |
Detecting orientation and skew. | |
RECERR RECAPIKRN | kRecPutImgArea (int sid, LPCIMG_INFO lpImg, const BYTE *lpBitmap, HPAGE hPage, int xDst, int yDst, LPCSIZE pDstSize) |
Updating image area. | |
RECERR RECAPIKRN | kRecGetImgArea (int sid, HPAGE hPageIn, IMAGEINDEX iiImg, LPCRECT pSrcRect, LPCSIZE pDstSize, LPIMG_INFO pImg, BYTE **ppBitmap) |
Getting image area. | |
RECERR RECAPIKRN | kRecGetImgAreaEx (int sid, HPAGE hPageIn, IMAGEINDEX iiImg, LPCRECT pSrcRect, LPCSIZE pDstSize, IMG_STRETCHMODE StretchMode, IMG_LINEORDER LineOrder, IMG_RGBORDER RGBOrder, INTBOOL strict, IMG_PADDING Padding, LPIMG_INFO pImg, BYTE **ppBitmap) |
Getting image area. | |
RECERR RECAPIKRN | kRecStartReadImg (int sid, HPAGE hPage, IMAGEINDEX iiImg, LPCRECT pRect, IMG_ROTATE ImgRotation, LPWORD pBytes) |
Starting to read an image line-by-line. | |
RECERR RECAPIKRN | kRecReadImg (int sid, LPBYTE pBuff) |
Reading an image line-by-line. | |
RECERR RECAPIKRN | kRecStopReadImg (int sid) |
Stopping to read an image line-by-line. | |
RECERR RECAPIKRN | kRecStartWriteImg (int sid, LPCIMG_INFO pImg) |
Starting to write an image line-by-line. | |
RECERR RECAPIKRN | kRecWriteImg (int sid, const LPBYTE pBuff) |
Writing an image line-by-line. | |
RECERR RECAPIKRN | kRecStopWriteImg (int sid, HPAGE *phPage) |
Stopping the writing of an image line-by-line. | |
RECERR RECAPIKRN | kRecRotateImgArea (int sid, HPAGE hPage, IMAGEINDEX iiImg, LPCRECT pSrcRect, IMG_ROTATE Rotation, LPIMG_INFO lpImg, BYTE **lplpBitmap) |
Copying image area with rotation. | |
RECERR RECAPIKRN | kRecInvertImgArea (int sid, HPAGE hPage, LPCRECT lpRect) |
Inverting image area. | |
RECERR RECAPIKRN | kRecClearImgArea (int sid, HPAGE hPage, LPCRECT lpRect) |
Clearing image area. | |
RECERR RECAPIKRN | kRecFillImgArea (int sid, HPAGE hPage, LPCRECT lpRect, REC_COLOR color, FILLAREA_FLAGS flags) |
Filling image areas with a specified color. | |
RECERR RECAPIKRN | kRecDeskewImg (int sid, HPAGE hPage, int ImgSlope) |
Deskewing. | |
RECERR RECAPIKRN | kRec3DDeskewImg (int sid, HPAGE hPage) |
3D deskewing | |
RECERR RECAPIKRN | kRecEnhanceWhiteboardImg (HPAGE hPage) |
Enhancing images taken from whiteboards. | |
RECERR RECAPIKRN | kRecTransformImgByMatrix (int sid, HPAGE hPage, const SIZE *newsize, const double *matrix) |
Performing geometrical transformation determined by a matrix. | |
RECERR RECAPIKRN | kRecTransformImgByPoints (int sid, HPAGE hPage, const SIZE *newsize, const POINT *pOriginal, const POINT *pTransformed, int nPoints) |
Performing geometrical transformation determined by points. | |
RECERR RECAPIKRN | kRecIsImgPalette (int sid, HPAGE hPage, IMAGEINDEX iiImg, LPINTBOOL pbPal) |
Inquiring about palette of the image. | |
RECERR RECAPIKRN | kRecSetImgPalette (HPAGE hPage, const BYTE *pPal) |
Setting palette of the image. | |
RECERR RECAPIKRN | kRecGetImgPalette (int sid, HPAGE hPage, IMAGEINDEX iiImg, LPBYTE pPal) |
Getting the palette of the image. | |
RECERR RECAPIKRN | kRecDespeckleImg (int sid, HPAGE hPage) |
Despeckling. | |
RECERR RECAPIKRN | kRecForceDespeckleImg (int sid, HPAGE hPage, LPCRECT pRect, DESPECKLE_METHOD method, int level) |
Forcing despeckle. | |
RECERR RECAPIKRN | kRecImgErosion (int sid, HPAGE hPage, ERO_DIL_TYPE type) |
Erosion. | |
RECERR RECAPIKRN | kRecImgDilatation (int sid, HPAGE hPage, ERO_DIL_TYPE type) |
Dilatation. | |
RECERR RECAPIKRN | kRecConvertImg2BW (int sid, HPAGE hPageIn, IMG_CONVERSION Conversion, int Brightness, int Threshold, IMG_RESENH resolenh, HPAGE *phPageOut) |
Converting an image to a B/W image. | |
RECERR RECAPIKRN | kRecTransformImg (int sid, HPAGE hPage, IMAGEINDEX iiImg, LPCRECT pSrcRect, LPCSIZE pDstSize, WORD BitsPerPixel, HPAGE *phPageOut) |
Transforming an image. | |
RECERR RECAPIKRN | kRecTransformImgPalette (int sid, HPAGE hPage, IMAGEINDEX iiImg, LPCRECT pSrcRect, LPCSIZE pDstSize, HPAGE *phPageOut) |
Transforming palette-color images. | |
RECERR RECAPIKRN | kRecCopyImgArea (int sid, HPAGE hPageDst, LPCRECT pRectDst, HPAGE hPageSrc, LPCRECT pRectSrc) |
Copying an image area. | |
RECERR RECAPIKRN | kRecMergeImgArea (int sid, HPAGE hPageDst, LPCRECT pRectDst, HPAGE hPageSrc, LPCRECT pRectSrc, REC_COLOR tColor) |
Merging areas of images. | |
RECERR RECAPIKRN | kRecConvertImg (int sid, HPAGE hPage, WORD BitsPerPixel, UINT flags) |
Changing color depth. | |
RECERR RECAPIKRN | kRecLineRemoval (int sid, HPAGE hPage, const RECT *pRect) |
Removing lines. | |
RECERR RECAPIKRN | kRecRemoveLines (int sid, HPAGE hPage, IMAGEINDEX iiImg, const RECT *pRect) |
Removing lines. | |
RECERR RECAPIKRN | kRecGetLineCount (HPAGE hPage, int *pnLines) |
Getting the number of rule lines. | |
RECERR RECAPIKRN | kRecGetLineInfo (HPAGE hPage, IMAGEINDEX iiImg, PRLINE pLine, int nLine) |
Getting rule line information. | |
RECERR RECAPIKRN | kRecGetFrameCount (HPAGE hPage, int *pnFrames) |
Getting the number of frames. | |
RECERR RECAPIKRN | kRecGetFrameInfo (HPAGE hPage, IMAGEINDEX iiImg, LPCELL_INFO pFrame, int nFrame) |
Getting frame information. | |
RECERR RECAPIKRN | kRecSetDropoutColorWeights (int sid, int wred, int wgreen, int wblue) |
Changing the dropout color weight settings for binarization. | |
RECERR RECAPIKRN | kRecGetDropoutColorWeights (int sid, int *pwred, int *pwgreen, int *pwblue) |
Getting the dropout color weight settings. | |
RECERR RECAPIKRN | kRecDetectDropoutColorWeights (int sid, HPAGE hPage, IMAGEINDEX iiImg, RECT *pRect, int *pwred, int *pwgreen, int *pwblue) |
Detecting dropout color weights. | |
RECERR RECAPIKRN | kRecDropImg (HPAGE hPage, IMAGEINDEX iiImg) |
Removing an image from the page. | |
RECERR RECAPIKRN | kRecTransformCoordinates (HPAGE hPage, IMAGEINDEX iiDst, IMAGEINDEX iiSrc, int nP, LPPOINT pPoint) |
Transforming coordinates between images of a page. | |
RECERR RECAPIKRN | kRecRotateImg (int sid, HPAGE hPage, IMG_ROTATE Rotation) |
Rotating the page. | |
RECERR RECAPIKRN | kRecCreateImg (int sid, int sizeX, int sizeY, int dpiX, int dpiY, WORD BitsPerPixel, HPAGE *phPage) |
Creating an empty image. | |
RECERR RECAPIKRN | kRecFreeImg (HPAGE hPage) |
Removing a page. | |
RECERR RECAPIKRN | kRecGetImgInfo (int sid, HPAGE hPage, IMAGEINDEX iiImg, LPIMG_INFO pImg) |
Getting image information. | |
RECERR RECAPIKRN | kRecGetImgMetaData (HPAGE hPage, HSETTING *phMetaData) |
Getting additional information about the page. | |
RECERR RECAPIKRN | kRecGetImgFlags (HPAGE hPage, IMG_FLAGS Flag, INTBOOL *pbValue) |
Getting the value of image flags. | |
RECERR RECAPIKRN | kRecSetImgFlags (HPAGE hPage, IMG_FLAGS Flag, INTBOOL bValue) |
Setting the image flags. | |
RECERR RECAPIKRN | kRecSetImgResolution (HPAGE hPage, SIZE DPI) |
Changing the resolution of an image. | |
RECERR RECAPIKRN | kRecSetRetainColor (int sid, RETAINCOLOR RetainColor) |
Changing retain color setting. | |
RECERR RECAPIKRN | kRecGetRetainColor (int sid, RETAINCOLOR *pRetainColor) |
Getting retain color setting. | |
RECERR RECAPIKRN | kRecImgAutoEnhance (HPAGE hPage, BYTE blackPointred, BYTE whitePointred, BYTE blackPointgreen, BYTE whitePointgreen, BYTE blackPointblue, BYTE whitePointblue) |
Image auto-enhancement. | |
REC_COLOR flag values | |
Possible values of REC_COLOR type. | |
#define | REC_UNDEF_COLOR 0x01000000 |
Undefined color. | |
#define | REC_TRANSPARENT_COLOR 0x02000000 |
Transparent color (text on graphics) | |
#define | REC_DEFAULT_COLOR 0x80000000 |
Default color. | |
#define | REC_DEFAULT_BGCOLOR 0x81000000 |
Default background color. | |
#define | REC_BLACK 0x00000000 |
Black color. | |
#define | REC_WHITE 0x00ffffff |
White color. | |
Flags of rule lines | |
See RLINE::flag. | |
#define | LF_HVMASK 0x03 |
Mask of horizontal / vertical flags. | |
#define | LF_HORZ 0x01 |
Horizontal rule line. | |
#define | LF_VERT 0x02 |
Vertical rule line. |
Image handling tools.
The Capture SDK Engine is page-oriented: the basic unit used in processing is typically the image of the page, Most functions require a page (HPAGE) as an input parameter, but some API calls also operate on rectangular areas of the image (zones).
The Image handling module enables the Engine to handle several pages at the same time. The limit on the number of pages depends on the size of available physical memory and the size of the swap file used as virtual memory. The Engine can only manage and process pages within its own memory space: images must be loaded into the Engine first (by the Image File Handling Module, or the Scanning Module). Possible image sources include files, scanning devices or the memory of the integrating application.
HPAGE may contain different representations of the loaded image. These correspond to processing phases (loading, preprocessing, OCR) or to image use (view, thumbnail). The representations can be identified by IMAGEINDEX.
The best resolution for B/W images is 300 or 400 dpi. For grayscale or color images the optimal recogniton resolution is 150 to 300 dpi.
Before quitting, the application should free all pages created in the Image Handling Module (kRecFreeImg).
NOTE: In both the SDK and its documentation coordinates refer to grid-coordinates - i.e. the top or left borders of pixels. Thus a rectangle does not contain the pixels according to its right and bottom coordinates.
CSDK offers pre-recognition functions to apply image pre-processing procedures to images. These will enhance their quality, and yield more accurate auto-zoning and recognition. Preprocessing can include any or all of the following steps:
In addition, image despeckling (kRecSetImgDespeckleMode) and resolution enhancements (kRecSetImgResolEnhancement) are also performed internally so that the above transformations can render better results.
Additional tasks in this module include
The working of Image Handling Module can also be adjusted with settings in some points.
The automatic orientation (ROT_AUTO) and automatic deskewing (DSK_AUTO) algorithm supports the following types of textual content (FILLINGMETHOD):
For the expected result of these automatic algorithms the image should be of good quality and it should include at least one text line which includes a machine printed text of at least 30 characters.
Neither handprinted text nor 9-pin draft dot-matrix printouts can be used for automatic deskewing or automatic orientation of the image.
Detecting the skew (kRecDetectImgSkew) is effective only on images with lower than 15-degree skew. However, the deskew operation uses different limits.
There are lower limits of performing deskew, because under these limits deskew does not help to improve accuracy, but may result in lower accuracy. These lower limits depend on the setting RMTRADEOFF as the following:
TO_ACCURATE
and TO_BALANCED:
TO_FAST:
Under these limits, deskew is not run.
In fast mode, the thresholds are higher, because the used OCR engines are more sensitive to noise on the contours. In accurate and balanced mode, the higher layout accuracy requires lower thresholds (e.g. drawing splitters into a large gridded table).
On grayscale and true-color images an interpolation algorithm can be applied, so the deskewed characters contain less noise. On B/W and palette-color images interpolation cannot be applied, so if the slope is small, deskew method damages the character contours and does not help to improve accuracy.
The upper limit may also differ. Performing a programmed (DSK_SET) or an immediate (kRecDeskewImg) deskew, the upper limit is 30 degrees.
There is a 'reconstruct' algorithm which is performed only on B/W images during deskew, if the slope of the image is less than the setting Kernel.Img.ReconstructAngle.
Normally, when this algorithm is not applied, deskew performs horizontal and vertical shearings on the image. Therefore shearing creates 'steps' on the contours of the characters.
The reconstruct algorithm restores the shapes of the small characters to their original state. So these small characters remain slanted but their positions will be deskewed. In this case, the OCR accuracy is little bit higher than without this reconstruction.
The deskew and orientation detection work in a different way with Arabic language than in the case of other languages. The working of both operations can be adjusted through settings (Kernel.Img.Deskew.EnabledForArabic and Kernel.Img.Rotation.EnabledForArabic). If these settings are FALSE
(in default), the AUTO
methods (DSK_AUTO, ROT_AUTO) of these operations for Arabic OCR equal to the case when they are switched off (DSK_NO, ROT_NO). If the settings are TRUE
, or the deskew and orientation are not set to AUTO
, the working of these methods are the same for both the Arabic and the Western cases.
OCR can now be performed on images containing texts that were captured by digital cameras with 2 megapixels and above. This is achieved with new pre-processing algorithms. Automatic digital camera preprocessing has three parts:
The following table shows the recommended minimum point size of text for different megapixel values – assuming focus is sharp, contrast is high and images are taken with care, as described below.
A4 (8.27” x 11.69”) | A5 (8.27” x 5.85”) | |
Pixel size in a 300 dpi scan | 2481 x 3507 | 1753 x 2481 |
2 megapixels (1600 x 1200) | 18 pts | 12 pts |
3 megapixels (2048 x 1536) | 14 pts | 10 pts |
4 megapixels (2272 x 1704) | 12 pts | 9 pts |
5 megapixels (2560 x 1920) | 11 pts | 8 pts |
The point sizes given for the European A4 size are also valid for the American Letter sized page (8.5” x 11”). A5 is similar to half a Letter-sized page.
As a general rule, an upper case letter must have at least 18 pixels vertically. Therefore, when capturing just several lines of large text, for instance from a label or notice, even a simple mobile phone camera under 0.5 megapixels can deliver good recognition if the rules given below are followed.
Of course these pre-processing algorithms can be applied to any image containing text distorted as described, irrespective of the capturing device. Conversely, text well captured by digital camera without distortions and good lighting may be successfully processed by the normal algorithms.
The preprocessing function or method IMG_DESKEW has a new parameter: DSK_3D, in addition to DSK_AUTO, DSK_NO, DSK_SET. When you call the preprocess method with DSK_3D
, three-dimensional deskewing runs, as detailed above. If an Asian language (either CCJK, Arabic, Thai or Hebrew) is set for recognition before pre-processing, auto-deskew will not be available.
This feature can be accessed only from the IVC visual control of the CSDK. Please see the CSDK Visual Controls documentation for details.
The detection of colored lines and inverse texts in the recognition process is improved in CSDK 16. Line color is detected only if the retain color setting is set to RETAINCOLOR_YES. See also: Kernel.OcrMgr.RetainColor and kRecSetRetainColor. Inverted text is automatically detected; it requires no special zone type, being expressed simply as a font color/background color combination. White letters on a black background will be detected in all cases; to conserve colored inverse text or backgrounds, RETAINCOLOR_YES
must be set.
The line color attribute is stored in the color field of the RLINE structure and can be obtained by the function kRecGetLineInfo.
Scanners often have the possibility of specifying whether the type of the document is 'text', 'photo' or 'text/photo' (mixed). When text/photo or photo is selected (and black-and-white scanning is choosen) the scanners apply a halftone or dithering algorithm to simulate gray levels. In this case the scanned image contains a lot of noise and a special despeckle algorithm is required to preprocess it before OCR. This special algorithm can be switched on and off with the setting Kernel.Img.Despeckle.Halftone. See also notes of kRecSetImgDespeckleMode.
#define CROP_CLEARMARGIN 1 |
Fill the remaining margins white.
typedef DWORD REC_COLOR |
Color type.
This is 24-bit color information. The lower 8 bits are the red component, the next 8 bits are the green one and the third 8 bits the blue one. These components are intensity values from 0 to 255. Black is 0 (REC_BLACK) and white is 0xFFFFFF (REC_WHITE). There are some additional predefined colors: REC_UNDEF_COLOR and REC_DEFAULT_COLOR.
enum DESPECKLE_METHOD |
Despeckle method used by kRecForceDespeckleImg.
DESPECKLE_AUTO |
The applied method is determined automatically. kRecForceDespeckleImg performs the same adaptive noise removal, as kRecDespeckleImg. Level is not used. |
DESPECKLE_NORMAL |
Black noise is removed, contours are smoothed. Level can be set between 1 and 4. |
DESPECKLE_INVERSE |
White noise is removed, contours are smoothed. Level can be set between 1 and 4. |
DESPECKLE_HALFTONE |
Despeckle half-tone image. Level can be set between 1 and 4. |
DESPECKLE_MEDIAN |
3*3 median filtering. Level is not used. |
DESPECKLE_PEPPER |
Remove small noise from contours. level is not used. Remove black dots whose width and height are less or equal to the given size. The contours of the other objects are not smoothed. The level parameter specifies the size, it must be between 1 and 256. |
DESPECKLE_SALT |
Remove white dots whose width and height are less or equal to the given size. The contours of the other objects are not smoothed. The level parameter specifies the size, it must be between 1 and 256. |
DESPECKLE_PEPPERANDSALT |
Remove both black and white dots whose width and height are less or equal to the given size. |
enum ERO_DIL_TYPE |
Type of neighborhood used by kRecImgErosion and kRecImgDilatation.
enum FILLAREA_FLAGS |
Determining the area to be filled by kRecFillImgArea.
enum IMAGEINDEX |
Index of each image type in HPAGE.
HPAGE may contain several images created from the same page source (e.g. scanner, image file, etc). These image types play different roles: distinct page processing phases run on them. You can refer to these image types using their indices.
Each image type of HPAGE may have different coordinate systems. In the page all the coordinates are stored referring to the coordinate system of the black-and-white image. However, coordinates passing to or getting from the functions can refer to the coordinate system of any image.
Due to the conversions between coordinate systems, a coordinate received from a function may differ from the previously set coordinate.
After preprocessing, rotating or deskewing, the difference between the coordinate systems of the current and original images is a geometric rotating transformation. Thus, if there is a rectangle (possibly a zone) specified with the coordinates from the original image its vertices are converted into the BW image and the bounding rectangle of the resulting points are stored. Therefore, the vertices of the stored rectangle can significantly differ from those of the original one.
The coordinate system of the BW image can differ from that of the current image only in a scalar factor viz. if the current one is not binary and resolution enhancement is used at binarization, the resulting image has a higher resolution.
The OCR and the BW images have the same coordinate systems.
Coordinates are specified in pixels. The origin is always in the top-left corner of the image with the coordinates (0,0). The bottom-right pixel has the coordinates (sx-1, sy-1)
, where sx
is the horizontal and sy
is the vertical size of the image in pixels.
When a function gets an IMAGEINDEX for specifying the coordinate system, II_THUMBNAIL cannot be passed. The functions accepting this index are as follows: kRecGetImgArea, kRecStartReadImg, kRecRotateImgArea, kRecIsImgPalette, kRecGetImgPalette, kRecTransformImg, kRecTransformImgPalette, kRecDropImg, kRecGetImgInfo, kRecSaveImg, kRecSaveImgForce, kRecSaveImgF, kRecSaveImgForceF, kRecSaveImgArea, kRecSaveImgAreaF, kRecInsertImgFilePage, kRecMatchImgFileFormat, kRecMatchImgFileFormat, kRecUpdateImgFilePage.
Lifetime of different images:
II_UNDEFINED |
Undefined type. |
II_BGLAYER |
Background layer. This image exists only for non-image-only PDF and XPS. It contains the background image without the text layer. Used internally by the PID_DECOMPOSITION process. |
II_ORIGINAL |
Original image from scanner or from file. Deskew, rotation, and other image manipulation functions do not modify this image. By default this image exists until |
II_CURRENT |
This is the current image. Most functions work on this image. This image always exists. After loading an image it corresponds with the original image. Deskew, rotation, and other image manipulation functions modify this image. To keep compatibility with the previous version of CSDK, use II_CURRENT. |
II_BW |
Black-and-white image generated from the current image during pre-processing or implicit secondary image conversion. This image is used e.g. by the PID_DECOMPOSITION process. It can have higher resolution than the current image. |
II_OCR |
OCR image generated from the BW one by the recognition process. This is a black-and-white image used by the OCR engines. It contains information only inside the zones to be recognized. These zones may be auto-inverted; underlines and graphical elements may be removed from them. The creation method depends on the current page parse, OCR settings and the properties of the zones |
II_THUMBNAIL |
Thumbnail image (miniature color image) generated from the current one. Its creation preserves aspect ratio, but the resulting image has the user-given size. Therefore empty areas may be generated at the top and bottom, or the left and right sides of that image. These empty areas will be filled with a given color called thumbnail color. See kRecSetThumbnailImgInfo. |
II_OUTPUT |
Used internally by output converters. |
II_SIZE |
Number of image types for verifying index validity and creating the image array. |
enum IMG_COMPRESSION |
Image compression types.
These types can be used at loading page from compressed memory buffer (kRecLoadImgMC and kRecLoadImgDataStreamMC).
enum IMG_CONVERSION |
Image conversion types.
Image conversion modes to be applied for conversions from grayscale or color image sources. These values specify how different image types will be converted either during primary image conversion ( loading an image into the Engine) or during secondary image conversion, (an image - already in the Engine's memory space - undergoes an image conversion step).
CNV_SET
and CNV_GLOBAL
produce the same results as they do during secondary image conversion. However, CNV_AUTO
method is faster in primary than in secondary conversion, but the result is less optimal for OCR. In general, it is true that the most optimal result for OCR can be achieved with the default values of these settings. CNV_AUTO |
This affects grayscale or 24-bit color images: a B/W image will be created in the Engine's memory. Image binarization applies an automatic adaptive thresholding algorithm. The kRecSetImgBrightness function can be used to tune the threshold calculation. |
CNV_SET |
This affects grayscale or 24-bit color images: a B/W image will be created in the Engine's memory. Thresholding with a user-defined threshold value, set by the kRecSetImgThreshold function. |
CNV_NO |
There will be no conversion while image loading. The image will be loaded into the Engine's memory without any conversion (i.e. a color image will retain its color attributes). |
CNV_GLOBAL |
This affects grayscale or 24-bit color images: a B/W image will be created in the Engine's memory. For image binarization, an automatic thresholding algorithm with a page-level global threshold value is applied. |
CNV_GRAY |
For a color image: a grayscale image will be created in the Engine's memory. For a B/W or grayscale image: no conversion will be performed while loading the image. |
enum IMG_DESKEW |
Image deskewing mode.
This setting determines the deskewing mode during image preprocessing.
DSK_2D |
Automatic 2D deskewing (Default). |
DSK_AUTO |
Deprecated. Use DSK_2D instead. |
DSK_NO |
No deskewing applied. |
DSK_SET |
Deskew with a given angle set by the kRecSetImgSlope function. |
DSK_3D |
Automatic 3D deskewing applied. |
DSK_AUTO3D |
Automatic 2D or 3D deskewing: 2D deskewing applied on scanned images and 3D deskewing applied on digital camera images. see also: IMG_FLAGS |
enum IMG_FLAGS |
Image flags.
These flags can be inquired by kRecGetImgFlags, and used by kRecPreprocessImg
enum IMG_INVERT |
Image inversion mode.
Possible inversion modes. This setting determines the inversion mode used by kRecPreprocessImg on the whole image. Note that kRecPreprocessImg inverts the II_BW image only. The inversion means that the II_BW image is changed from white-on-black to black-on-white, because this is needed for successful recognition.
INV_NO |
No inversion required. |
INV_YES |
Image inversion should be performed. The II_BW image is inverted. |
INV_AUTO |
Automatically inverts the II_BW image, if necessary (Default): whether the image is inverse is determined during preprocessing. |
enum IMG_LINEORDER |
Image line order.
Line order setting determines the order of the lines in the passed or received buffer on calling kRecLoadImgM, kRecPutImgArea, kRecGetImgArea and kRecRotateImgArea. To specify this setting use kRecSetImgFormat before invoking any of the above functions.
enum IMG_PADDING |
Image padding.
Padding mode setting for the image in the application's memory space. The Padding mode setting determines how the lines in the image are to be padded on calling kRecGetImgArea and kRecRotateImgArea. To specify this setting use kRecSetImgFormat call before invoking any of these functions.
enum IMG_RESENH |
Image resolution enhancement.
Resolution enhancement is applied during the binarization of non-B/W images. It means that the resolution of the created binary image is larger than the resolution of the non-BW image. The ratio of the enhancement currently can be 1.5 or 2.0, depending on the current IMG_RESENH setting. For images from digital camera or phone the ratio can be 0.5 as well. To set resolution enhancement, use the kRecSetImgResolEnhancement function.
RE_NO |
No resolution enhancement applied. |
RE_YES |
Apply enhancement, ratio = 2.0. |
RE_LEGACY |
The ratio of the enhancement depends on the resolution of the non-BW image. The ratio is 2.0 if the resolution is less than or equal to 160 DPI, and 1.5 if the resolution is less than or equal to 210 DPI. Otherwise resolution enhancement is not applied (this mode is the same as RE_AUTO in version 12.6). |
RE_STANDARD |
The ratio is detected dynamically: it depends on the resolution of the non-BW image and on the detected average character size. Resolution enhancement is not applied above 210 DPI. The mentioned character size detection is performed only during image preprocessing, thus without calling kRecPreprocessImg |
RE_AUTO |
Enhancement depends on the current trade-off setting: if trade-off is TO_FAST use RE_LEGACY, otherwise use RE_STANDARD. RE_AUTO is the default setting. |
enum IMG_RGBORDER |
Image color order.
Possible orders of the composite color components of a 24-bit color image. It defines how the image is to be interpreted on calling kRecLoadImgM, kRecPutImgArea, kRecGetImgArea kRecRotateImgArea and kRecGetImgAreaEx. To specify this setting, use the kRecSetImgFormat call before invoking the above functions (except for kRecGetImgAreaEx).
COLOR_RGB |
Defines that the order of the composite color components is R-G-B (Default). |
COLOR_BGR |
Defines that the order of the composite color components is B-G-R (used for Windows DiBitmap). |
COLOR_BGRA |
Defines that the order of the composite color components is B-G-R-A (blue-green-red-alpha). This value is used only by kRecGetImgAreaEx and kRecLoadImgM. |
COLOR_ARGB |
Defines that the order of the composite color components is A-R-G-B (alpha-red-green-blue). This value is used only by kRecGetImgAreaEx and kRecLoadImgM. |
enum IMG_ROTATE |
Available image transformations (rotation and/or mirroring).
Rotation is always carried out in 90-degree steps. The following table shows the results of the image transformation using different values.
123 |
456 |
789 |
ROT_NO: | LEFT: | RIGHT: | DOWN: | |||
123 | 369 | 741 | 987 | |||
456 | 258 | 852 | 654 | |||
789 | 147 | 963 | 321 | |||
FLIPPED: | LEFT_FLIPPED: | RIGHT_FLIPPED: | DOWN_FLIPPED: | |||
321 | 147 | 963 | 789 | |||
654 | 258 | 852 | 456 | |||
987 | 369 | 741 | 123 |
enum IMG_STRETCHMODE |
Image stretching mode.
Possible values for the Image stretching mode setting. This setting is used by the kRecGetImgArea function if the destination rectangle size is definitely smaller than the source one. The setting specifies how the pixels of the input image are combined to get the resulting image during the operation of this function.
STRETCH_DELETE |
Deletes eliminated pixels. Information in the eliminated pixels is not preserved (Default). |
STRETCH_OR |
Uses the OR operator to combine eliminated pixels with the remaining ones. This mode preserves black pixels at the expense of white pixels. (Assuming that black is coded as 1.) |
STRETCH_AND |
Uses the AND operator to combine eliminated pixels with the remaining ones. This mode preserves white pixels at the expense of black pixels. |
STRETCH_AVG |
If the image is B/W, 4-bit grayscale or 8-bit grayscale use 256-level grayscale to combine eliminated pixels. This results in an output of an 8-bit grayscale bitmap. If the image is palette-color or 24-bit color, use 24-bit color to combine eliminated pixels. This produces an output of a 24-bit color bitmap. Note, that if the destination rectangle size is greater than the source rectangle size, the BitsPerPixel of the output bitmap will be the same as the BitsPerPixel of the input image. Use the returned IMG_INFO from kRecGetImgArea to obtain the correct BitsPerPixel value of the created bitmap. |
enum JPG_ORIENTATION |
Image orientation for JPEG files.
Possible values of Kernel.Imf.JPG.Orientation setting. This setting specifies the orientation of the image when JPEG file is loaded.
enum JPG_RESOLUTION |
Image resolution for JPEG files.
Possible values of Kernel.Imf.JPG.Resolution setting. This setting specifies how to set image resolution if the header of the input JPEG file does not contain DPI information.
JPG_RES_USEDEFAULTDPI |
Use the resolution specified by Kernel.IMF.DefaultDPI setting. |
JPG_RES_USEEXIF |
If JPEG header does not contain resolution info, read the resolution tag of the EXIF info if exists. |
enum PREPROC_INFO_FLAGS |
Flags for the structure PREPROC_INFO.
PREPROC_INFO_FAXCORRECTION |
Fax-correction applied. |
PREPROC_INFO_INVERSION |
II_BW image inverted. |
PREPROC_INFO_3DDESKEW |
3D deskew applied. |
PREPROC_INFO_STRAIGHTENED |
Line straightening applied by 3D deskew. |
PREPROC_INFO_HALFTONE |
Halftone image, see kRecSetImgDespeckleMode |
enum PROCESSING_MODE |
Switching between processing modes.
Generally, a load-prerprocess-zoning-recognition-conversion workflow is built up to do anything it can for the best result of any type of output. However, there are some cases when certain steps can be skipped. E.g. if the required output is an ePub document, it is not important to do any true page formatting. The setting Processing.Mode can switch on such a restricted processing mode.
enum RETAINCOLOR |
Retain color.
The recognition result can contain color information about letters, lines, frames, etc. The retain color setting indicates whether the color information from the image is used or not.
RETAINCOLOR_NO |
All the resulting items contain a white background and a black foreground color. |
RETAINCOLOR_YES |
The real color of the given item is used in the result. This is the default value. |
RETAINCOLOR_INVERTED |
The color of the given item is determined in the BW image of the page (II_BW). |
3D deskewing
The kRec3DDeskewImg function performs 3D deskew on the II_CURRENT image of the given page. The function tries to correct the skew and perspective distortion of an image taken by a digital camera. Parallel text lines are transformed to be horizontal and column edges are transformed to be vertical. The algorithm does not detect that a page is upside down therefore the transformed image may remain upside down. If there are BW (II_BW) and thumbnail (II_THUMBNAIL) images they are deskewed as well.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of page containing the image(s) to be deskewed. |
RECERR |
RECERR kRec3DDeskewImg(int sid, IntPtr hPage);
Cropping white border.
This function detects the excessive border areas, and if they are greater than the given margins, it decreases them to that size. The image is resized to the new rectangle.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page to be processed. |
[in] | lrMargin | Left and right margin (pixels). |
[in] | tbMargin | Top and bottom margin (pixels). |
[in] | flags | Set the CROP_CLEARMARGIN flag to have the margins remaining after cropping filled with the color white. |
RECERR |
RECERR kRecAutoCropImg(int sid, IntPtr hPage, int lrMargin, int tbMargin, CROP_FLAGS flags);
Clearing image area.
The kRecClearImgArea function clears a rectangular area of all the images of a page except II_ORIGINAL. The image with a rectangle cleared replaces its origin and is available to the Engine and the application. The function assumes that the coordinates are given in the coordinate system of the current image (II_CURRENT).
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page containing the image to be modified. |
[in] | lpRect | Pointer to a rectangle to be cleared by setting its bits to zero (0). A NULL value means the entire image. |
RECERR |
RECERR kRecClearImgArea(int sid, IntPtr hPage, RECT pRect); // or when pRect is NULL in C/C++ RECERR kRecClearImgArea(int sid, IntPtr hPage);
Changing color depth.
This function changes the color depth (bits per pixel) of the given image.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page to be processed. The II_CURRENT image of this page will be modified. |
[in] | BitsPerPixel | New value of the bits per pixel. Possible values are: 1, 8, 24. |
[in] | flags | The following parameters can be specified: CONVIMG_PALETTE, CONVIMG_ERRDIFF. |
RECERR |
BitsPerPixel
is not 8, CONVIMG_PALETTE flag is ignored. BitsPerPixel
is 1 or when BitsPerPixel
is 8 and CONVIMG_PALETTE is set. RECERR kRecConvertImg(int sid, IntPtr hPage, ushort bitsPerPixel, CONVIMG_FLAGS flags);
RECERR RECAPIKRN kRecConvertImg2BW | ( | int | sid, |
HPAGE | hPageIn, | ||
IMG_CONVERSION | Conversion, | ||
int | Brightness, | ||
int | Threshold, | ||
IMG_RESENH | resolenh, | ||
HPAGE * | phPageOut | ||
) |
Converting an image to a B/W image.
The kRecConvertImg2BW function creates a new image from an existing one. The function converts color or gray-scale images to Black-and-white (B/W) ones. It converts the current image (II_CURRENT) of the given input page. The resulting image will be the original image (II_ORIGINAL) of the given output page. This function performs a direct secondary image conversion step.
[in] | sid | Settings Collection ID. |
[in] | hPageIn | Handle of the source page. |
[in] | Conversion | Image conversion mode to be applied during the conversion of the image. Possible values are: CNV_AUTO, CNV_SET, CNV_GLOBAL. |
[in] | Brightness | Brightness of the image (range is 0 to 100, where 0 means the darkest and 100 means the lightest resulting image). This parameter has an effect only if the Conversion parameter is CNV_AUTO. |
[in] | Threshold | Threshold value to be set. Its range should be between 0 and 255. This parameter has an effect only if the Conversion parameter is CNV_SET. |
[in] | resolenh | The resolution enhancement mode to be used during binarization. |
[out] | phPageOut | Pointer of a variable to store the handle of the destination page. |
RECERR |
RECERR kRecConvertImg2BW(int sid, IntPtr hPageIn, IMG_CONVERSION Conversion, int Brightness, int Threshold, IMG_RESENH resolenh, out IntPtr phPageOut);
RECERR RECAPIKRN kRecCopyImgArea | ( | int | sid, |
HPAGE | hPageDst, | ||
LPCRECT | pRectDst, | ||
HPAGE | hPageSrc, | ||
LPCRECT | pRectSrc | ||
) |
Copying an image area.
This function copies a rectangular area of the II_CURRENT image of the given source page into a rectangular area of the II_CURRENT image of the given destination page. The function compresses or stretches the area if necessary to fit the dimensions of the destination size.
[in] | sid | Settings Collection ID. |
[in] | hPageDst | Handle of the page which contains the destination image. |
[in] | pRectDst | Coordinates of the destination rectangular area. NULL means the whole image. |
[in] | hPageSrc | Handle of the page which contains the source image. |
[in] | pRectSrc | Coordinates of the source rectangular area. NULL means the whole image. |
RECERR |
RECERR kRecCopyImgArea(int sid, IntPtr hPageDst, RECT rectDst, IntPtr hPageSrc, RECT rectSrc); // or when pRectDst is NULL in C/C++ RECERR kRecCopyImgArea(int sid, IntPtr hPageDst, IntPtr hPageSrc, RECT rectSrc); // or when pRectSrc is NULL in C/C++ RECERR kRecCopyImgArea(int sid, IntPtr hPageDst, RECT rectDst, IntPtr hPageSrc); // or when pRectDst and pRectSrc are NULL in C/C++ RECERR kRecCopyImgArea(int sid, IntPtr hPageDst, IntPtr hPageSrc);
RECERR RECAPIKRN kRecCreateBookPages | ( | int | sid, |
HPAGE | hPage, | ||
HPAGE * | phPage1, | ||
HPAGE * | phPage2, | ||
const CUT_INFO * | pInfo | ||
) |
Cutting each opened book image into two pages.
This function cuts the two-page opened book images into two pages using the cutting information resulting from kRecDetectBook. It uses the page size stored by the first kRecDetectBook
after a kRecInit or a kRecResetBookSize. The resulting HPAGEs
should be preprocessed even if the pre-process operation was called before kRecDetectBook
, because the skew of one page may differ from that of the other.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the two-part opened book page image. |
[out] | phPage1 | Pointer of a variable to store the handle of the left page cut from the book page. |
[out] | phPage2 | Pointer of a variable to store the handle of the right page cut from the book page. |
[in] | pInfo | The cutting information resulting from kRecDetectBook. |
RECERR |
HPAGE
. RECERR kRecCreateBookPages(int sid, IntPtr hPage, out IntPtr phPage1, out IntPtr phPage2, [In] CUT_INFO pInfo);
RECERR RECAPIKRN kRecCreateImg | ( | int | sid, |
int | sizeX, | ||
int | sizeY, | ||
int | dpiX, | ||
int | dpiY, | ||
WORD | BitsPerPixel, | ||
HPAGE * | phPage | ||
) |
Creating an empty image.
The kRecCreateImg function creates a new, empty image by filling out a describing structure for the image management module and by allocating the proper amount of memory for the raw image data. This image will be attached to the page as both current and original image (II_CURRENT, II_ORIGINAL).
[in] | sid | Settings Collection ID. |
[in] | sizeX | Horizontal size of the image to be created, in pixels. |
[in] | sizeY | Vertical size of the image to be created, in pixels. |
[in] | dpiX | Horizontal resolution of the image (Dots Per Inch). |
[in] | dpiY | Vertical resolution of the image. |
[in] | BitsPerPixel | Bits per pixel (bit depth). Possible values are: 1, 4, 8, 24 (B/W, 4-bit gray-scale, 8-bit gray-scale and 24-bit color images, respectively). |
[out] | phPage | Pointer of the handle of the new page returned by the image management module. |
RECERR |
RECERR kRecCreateImg(int sid, int sizeX, int sizeY, int dpiX, int dpiY, ushort BitsPerPixel, out IntPtr phPage);
Deskewing.
The kRecDeskewImg function performs immediate deskewing on the original image. The resulting image will be the current one (II_CURRENT). If there are BW (II_BW) and thumbnail (II_THUMBNAIL) images they are deskewed as well.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of a page containing the image(s) to be deskewed. |
[in] | ImgSlope | Integer slope value for deskewing. The value given here is the number of pixels of vertical ascent on 1000 horizontal pixels. That is, the tangent of the deskew angle multiplied by 1000. |
RECERR |
RECERR kRecDeskewImg(int sid, IntPtr hPage, int ImgSlope);
Despeckling.
The kRecDespeckleImg function performs an immediate adaptive noise removal on the current (II_CURRENT) image, irrespective of its resolution. If the current image is not black-and-white the function returns IMG_BITSPERPIXEL_ERR
.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page. |
RECERR |
RECERR kRecDespeckleImg(int sid, IntPtr hPage);
Detecting blank pages.
Detects if a given page is a blank page.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page. |
[out] | pIsBlank | Pointer to a variable to store the result. It is TRUE , if the image is blank. |
RECERR |
TRUE
if the image contains edge noise as a result of scanning. It returns FALSE
if it finds some text or graphics on the page. RECERR kRecDetectBlankPage(int sid, IntPtr hPage, out bool IsBlank);
Detecting facing book pages.
This function detects the place where the page image can be cut into two pages. It is useful when scanning two facing pages of a book simultaneously. First time after kRecInit or kRecResetBookSize, it stores the size of the resulting pages in settings. This size can always include both pages.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page. |
[out] | pInfo | Pointer of a variable to store the detected cutting information. |
RECERR |
HPAGE
. HPAGE
has to contain horizontal text lines, or it has to be rotated to such position (kRecPreprocessImg, kRecRotateImg). RECERR kRecDetectBook(int sid, IntPtr hPage, out CUT_INFO info);
RECERR RECAPIKRN kRecDetectDropoutColorWeights | ( | int | sid, |
HPAGE | hPage, | ||
IMAGEINDEX | iiImg, | ||
RECT * | pRect, | ||
int * | pwred, | ||
int * | pwgreen, | ||
int * | pwblue | ||
) |
Detecting dropout color weights.
The kRecDetectDropoutColorWeights function calculates the best weights that can be used for drop-out color binarization. This detection operates on the current image (II_CURRENT) of the given HPAGE. Typical filled form documents contain three main colors: background color, preprinted drop-out color, and fill color. The goal of the drop-out color binarization is to create a binary image that does not contain the preprinted texts, lines, etc. You should define a rectangle, as large as possible, that contains the drop-out color and the background color, but should not contain the fill color. The returned weights can be passed to kRecSetDropoutColorWeights function.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page containing the image, on which the detection runs. |
[in] | iiImg | The index of the image, in which the coordinates of the input rectangle are to be given. Possible values are II_CURRENT and II_BW. |
[in,out] | pRect | The rectangular area of the image in which the detection runs. If this rectangle is given in the BW image, the output rectangle is converted to the current image. This pointer must not be NULL. |
[out] | pwred | Pointer of a variable to store the suggested weight of the red component. |
[out] | pwgreen | Pointer of a variable to store the suggested weight of the green component. |
[out] | pwblue | Pointer of a variable to store the suggested weight of the blue component. |
RECERR |
RECERR kRecDetectDropoutColorWeights(int sid, IntPtr hPage, IMAGEINDEX iiImg, [In, Out] ref RECT pRect, out int pwred, out int pwgreen, out int pwblue);
RECERR RECAPIKRN kRecDetectFillingMethod | ( | int | sid, |
HPAGE | hPage, | ||
FILLINGMETHOD * | pocrType | ||
) |
Detection of filling method.
This function tries to determine the type of content in the OCR zones of a page. If there is no OCR zone, the function works on user zones. It can identify handprinted, machine printed or dot-matrix printed text (9 and 24 pin) and barcodes. The function only looks into zones with the FM_DEFAULT value in their ZONE::fm field. If an output parameter address is passed the CSDK fills it with one general filling method based on the examined zones of the page. The integrating application can pass this value to the end-user for evaluation or can use it directly. Another use of this function is when it is called with NULL in its output parameter. In this case, the function performs a zone-by-zone analysis (on zones with FM_DEFAULT) and replaces the filling method of each zone with the determined one.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page. |
[out] | pocrType | Address of a variable to get the detected method or NULL. |
RECERR |
RECERR kRecDetectFillingMethod(int sid, IntPtr hPage, out FILLINGMETHOD pocrType); // or when pocrType is NULL in C/C++ RECERR kRecDetectFillingMethod(int sid, IntPtr hPage);
RECERR RECAPIKRN kRecDetectImgSkew | ( | int | sid, |
HPAGE | hPage, | ||
int * | pSlope, | ||
IMG_ROTATE * | pImgRotate | ||
) |
Detecting orientation and skew.
The kRecDetectImgSkew function detects the orientation and the skew of the image.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page which contains the image. |
[out] | pSlope | Pointer to a variable to get the slope value. |
[out] | pImgRotate | Pointer to a variable to get the orientation of the image. |
RECERR |
pSlope
) is the number of pixels of vertical ascent on 1000 horizontal pixels. That is, the tangent of the deskew angle multiplied by 1000. RECERR kRecDetectImgSkew(int sid, IntPtr hPage, out int pSlope, out IMG_ROTATE pImgRotate);
RECERR RECAPIKRN kRecDropImg | ( | HPAGE | hPage, |
IMAGEINDEX | iiImg | ||
) |
Removing an image from the page.
The kRecDropImg function removes an image from the given page.
[in] | hPage | Handle of the page. |
[in] | iiImg | Index of the image to be removed. |
RECERR |
RECERR kRecDropImg(IntPtr hPage, IMAGEINDEX iiImg);
Enhancing images taken from whiteboards.
Improving the readability of text and diagrams on whiteboards, when captured by digital camera.
[in] | hPage | Handle of the page. |
RECERR |
RECERR kRecEnhanceWhiteboardImg(IntPtr hPage);
RECERR RECAPIKRN kRecFillImgArea | ( | int | sid, |
HPAGE | hPage, | ||
LPCRECT | lpRect, | ||
REC_COLOR | color, | ||
FILLAREA_FLAGS | flags | ||
) |
Filling image areas with a specified color.
The kRecFillImgArea function fills the image within (or outside) the given rectangle with the specified color.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page containing the image to be modified. |
[in] | lpRect | Pointer to a rectangle to be filled in. A NULL value means the entire image. |
[in] | color | The area is filled in with this color. The color contains red, green, blue and alpha components. The red, green and blue components are intensity values from 0 to 255. The alpha component defines the opacity: 0 means that the color is totally transparent. The image is not changed if the alpha component is 0. |
[in] | flags | The flags determining how the given rectangle is used. |
RECERR |
RECERR kRecFillImgArea(int sid, IntPtr hPage, RECT lpRect, uint color, FILLAREA_FLAGS flags); // or when lpRect is NULL in C/C++ RECERR kRecFillImgArea(int sid, IntPtr hPage, uint color, FILLAREA_FLAGS flags);
RECERR RECAPIKRN kRecForceDespeckleImg | ( | int | sid, |
HPAGE | hPage, | ||
LPCRECT | pRect, | ||
DESPECKLE_METHOD | method, | ||
int | level | ||
) |
Forcing despeckle.
This function performs noise removal on the given area within the current (II_CURRENT) image of a page. The method and the level of the noise removal can be specified.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page. |
[in] | pRect | Pointer to the rectangle to be processed. A NULL value means the entire image. |
[in] | method | Applied despeckle method. |
[in] | level | Despeckle level. The possible values depend on the despeckle method. |
RECERR |
IMG_BITSPERPIXEL_ERR
. RECERR kRecForceDespeckleImg(int sid, IntPtr hPage, RECT pRect, DESPECKLE_METHOD method, int level); // or when pRect is NULL in C/C++ RECERR kRecForceDespeckleImg(int sid, IntPtr hPage, DESPECKLE_METHOD method, int level);
Removing a page.
The kRecFreeImg function removes a page from the image management module. All internal images relating to the page and any recognition results are removed.
[in] | hPage | Handle of the page to be removed. |
RECERR |
RECERR kRecFreeImg(IntPtr hPage);
RECERR RECAPIKRN kRecGetDropoutColorWeights | ( | int | sid, |
int * | pwred, | ||
int * | pwgreen, | ||
int * | pwblue | ||
) |
Getting the dropout color weight settings.
The kRecGetDropoutColorWeights function inquires the current value of the drop-out color weights. See kRecSetDropoutColorWeights.
[in] | sid | Settings Collection ID. |
[in] | pwred | Pointer of a variable to store the weight of the red component. |
[in] | pwgreen | Pointer of a variable to store the weight of the green component. |
[in] | pwblue | Pointer of a variable to store the weight of the blue component. |
RECERR |
RECERR kRecGetDropoutColorWeights(int sid, out int wred, out int wgreen, out int wblue);
RECERR RECAPIKRN kRecGetFaxCorrection | ( | int | sid, |
INTBOOL * | pCorr | ||
) |
Getting the value of fax correction setting.
This function retrieves the setting Kernel.Img.FaxCorrectionEnabled.
[in] | sid | Settings Collection ID. |
[in] | pCorr | Pointer of a variable to get the value of the setting. |
RECERR |
RECERR kRecGetFaxCorrection(int sid, out bool pCorr);
Getting the number of frames.
This function gets the number of frames detected previously by kRecRecognize functions.
[in] | hPage | Handle of the page. |
[out] | pnFrames | Address of an integer variable to get the number of frames. |
RECERR |
RECERR kRecGetFrameCount(IntPtr hPage, out int pnFrames);
RECERR RECAPIKRN kRecGetFrameInfo | ( | HPAGE | hPage, |
IMAGEINDEX | iiImg, | ||
LPCELL_INFO | pFrame, | ||
int | nFrame | ||
) |
Getting frame information.
This function can be used for getting information about any frame detected previously by kRecRecognize functions.
[in] | hPage | Handle of the page. |
[in] | iiImg | Index of the image in the page, whose coordinate system is used to report the frames. |
[out] | pFrame | Pointer to a variable for storing the requested frame information. |
[in] | nFrame | Index of the frame in the frame list, from which the information is requested. |
RECERR |
Kernel.OcrMgr.RetainColor
is RETAINCOLOR_YES (see kRecSetRetainColor) it tries to detect the colored frames in the color image as well. Otherwise, the detection runs on the II_BW image. The structure CELL_INFO is used for describing frames. RECERR kRecGetFrameInfo(IntPtr hPage, IMAGEINDEX iiImg, out CELL_INFO pFrame, int nFrame);
RECERR RECAPIKRN kRecGetImgArea | ( | int | sid, |
HPAGE | hPageIn, | ||
IMAGEINDEX | iiImg, | ||
LPCRECT | pSrcRect, | ||
LPCSIZE | pDstSize, | ||
LPIMG_INFO | pImg, | ||
BYTE ** | ppBitmap | ||
) |
Getting image area.
The kRecGetImgArea function copies and exports a rectangular area of the given image of the page stored in the Engine's image management module into a buffer available to the application. It results in a bitmap in the application's memory space. The function compresses or stretches the area if necessary to fit the dimensions of the destination size.
[in] | sid | Settings Collection ID. |
[in] | hPageIn | Handle of the page which contains the source image. |
[in] | iiImg | Index of the source image in the page. |
[in] | pSrcRect | Coordinates of the source rectangular area. NULL means: the whole image will be copied. |
[in] | pDstSize | Pointer to the dimensions of the destination area. A value of NULL here means that the destination size will be equal to the original one. |
[out] | pImg | Address of a structure to get information about the output image area. |
[out] | ppBitmap | Address of a pointer to the resulting bitmap. |
RECERR |
RECERR rc; HPAGE hPage; IMG_INFO img; RECT rect; BYTE *pBitmap; HBITMAP hBitmap; . . . rect.left = 0; rect.top = 0; rect.right = 200; rect.bottom = 180; rc = kRecGetImgArea(sid, hPage, II_ORIGINAL, &rect, NULL, &img, &pBitmap); hBitmap = CreateBitmap(img.Size.cx, img.Size.cy, 1, img.BitsPerPixel, pBitmap); rc = kRecFree(pBitmap); . . .
RECERR kRecGetImgArea(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, RECT pSrcRect, SIZE pDstSize, out IMG_INFO pImg, out byte[] pBitmap); // or when pSrcRect is NULL in C/C++ RECERR kRecGetImgArea(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, SIZE pDstSize, out IMG_INFO pImg, out byte[] pBitmap); // or when pDstSize is NULL in C/C++ RECERR kRecGetImgArea(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, RECT pSrcRect, out IMG_INFO pImg, out byte[] pBitmap); // or when both are NULL RECERR kRecGetImgArea(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, out IMG_INFO pImg, out byte[] pBitmap); // or RECERR kRecGetImgArea(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, RECT pSrcRect, SIZE pDstSize, out IMG_INFO pImg, out Bitmap bmp); // or when pSrcRect is NULL in C/C++ RECERR kRecGetImgArea(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, SIZE pDstSize, out IMG_INFO pImg, out Bitmap bmp); // or when pDstSize is NULL in C/C++ RECERR kRecGetImgArea(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, RECT pSrcRect, out IMG_INFO pImg, out Bitmap bmp); // or when both are NULL RECERR kRecGetImgArea(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, out IMG_INFO pImg, out Bitmap bmp);
RECERR RECAPIKRN kRecGetImgAreaEx | ( | int | sid, |
HPAGE | hPageIn, | ||
IMAGEINDEX | iiImg, | ||
LPCRECT | pSrcRect, | ||
LPCSIZE | pDstSize, | ||
IMG_STRETCHMODE | StretchMode, | ||
IMG_LINEORDER | LineOrder, | ||
IMG_RGBORDER | RGBOrder, | ||
INTBOOL | strict, | ||
IMG_PADDING | Padding, | ||
LPIMG_INFO | pImg, | ||
BYTE ** | ppBitmap | ||
) |
Getting image area.
The kRecGetImgAreaEx function copies and exports a rectangular area of the given image of the page stored in the Engine's image management module into a buffer available to the application. It results in a bitmap in the application's memory space. The function compresses or stretches the area if necessary to fit the dimensions of the destination size.
[in] | sid | Settings Collection ID. |
[in] | hPageIn | Handle of the page which contains the source image. |
[in] | iiImg | Index of the source image in the page. |
[in] | pSrcRect | Coordinates of the source rectangular area. NULL means: the whole image will be copied. |
[in] | pDstSize | Pointer to the dimensions of the destination area. A value of NULL here means that the destination size will be equal to the original one. |
[in] | StretchMode | Stretching mode. |
[in] | LineOrder | Order of the lines in the received buffer. |
[in] | RGBOrder | Order of the composite color components (COLOR_RGB, COLOR_BGR or COLOR_BGRA). |
[in] | strict | If TRUE: the received buffer will contain 24-bit RGB, 24-bit BGR, 32-bit BGRA or 32-bit ARGB bitmap depending on RGBOrder. If FALSE: the received buffer may contain 1-bit or 8-bit bitmap too if the input is 1-bit or 8-bit image (just like kRecGetImgArea) |
[in] | Padding | This parameter determines how the lines are to be padded in the received buffer. |
[out] | pImg | Address of a structure to get information about the output image area. |
[out] | ppBitmap | Address of a pointer to the resulting bitmap. |
RECERR |
RECERR kRecGetImgAreaEx(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, RECT pSrcRect, SIZE pDstSize, IMG_STRETCHMODE StretchMode, IMG_LINEORDER LineOrder, IMG_RGBORDER RGBOrder, [MarshalAs(UnmanagedType.Bool)] bool strict, IMG_PADDING Padding, out IMG_INFO Img, out IntPtr pBitmap); RECERR kRecGetImgAreaEx(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, RECT pSrcRect, SIZE pDstSize, IMG_STRETCHMODE StretchMode, IMG_LINEORDER LineOrder, IMG_RGBORDER RGBOrder, [MarshalAs(UnmanagedType.Bool)] bool strict, IMG_PADDING Padding, out IMG_INFO Img, out byte[] pBitmap); RECERR kRecGetImgAreaEx(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, SIZE pDstSize, IMG_STRETCHMODE StretchMode, IMG_LINEORDER LineOrder, IMG_RGBORDER RGBOrder, [MarshalAs(UnmanagedType.Bool)] bool strict, IMG_PADDING Padding, out IMG_INFO Img, out byte[] pBitmap); RECERR kRecGetImgAreaEx(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, RECT pSrcRect, IMG_STRETCHMODE StretchMode, IMG_LINEORDER LineOrder, IMG_RGBORDER RGBOrder, [MarshalAs(UnmanagedType.Bool)] bool strict, IMG_PADDING Padding, out IMG_INFO Img, out byte[] pBitmap); RECERR kRecGetImgAreaEx(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, IMG_STRETCHMODE StretchMode, IMG_LINEORDER LineOrder, IMG_RGBORDER RGBOrder, [MarshalAs(UnmanagedType.Bool)] bool strict, IMG_PADDING Padding, out IMG_INFO Img, out byte[] pBitmap); RECERR kRecGetImgAreaEx(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, RECT pSrcRect, SIZE pDstSize, IMG_STRETCHMODE StretchMode, IMG_LINEORDER LineOrder, IMG_RGBORDER RGBOrder, [MarshalAs(UnmanagedType.Bool)] bool strict, IMG_PADDING Padding, out IMG_INFO Img, out Bitmap bmp); RECERR kRecGetImgAreaEx(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, SIZE pDstSize, IMG_STRETCHMODE StretchMode, IMG_LINEORDER LineOrder, IMG_RGBORDER RGBOrder, [MarshalAs(UnmanagedType.Bool)] bool strict, IMG_PADDING Padding, out IMG_INFO Img, out Bitmap bmp); RECERR kRecGetImgAreaEx(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, RECT pSrcRect, IMG_STRETCHMODE StretchMode, IMG_LINEORDER LineOrder, IMG_RGBORDER RGBOrder, [MarshalAs(UnmanagedType.Bool)] bool strict, IMG_PADDING Padding, out IMG_INFO Img, out Bitmap bmp); RECERR kRecGetImgAreaEx(int sid, IntPtr hPageIn, IMAGEINDEX iiImg, IMG_STRETCHMODE StretchMode, IMG_LINEORDER LineOrder, IMG_RGBORDER RGBOrder, [MarshalAs(UnmanagedType.Bool)] bool strict, IMG_PADDING Padding, out IMG_INFO Img, out Bitmap bmp);
RECERR RECAPIKRN kRecGetImgBinarizationMode | ( | int | sid, |
LPIMG_CONVERSION | pBWConversion | ||
) |
Getting secondary image conversion mode.
The kRecGetImgBinarizationMode function inquires the current secondary image conversion mode setting.
[in] | sid | Settings Collection ID. |
[out] | pBWConversion | Address of a variable to receive the current secondary image conversion mode setting. |
RECERR |
RECERR kRecGetImgBinarizationMode(int sid, out IMG_CONVERSION pBWConversion);
RECERR RECAPIKRN kRecGetImgBrightness | ( | int | sid, |
int * | lpBrightness | ||
) |
Getting brightness.
The kRecGetImgBrightness function inquires the current value of the threshold fine-tuning setting.
[in] | sid | Settings Collection ID. |
[out] | lpBrightness | Address of the variable to get the current brightness setting. |
RECERR |
RECERR kRecGetImgBrightness(int sid, out int pBrightness);
RECERR RECAPIKRN kRecGetImgConvMode | ( | int | sid, |
IMG_CONVERSION * | pConversion | ||
) |
Getting primary image conversion mode.
The kRecGetImgConvMode function inquires the current primary image conversion mode setting.
[in] | sid | Settings Collection ID. |
[out] | pConversion | Address of a variable to receive the current setting of the primary image conversion mode. |
RECERR |
RECERR kRecGetImgConvMode(int sid, out IMG_CONVERSION pConversion);
RECERR RECAPIKRN kRecGetImgDeskew | ( | int | sid, |
IMG_DESKEW * | pImgDeskew | ||
) |
Getting deskew mode.
The kRecGetImgDeskew function inquires the current Image deskewing mode setting.
[in] | sid | Settings Collection ID. |
[out] | pImgDeskew | Pointer to a variable to get the current deskewing mode. |
RECERR |
RECERR kRecGetImgDeskew(int sid, out IMG_DESKEW pImgDeskew);
RECERR RECAPIKRN kRecGetImgDespeckleMode | ( | int | sid, |
LPINTBOOL | lpbMode | ||
) |
Getting despeckle mode.
The kRecGetImgDespeckleMode function inquires the current Image despeckle mode setting of the Engine.
[in] | sid | Settings Collection ID. |
[out] | lpbMode | Pointer to a variable to get the current setting. |
RECERR |
RECERR kRecGetImgDespeckleMode(int sid, out bool pbMode);
RECERR RECAPIKRN kRecGetImgDownsample | ( | int | sid, |
INTBOOL * | pdownsample | ||
) |
Getting the value of view downsample setting.
This function retrieves the setting Kernel.Img.ViewDownsample. For more information about this setting see Settings of the Image Handling Module. See kRecSetImgDownsample.
[in] | sid | Settings Collection ID. |
[in] | pdownsample | Pointer of a variable to get the value of the setting. |
RECERR |
RECERR kRecGetImgDownsample(int sid, out bool pdownsample);
Getting the value of image flags.
The kRecGetImgFlags function retrieves the current value of the specified flag of the given HPAGE.
[in] | hPage | Handle of the page. |
[in] | Flag | The flag to get. See: IMG_FLAGS. |
[in] | pbValue | Address of the pointer to get the flag. /note These flags are automatically set during image loading process. The IMG_FLAGS_CAMERAIMAGE flag is set to 1 when the source is JPG file, and the exif info contains tags that suggest that the image is from digital camera or phone. You can change this flag by kRecSetImgFlags. |
RECERR RECAPIKRN kRecGetImgFormat | ( | int | sid, |
IMG_LINEORDER * | plineord, | ||
IMG_PADDING * | ppadding, | ||
IMG_RGBORDER * | pord | ||
) |
Getting image format.
The kRecGetImgFormat function inquires the current setting of the line order, the padding mode and the order of the composite color components of the image.
[in] | sid | Settings Collection ID. |
[out] | plineord | Address to a variable to hold the current line order setting. |
[out] | ppadding | Address to a variable to hold the current padding mode setting. |
[out] | pord | Address to a variable to hold the current RGB order setting. |
RECERR |
RECERR kRecGetImgFormat(int sid, out IMG_LINEORDER plineord, out IMG_PADDING ppadding, out IMG_RGBORDER pord);
RECERR RECAPIKRN kRecGetImgInfo | ( | int | sid, |
HPAGE | hPage, | ||
IMAGEINDEX | iiImg, | ||
LPIMG_INFO | pImg | ||
) |
Getting image information.
The kRecGetImgInfo function retrieves information about any image of the page. This includes e.g. dimensions, resolution, image type (number of bits per pixel), etc. of the specified image.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page containing the requested image. |
[in] | iiImg | Index to the requested image in the page. |
[in] | pImg | Address of a IMG_INFO structure to get the image information. |
RECERR |
RECERR kRecGetImgInfo(int sid, IntPtr hPage, IMAGEINDEX iiImg, out IMG_INFO pImg);
RECERR RECAPIKRN kRecGetImgInvert | ( | int | sid, |
IMG_INVERT * | lpImgInvert | ||
) |
Getting inversion mode.
The kRecGetImgInvert function inquires the current Image inversion mode setting.
[in] | sid | Settings Collection ID. |
[out] | lpImgInvert | Pointer to a variable to get the current inversion mode. |
RECERR |
RECERR kRecGetImgInvert(int sid, out IMG_INVERT pImgInvert);
Getting additional information about the page.
The kRecGetImgMetaData function retrieves additional information attached to the page in the image file. This includes exif info for JPG files, the tags of TIF files and several properties of PDF files.
[in] | hPage | Handle of the page. |
[out] | phMetaData | The returned handle is the root of the metadata. |
RECERR |
RECERR kRecGetImgMetaData(IntPtr hPage, out IntPtr phMetaData);
RECERR RECAPIKRN kRecGetImgPalette | ( | int | sid, |
HPAGE | hPage, | ||
IMAGEINDEX | iiImg, | ||
LPBYTE | pPal | ||
) |
Getting the palette of the image.
This function retrieves the palette of the selected image of the given page.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page containing the inquired image. |
[in] | iiImg | Index of the inquired image. |
[out] | pPal | Pointer of a buffer to store the palette. It must be large enough to hold 768 bytes. See notes. |
RECERR |
API_PARAMETER_ERR
. RECERR kRecGetImgPalette(int sid, IntPtr hPage, IMAGEINDEX iiImg, out byte[] pPal);
RECERR RECAPIKRN kRecGetImgResolEnhancement | ( | int | sid, |
IMG_RESENH * | res | ||
) |
Getting resolution enhancement mode.
The kRecGetImgResolEnhancement function inquires the current Image resolution enhancement mode setting of the Engine.
[in] | sid | Settings Collection ID. |
[out] | res | Pointer to a variable to get the current setting. |
RECERR. |
RECERR kRecGetImgResolEnhancement(int sid, out IMG_RESENH res);
RECERR RECAPIKRN kRecGetImgRotation | ( | int | sid, |
IMG_ROTATE * | lpImgRotate | ||
) |
Getting rotation mode.
The kRecGetImgRotation function inquires the current Image rotation mode setting.
[in] | sid | Settings Collection ID. |
[out] | lpImgRotate | Pointer to a variable to get the current Image rotation mode setting. |
RECERR |
RECERR kRecGetImgRotation(int sid, out IMG_ROTATE pImgRotate);
RECERR RECAPIKRN kRecGetImgSlope | ( | int | sid, |
int * | lpSlope | ||
) |
Getting the slope.
The kRecGetImgSlope function returns the current slope value setting set by a previous kRecSetImgSlope function call.
[in] | sid | Settings Collection ID. |
[out] | lpSlope | Pointer to a variable to get current slope value. |
RECERR |
RECERR kRecGetImgSlope(int sid, out int pSlope);
RECERR RECAPIKRN kRecGetImgStretchMode | ( | int | sid, |
IMG_STRETCHMODE * | pImgStretchMode | ||
) |
Getting stretching mode.
The kRecGetImgStretchMode function gets the current Image stretching mode setting.
[in] | sid | Settings Collection ID. |
[out] | pImgStretchMode | Pointer to a variable to get the current Image stretching mode setting. |
RECERR |
RECERR kRecGetImgStretchMode(int sid, out IMG_STRETCHMODE pImgStretchMode);
RECERR RECAPIKRN kRecGetImgThreshold | ( | int | sid, |
int * | pThreshold | ||
) |
Getting binarization threshold.
The kRecGetImgThreshold function inquires the current value of the image conversion threshold setting.
[in] | sid | Settings Collection ID. |
[out] | pThreshold | Address of the variable that holds the current threshold value. |
RECERR |
RECERR kRecGetImgThreshold(int sid, out int pThreshold);
Getting the number of rule lines.
This function gets the number of rule lines detected previously by kRecLineRemoval, kRecLocateZones or kRecRecognize functions.
[in] | hPage | Handle of the page. |
[out] | pnLines | Address of an integer variable to get the number of rule lines. |
RECERR |
RECERR kRecGetLineCount(IntPtr hPage, out int pnLines);
RECERR RECAPIKRN kRecGetLineInfo | ( | HPAGE | hPage, |
IMAGEINDEX | iiImg, | ||
PRLINE | pLine, | ||
int | nLine | ||
) |
Getting rule line information.
This function can be used for getting information about any rule line detected previously by kRecLineRemoval, kRecLocateZones or kRecRecognize functions.
[in] | hPage | Handle of the page. |
[in] | iiImg | Index of the image in the page, whose coordinate system is to be used to report the lines. |
[out] | pLine | Pointer to a variable for storing the requested line information. |
[in] | nLine | Index of the line in the line list, from which the information is requested. |
RECERR |
RECERR kRecGetLineInfo(IntPtr hPage, IMAGEINDEX iiImg, out RLINE pLine, int nLine);
RECERR RECAPIKRN kRecGetPreprocessInfo | ( | HPAGE | hPage, |
PREPROC_INFO * | pPreprocInfo | ||
) |
Returning information about the preprocessing.
After preprocessing the image, you can ask information about the applied operations.
[in] | hPage | Handle of the page. |
[out] | pPreprocInfo | Pointer to a variable to get the information. |
RECERR |
RECERR kRecGetPreprocessInfo(IntPtr hPage, out PREPROC_INFO pPreprocInfo);
RECERR RECAPIKRN kRecGetPreserveOriginalImg | ( | int | sid, |
INTBOOL * | pPreserve | ||
) |
Getting the value of the keep original image setting.
This function retrieves the setting Kernel.Img.KeepOriginalImage. For more information about this setting see Settings of the Image Handling Module. See kRecSetPreserveOriginalImg.
[in] | sid | Settings Collection ID. |
[in] | pPreserve | Pointer of a variable to get the value of the setting. |
RECERR |
RECERR kRecGetPreserveOriginalImg(int sid, out bool pPreserve);
RECERR RECAPIKRN kRecGetRetainColor | ( | int | sid, |
RETAINCOLOR * | pRetainColor | ||
) |
Getting retain color setting.
This function gets the retain color setting.
[in] | sid | Settings Collection ID. |
[out] | pRetainColor | Pointer of a variable to store the retain color value. |
RECERR |
RECERR kRecGetRetainColor(int sid, out RETAINCOLOR pRetainColor);
Getting the value of thumbnail image info settings.
This function retrieves the value of settings under the node Kernel.Img.Thumbnail. For more information about this setting see Settings of the Image Handling Module. See kRecSetThumbnailImgInfo.
[in] | sid | Settings Collection ID. |
[out] | pThumbnail | This is the size and the bits per pixel information of the thumbnail image. Only these fields will be filled. |
[out] | pColor | This is the thumbnail color. See II_THUMBNAIL. |
RECERR |
RECERR kRecGetThumbnailImgInfo(int sid, out IMG_INFO pThumbnail, out uint color);
RECERR RECAPIKRN kRecImgAutoEnhance | ( | HPAGE | hPage, |
BYTE | blackPointred, | ||
BYTE | whitePointred, | ||
BYTE | blackPointgreen, | ||
BYTE | whitePointgreen, | ||
BYTE | blackPointblue, | ||
BYTE | whitePointblue | ||
) |
Image auto-enhancement.
This function performs a gray-level enhancement transformation on the current image (II_CURRENT) of the given page. It works for both color and gray-scale images. It sets all the input gray-levels under the lower (black point) threshold to black and all of them over the higher (white point) threshold to white output level. The remaining interval of the input levels is expanded into the interval of the remaining output levels (between 1 and 254). If the input image is colored, the output image is also colored.
[in] | hPage | Handle of the page. |
[in] | blackPointred | The lower (black point) threshold of the red component. |
[in] | whitePointred | The higher (white point) threshold of the red component. |
[in] | blackPointgreen | The lower (black point) threshold of the green component. |
[in] | whitePointgreen | The higher (white point) threshold of the green component. |
[in] | blackPointblue | The lower (black point) threshold of the blue component. |
[in] | whitePointblue | The higher (white point) threshold of the blue component. |
RECERR |
blackPointred
and whitePointred
are used on gray-scale images. RECERR kRecImgAutoEnhance(IntPtr hPage, byte blackPointRed, byte whitePointRed, byte blackPointGreen, byte whitePointGreen, byte blackPointBlue, byte whitePointBlue);
RECERR RECAPIKRN kRecImgDilatation | ( | int | sid, |
HPAGE | hPage, | ||
ERO_DIL_TYPE | type | ||
) |
Dilatation.
This function performs dilatation on binary images. Dilatation changes a white pixel to black if at least one of its neighbors is black. Black pixels remain unchanged. This tends to thicken character shapes, thus it can be used for visual enhancement of some images. However, this operation is typically not useful for images to be OCR-ed. The opposite process is erosion.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page to be processed. |
[in] | type | This parameter determines which neighbours are tested during the operation. |
RECERR |
IMG_BITSPERPIXEL_ERR
. RECERR kRecImgDilatation(int sid, IntPtr hPage, ERO_DIL_TYPE typeint);
RECERR RECAPIKRN kRecImgErosion | ( | int | sid, |
HPAGE | hPage, | ||
ERO_DIL_TYPE | type | ||
) |
Erosion.
This function performs erosion on binary images. Erosion changes a black pixel to white if at least one of its neighbors is white. White pixels remain unchanged. This tends to make character shapes thinner, thus it can be used for visual enhancement of some images. This operation is typically not useful for images to be OCR-ed. The opposite process is dilatation.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page to be processed. |
[in] | type | This parameter determines which neighbours are tested during the operation. |
RECERR |
IMG_BITSPERPIXEL_ERR
. RECERR kRecImgErosion(int sid, IntPtr hPage, ERO_DIL_TYPE typeint);
Inverting image area.
The kRecInvertImgArea function performs immediate image inversion of all the images of the page except II_ORIGINAL or a rectangular area inside them. This function ignores the image inversion mode setting. The inverted image (or the image with a rectangle inverted) replaces its origin and is available to the Engine and the application. The function assumes that the coordinates are given in the coordinate system of the current image (II_CURRENT).
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page containing the image to be modified. |
[in] | lpRect | Pointer to the rectangular area to be inverted. If it is NULL the entire image is inverted. |
RECERR |
RECERR kRecInvertImgArea(int sid, IntPtr hPage, RECT pRect); // or when pRect is NULL in C/C++ RECERR kRecInvertImgArea(int sid, IntPtr hPage);
RECERR RECAPIKRN kRecIsImgPalette | ( | int | sid, |
HPAGE | hPage, | ||
IMAGEINDEX | iiImg, | ||
LPINTBOOL | pbPal | ||
) |
Inquiring about palette of the image.
This function retrieves whether the selected image of the given page has a palette or not.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page containing the inquired image. |
[in] | iiImg | Index of the inquired image. |
[out] | pbPal | Pointer of a variable to store the retrieved value. TRUE when the image has a palette. |
RECERR |
RECERR kRecIsImgPalette(int sid, IntPtr hPage, IMAGEINDEX iiImg, out bool pbPal);
Removing lines.
The kRecLineRemoval function removes horizontal and vertical rule lines from the II_BW image of the page inside the given rectangle. The detected rule lines are stored in the line list of HPAGE, and can be obtained by kRecGetLineCount and kRecGetLineInfo functions.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page. |
[in] | pRect | The rectangular area inside which lines are removed from the image. The function assumes that the coordinates are given in the coordinate system of the II_BW image. NULL means the whole image. |
RECERR |
RECERR kRecLineRemoval(int sid, IntPtr hPage, RECT pRect); // or RECERR kRecLineRemoval(int sid, IntPtr hPage);
RECERR RECAPIKRN kRecMergeImgArea | ( | int | sid, |
HPAGE | hPageDst, | ||
LPCRECT | pRectDst, | ||
HPAGE | hPageSrc, | ||
LPCRECT | pRectSrc, | ||
REC_COLOR | tColor | ||
) |
Merging areas of images.
This function merges a rectangular area of the II_CURRENT image of the given source page and a rectangular area of the II_CURRENT image of the given destination page. One color can be designated as being transparent (see also notes). Where the color of the source pixel corresponds to the transparent color the destination pixel is not changed. The function compresses or stretches the area if necessary to fit the dimensions of the destination size.
[in] | sid | Settings Collection ID. |
[in] | hPageDst | Handle of the page which contains the destination image. |
[in] | pRectDst | Coordinates of the destination rectangular area. NULL means the whole image. |
[in] | hPageSrc | Handle of the page which contains the source image. |
[in] | pRectSrc | Coordinates of the source rectangular area. NULL means the whole image. |
[in] | tColor | The color designated as being transparent. |
RECERR |
tColor
. In this case the function uses the alpha channel of the source image. RECERR kRecMergeImgArea(int sid, IntPtr hPageDst, RECT rectDst, IntPtr hPageSrc, RECT rectSrc, uint color); // or when pRectDst is NULL in C/C++ RECERR kRecMergeImgArea(int sid, IntPtr hPageDst, IntPtr hPageSrc, RECT rectSrc, uint color); // or when pRectSrc is NULL in C/C++ RECERR kRecMergeImgArea(int sid, IntPtr hPageDst, RECT rectDst, IntPtr hPageSrc, uint color); // or when pRectDst and pRectSrc are NULL in C/C++ RECERR kRecMergeImgArea(int sid, IntPtr hPageDst, IntPtr hPageSrc, uint color);
Image preprocessing.
The function kRecPreprocessImg performs a series of image pre-processing steps by activating the PID_IMGPREPROCESS process. Performing these image pre-processing steps may improve the quality of the image from an OCR point of view, which may have an impact on the overall page recognition accuracy. If pre-processing is desired, it should be done before performing auto-zoning and recognition. The available pre-processing steps are despeckle, fax correction, image inversion, deskewing, and rotation. (Using the Visual Toolbox, further preprocessing can be done by SET tools. For more information, see the Visual Toolbox help system.)
The preprocessing performs fax correction, rotation and deskew operations on II_CURRENT image, creates the image II_BW (implicit secondary image conversion) and does the image inversion and the despeckle operations on the latter image. (Despeckle runs only when the current image is a B/W one.) After these steps, it deletes the II_ORIGINAL image except when kRecSetPreserveOriginalImg has been called with TRUE parameter. The executing mode of these steps depends on the settings that can be changed by kRecSetImgInvert, kRecSetImgDeskew, kRecSetImgRotation, kRecSetImgDownsample, kRecSetFaxCorrection, kRecSetImgBinarizationMode, kRecSetImgDespeckleMode, kRecSetImgBinarizationMode, kRecSetImgBrightness, kRecSetImgThreshold, kRecSetImgResolEnhancement, kRecSetRMTradeoff, kRecSetLanguages and kRecSetDefaultFillingMethod. The value needed for programmed deskewing (DSK_SET) can be detected by kRecDetectImgSkew and defined in kRecSetImgSlope. Under certain circumstances, image despeckling and resolution enhancement are also performed internally. These depend on the settings that can be changed by kRecSetImgDespeckleMode, kRecSetImgResolEnhancement.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page. |
RECERR |
kRecPreprocessImg
estimates the resolution: determines the average character size and supposes that the text contains 12 point fonts. The estimated resolution is rounded to 150, 200, 300, 450 or 600. The resolution of the image will be restored to the original value at the end of kRecRecognize if the Kernel.Img.Resolution.Restore setting is TRUE
. RECERR kRecPreprocessImg(int sid, IntPtr hPage);
RECERR RECAPIKRN kRecPutImgArea | ( | int | sid, |
LPCIMG_INFO | lpImg, | ||
const BYTE * | lpBitmap, | ||
HPAGE | hPage, | ||
int | xDst, | ||
int | yDst, | ||
LPCSIZE | pDstSize | ||
) |
Updating image area.
The kRecPutImgArea function is used for updating a rectangular area of the current image of the page with a bitmap from the application. During downloading, the function compresses or stretches the original bitmap, if requested. The function assumes that the coordinates are given in the coordinate system of the current image (II_CURRENT).
[in] | sid | Settings Collection ID. |
[in] | lpImg | Pointer to an IMG_INFO structure which describes the source bitmap you want to download into the Engine. |
[in] | lpBitmap | Pointer to the source bitmap. |
[in] | hPage | Handle of the page of the destination image to be modified. |
[in] | xDst | X position of the destination area in pixels (upper left corner). |
[in] | yDst | Y position of the destination area in pixels (upper left corner). |
[in] | pDstSize | Size of the destination area. If this is not the same as the source area, the function compresses or stretches the area into the destination. NULL means that the size of the destination area will be the same as the size of the original bitmap. |
RECERR |
xDst
and yDst
parameters must be set to zero (0) and the pDstSize
should be NULL. RECERR kRecPutImgArea(int sid, IMG_INFO pImg, byte[] pBitmap, IntPtr hPage, int xDst, int yDst, SIZE pDstSize); // or when pDstSize is NULL in C/C++ RECERR kRecPutImgArea(int sid, IMG_INFO pImg, byte[] pBitmap, IntPtr hPage, int xDst, int yDst); // or RECERR kRecPutImgArea(int sid, Bitmap pBitmap, IntPtr hPage, int xDst, int yDst, SIZE pDstSize); // or when pDstSize is NULL in C/C++ RECERR kRecPutImgArea(int sid, Bitmap pBitmap, IntPtr hPage, int xDst, int yDst);
RECERR RECAPIKRN kRecReadImg | ( | int | sid, |
LPBYTE | pBuff | ||
) |
Reading an image line-by-line.
The kRecReadImg function exports one line from the specified image.
[in] | sid | Settings Collection ID. |
[out] | pBuff | Pointer of a buffer to store the next line. |
RECERR |
REC_OK
each time. As soon as the function finds no further line to get, it returns with IMG_NOMORE_WARN
, signaling the need for calling the kRecStopReadImg function. Removing marginal shadows.
This function cleans marginal shadows that may result from scanning. The borders are filled in with the color white.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page to be processed. |
[in] | maxWidth | Maximum width of the borders (in pixels). |
RECERR |
RECERR kRecRemoveBorders(int sid, IntPtr hPage, uint maxWidth);
RECERR RECAPIKRN kRecRemoveLines | ( | int | sid, |
HPAGE | hPage, | ||
IMAGEINDEX | iiImg, | ||
const RECT * | pRect | ||
) |
Removing lines.
The kRecRemoveLines function removes horizontal and vertical rule lines from the II_CURRENT or II_BW image of the page inside the given rectangle. The detected rule lines are stored in the line list of HPAGE, and can be obtained by kRecGetLineCount and kRecGetLineInfo functions.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page. |
[in] | iiImg | Index of the image in the page to be processed. If the specified image is not black-and-white the function returns IMG_BITSPERPIXEL_ERR . |
[in] | pRect | The rectangular area inside which lines are removed from the image. The function assumes that the coordinates are given in the coordinate system of the iiImg image. NULL means the whole image. |
RECERR |
RECERR kRecRemoveLines(int sid, IntPtr hPage, IMAGEINDEX iiImg, RECT pRect); // or RECERR kRecRemoveLines(int sid, IntPtr hPage);
RECERR RECAPIKRN kRecRemovePunchHoles | ( | int | sid, |
HPAGE | hPage, | ||
LPCRECT | ROIs, | ||
int | nROIs, | ||
LPRECT * | Holes, | ||
int * | nHoles, | ||
UINT | flags, | ||
UINT | minDiameter, | ||
UINT | maxDiameter | ||
) |
Removing punch holes.
Detecting punch hole image defects and transforming them to the background color.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page to be processed. |
[in] | ROIs | Array of rectangles inside which the punch holes should be detected. If it is NULL then the whole image is processed. |
[in] | nROIs | The number of rectangles in the ROIs array. |
[in,out] | Holes | Pointer to a variable for storing the bounding boxes of the holes. It can be NULL. For details see the description of parameter flags below. If PHOLE_DETECT flag is set and Holes parameter is not NULL this array is allocated by the function and can be freed calling the function kRecFree. |
[in,out] | nHoles | Pointer to a variable for storing the number of the holes. It can be NULL if Holes is NULL. |
[in] | flags | The following flags can be set:
|
[in] | minDiameter | Reserved for future versions. Must be 0. |
[in] | maxDiameter | Reserved for future versions. Must be 0. |
RECERR |
// Only removing RECERR kRecRemovePunchHoles(int sid, IntPtr hPage, RECT[] Holes); // Only detecting RECERR kRecDetectPunchHoles(int sid, IntPtr hPage, RECT[] ROIs, out RECT[] Holes, uint minDiameter, uint maxDiameter); RECERR kRecDetectPunchHoles(int sid, IntPtr hPage, out RECT[] Holes, uint minDiameter, uint maxDiameter); // Detecting and removing RECERR kRecDetectAndRemovePunchHoles(int sid, IntPtr hPage, RECT[] ROIs, out RECT[] Holes, uint minDiameter, uint maxDiameter); RECERR kRecDetectAndRemovePunchHoles(int sid, IntPtr hPage, out RECT[] Holes, uint minDiameter, uint maxDiameter);
RECERR RECAPIKRN kRecResetBookSize | ( | int | sid | ) |
Resetting the stored book page size.
This function resets the book page size stored by kRecDetectBook
. This function should be called every time you want to process more than one book and the page size of the next book differs from that of the previous one.
[in] | sid | Settings Collection ID. |
RECERR |
RECERR kRecResetBookSize(int sid);
RECERR RECAPIKRN kRecRotateImg | ( | int | sid, |
HPAGE | hPage, | ||
IMG_ROTATE | Rotation | ||
) |
Rotating the page.
The kRecRotateImg function rotates and/or mirrors the page according to the given parameter. It can be perform rotation by 90 degrees or its multiples.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page containing the image to be rotated. |
[in] | Rotation | Image transformation to be performed. Possible values can be any value of IMG_ROTATE except ROT_AUTO. |
RECERR |
RECERR kRecRotateImg(int sid, IntPtr hPage, IMG_ROTATE Rotation);
RECERR RECAPIKRN kRecRotateImgArea | ( | int | sid, |
HPAGE | hPage, | ||
IMAGEINDEX | iiImg, | ||
LPCRECT | pSrcRect, | ||
IMG_ROTATE | Rotation, | ||
LPIMG_INFO | lpImg, | ||
BYTE ** | lplpBitmap | ||
) |
Copying image area with rotation.
The kRecRotateImgArea function copies and rotates a rectangular area of the current image (II_CURRENT) of a page into a buffer available to the application. The function assumes that the coordinates are given in the coordinate system of the current image (II_CURRENT).
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page which contains the source image. |
[in] | iiImg | Index to the image in the page. |
[in] | pSrcRect | Dimensions of the source area. NULL means: the whole image will be copied. |
[in] | Rotation | Image rotation mode to be applied as the area is copied. All the values of the IMG_ROTATE can be used except ROT_AUTO. |
[out] | lpImg | Address of a structure to get information about the output image area. |
[out] | lplpBitmap | Address of a pointer to the rotated bitmap. |
RECERR |
RECERR kRecRotateImgArea(int sid, IntPtr hPage, IMAGEINDEX iiImg, RECT pSrcRect, IMG_ROTATE Rotation, out IMG_INFO pImg, out byte[] ppBitmap); // or when pSrcRect is NULL in C/C++ RECERR kRecRotateImgArea(int sid, IntPtr hPage, IMAGEINDEX iiImg, IMG_ROTATE Rotation, out IMG_INFO pImg, out byte[] ppBitmap); // or RECERR kRecRotateImgArea(int sid, IntPtr hPage, IMAGEINDEX iiImg, RECT pSrcRect, IMG_ROTATE Rotation, out IMG_INFO pImg, out Bitmap bmp); // or when pSrcRect is NULL in C/C++ RECERR kRecRotateImgArea(int sid, IntPtr hPage, IMAGEINDEX iiImg, IMG_ROTATE Rotation, out IMG_INFO pImg, out Bitmap bmp);
RECERR RECAPIKRN kRecSetDropoutColorWeights | ( | int | sid, |
int | wred, | ||
int | wgreen, | ||
int | wblue | ||
) |
Changing the dropout color weight settings for binarization.
The kRecSetDropoutColorWeights function sets the weights used to calculate the gray-level intensity values from the color components during binarization. In default mode these weights are (77, 150, 29). By setting the weights before preprocessing and/or binarization, objects of a particular color (the drop-out color) can be dropped from the binary image, therefore filled forms can be binarized so that the BW image does not contain the preprinted text. E.g. using (1, 0, 0) as weights, the red preprinted text can be dropped from the white background. In practice the best weights can be calculated by the function kRecDetectDropoutColorWeights. To process drop-out color images the CNV_GLOBAL binarization method is suggested (see kRecSetImgBinarizationMode).
[in] | sid | Settings Collection ID. |
[in] | wred | Weight of the red component. |
[in] | wgreen | Weight of the green component. |
[in] | wblue | Weight of the blue component. |
RECERR |
RECERR kRecSetDropoutColorWeights(int sid, int wred, int wgreen, int wblue);
RECERR RECAPIKRN kRecSetFaxCorrection | ( | int | sid, |
INTBOOL | corr | ||
) |
Changing the fax correction setting.
This function changes the setting Kernel.Img.FaxCorrectionEnabled, which determines whether the fax correction operation is enabled during preprocessing (PID_IMGPREPROCESS) or not.
[in] | sid | Settings Collection ID. |
[in] | corr | If this is TRUE, the fax correction is enabled. |
RECERR |
RECERR kRecSetFaxCorrection(int sid, bool corr);
RECERR RECAPIKRN kRecSetImgBinarizationMode | ( | int | sid, |
IMG_CONVERSION | BWConversion | ||
) |
Setting secondary image conversion mode.
The kRecSetImgBinarizationMode function specifies which Image conversion mode is used during an implicit secondary image conversion step. This step is performed automatically when the application calls a KernelAPI API function whose operation requires the II_BW image, but it does not exist. This setting influences how a non-B/W image stored in the Engine is converted to a B/W one.
[in] | sid | Settings Collection ID. |
[in] | BWConversion | Secondary image conversion mode to be set. Valid values are: CNV_AUTO, CNV_SET and CNV_GLOBAL. If another one has been specified, the function returns with API_PARAMETER_ERR. |
RECERR |
BWConversion
mode might be performed on existing images. In this case a second, B/W image is created and stored in the page on index II_BW. This step is called either directly (from within the kRecConvertImg2BW function) or implicitly, as described above. E.g. when the kRecRecognize function has been called for a non-B/W image, an implicit secondary image conversion is performed automatically. The kRecRecognize function may implicitly include the conversion of the image, if necessary. A previous kRecSetImgBinarizationMode call allows you to specify how this implicit conversion is performed. RECERR kRecSetImgBinarizationMode(int sid, IMG_CONVERSION BWConversion);
RECERR RECAPIKRN kRecSetImgBrightness | ( | int | sid, |
int | Brightness | ||
) |
Setting brightness.
The kRecSetImgBrightness function fine-tunes the threshold calculation in the automatic adaptive image conversion mode (i.e. when CNV_AUTO has been specified). This influences the brightness/darkness of the resulting B/W image during both the primary and the secondary image conversion.
[in] | sid | Settings Collection ID. |
[in] | Brightness | Brightness control of the automatic image conversion algorithm. The value range is between zero (0) and 100. A value of 0 tunes the conversion to give a lighter image, while a value of 100 results in a darker image. The default value is 50. |
RECERR |
RECERR kRecSetImgBrightness(int sid, int Brightness);
RECERR RECAPIKRN kRecSetImgConvMode | ( | int | sid, |
IMG_CONVERSION | Conversion | ||
) |
Setting the primary image conversion mode.
The kRecSetImgConvMode function specifies which Image conversion mode is used during the primary image conversion step. While loading an image to the Engine's authority (PID_IMGINPUT process), an image conversion is also performed according to the current image conversion mode setting. The setting specified here influences what kind of image will be created in the Engine's memory.
[in] | sid | Settings Collection ID. |
[in] | Conversion | Primary image conversion mode to be set. Possible values are: CNV_AUTO, CNV_SET, CNV_NO, CNV_GLOBAL and CNV_GRAY. |
RECERR |
RECERR kRecSetImgConvMode(int sid, IMG_CONVERSION Conversion);
RECERR RECAPIKRN kRecSetImgDeskew | ( | int | sid, |
IMG_DESKEW | _ImgDeskew | ||
) |
Setting deskew mode.
The kRecSetImgDeskew function specifies which Image deskewing mode is used during a forthcoming PID_IMGPREPROCESS process. Deskewing mode can be automatic, switched off or programmable.
[in] | sid | Settings Collection ID. |
[in] | _ImgDeskew | Select deskewing mode. |
RECERR |
RECERR kRecSetImgDeskew(int sid, IMG_DESKEW ImgDeskew);
RECERR RECAPIKRN kRecSetImgDespeckleMode | ( | int | sid, |
INTBOOL | bMode | ||
) |
Setting despeckle mode.
The kRecSetImgDespeckleMode function specifies the Engine's Image despeckle mode setting, i.e. whether the adaptive noise removal algorithm is to be activated during implicit primary and secondary image conversion when the current image (II_CURRENT) is a B/W one. The noise removal algorithm runs only on B/W images with a resolution of 180 dpi or higher. This setting might influence the recognition accuracy.
[in] | sid | Settings Collection ID. |
[in] | bMode | Image despeckle mode to be set. |
RECERR |
RECERR kRecSetImgDespeckleMode(int sid, bool bMode);
RECERR RECAPIKRN kRecSetImgDownsample | ( | int | sid, |
INTBOOL | downsample | ||
) |
Changing the view downsample setting.
This function changes the setting Kernel.Img.ViewDownsample, which determines whether the current image (II_CURRENT) is created in the same resolution as the original (II_ORIGINAL) one or in a resolution reduced to 100-150 DPI (depends on the original resolution) while running kRecPreprocessImg. For more information about this setting see Settings of the Image Handling Module. For information about the lifetime of the current image see IMAGEINDEX.
[in] | sid | Settings Collection ID. |
[in] | downsample | If this is TRUE , the view image is created with reduced resolution. Its default is FALSE . |
RECERR |
RECERR kRecSetImgDownsample(int sid, bool downsample);
Setting the image flags.
The kRecSetImgFlags function sets the specified flag of the given HPAGE.
[in] | hPage | Handle of the page. |
[in] | Flag | The flag to set. See: IMG_FLAGS. |
[in] | bValue | The new value of the flag. |
RECERR RECAPIKRN kRecSetImgFormat | ( | int | sid, |
IMG_LINEORDER | lineord, | ||
IMG_PADDING | padding, | ||
IMG_RGBORDER | ord | ||
) |
Setting image format.
The kRecSetImgFormat function specifies the line order, the padding mode and (in the case of a 24-bit color image) the order of the composite color components of the images in the application's authority. The settings of this function affect the following API functions: kRecGetImgArea, kRecPutImgArea, kRecRotateImgArea, kRecReadImg, kRecWriteImg and the kRecLoadImgM functions.
[in] | sid | Settings Collection ID. |
[in] | lineord | Line order selection. Possible values are: TOP_DOWN, BOTTOM_UP. This parameter is not considered during kRecReadImg and kRecWriteImg, because they work only on one line at a time. |
[in] | padding | Padding the scan lines to byte, word or double word boundaries. The values of this parameter therefore can be PAD_BYTEBOUNDARY, PAD_WORDBOUNDARY or PAD_DWORDBOUNDARY. This parameter is not considered during kRecReadImg and kRecWriteImg, because they work only on one line at a time. |
[in] | ord | Order of the composite color components. Possible values are: COLOR_RGB or COLOR_BGR. |
RECERR |
RECERR kRecSetImgFormat(int sid, IMG_LINEORDER lineord, IMG_PADDING padding, IMG_RGBORDER ord);
RECERR RECAPIKRN kRecSetImgInvert | ( | int | sid, |
IMG_INVERT | ImgInvert | ||
) |
Setting inversion mode.
The kRecSetImgInvert function specifies which Image inversion mode is used during the forthcoming PID_IMGPREPROCESS processes. The Image inversion mode can be either automatic, switched on or switched off (white-on-black to black-on-white).
[in] | sid | Settings Collection ID. |
[in] | ImgInvert | Image inversion mode to be set. Possible values are: INV_NO, INV_YES, INV_AUTO. |
RECERR |
RECERR kRecSetImgInvert(int sid, IMG_INVERT ImgInvert);
Setting palette of the image.
This function sets the palette of the current (II_CURRENT) image of the given page.
[in] | hPage | Handle of the page containing the image. |
[in] | pPal | Array of the palette to be set. See notes. |
RECERR |
API_PARAMETER_ERR
. RECERR kRecSetImgPalette(IntPtr hPage, byte[] pPal);
RECERR RECAPIKRN kRecSetImgResolEnhancement | ( | int | sid, |
IMG_RESENH | res | ||
) |
Setting resolution enhancement mode.
The kRecSetImgResolEnhancement function specifies the Image resolution enhancement mode. This setting is applied only to non-B/W and non palette color images stored in the Engine's memory space. The value specifies whether the image resolution enhancement is to be activated during the secondary image conversion, i.e. during image pre-processing, auto-zoning or recognition. The resolution enhancement algorithm results in a B/W image whose resolution is higher than the resolution of the original image. This setting might influence recognition accuracy.
[in] | sid | Settings Collection ID. |
[in] | res | The Image resolution enhancement value to be set. |
RECERR |
RECERR kRecSetImgResolEnhancement(int sid, IMG_RESENH res);
Changing the resolution of an image.
This function sets the resolution of the current (II_CURRENT) image of the given page.
[in] | hPage | Handle of the page containing the image. |
[in] | DPI | The new horizontal and vertical resolution (Dots Per Inch) of the current image. |
RECERR |
RECERR kRecSetImgResolution(IntPtr hPage, SIZE DPI);
RECERR RECAPIKRN kRecSetImgRotation | ( | int | sid, |
IMG_ROTATE | imgRotate | ||
) |
Setting rotation mode.
The kRecSetImgRotation function specifies which Image rotation mode is used during a forthcoming PID_IMGPREPROCESS process. The Image rotation mode can be automatic, switched off or programmable.
[in] | sid | Settings Collection ID. |
[in] | imgRotate | Image rotation mode to be set. Possible values are: ROT_AUTO, ROT_NO, ROT_RIGHT, ROT_DOWN, ROT_LEFT. |
RECERR |
RECERR kRecSetImgRotation(int sid, IMG_ROTATE ImgRotate);
RECERR RECAPIKRN kRecSetImgSlope | ( | int | sid, |
int | Slope | ||
) |
Setting the slope.
The kRecSetImgSlope function specifies the value of the skew slope. This value is used during the PID_IMGPREPROCESS process when the Image deskewing mode is set to DSK_SET.
[in] | sid | Settings Collection ID. |
[in] | Slope | Slope value for deskewing. The value given here is the number of pixels of vertical ascent on 1000 horizontal pixels i.e. the tangent of the deskew angle multiplied by 1000. |
RECERR |
RECERR kRecSetImgSlope(int sid, int Slope);
RECERR RECAPIKRN kRecSetImgStretchMode | ( | int | sid, |
IMG_STRETCHMODE | ImgStretchMode | ||
) |
Setting stretching mode.
The kRecSetImgStretchMode function specifies which Image stretching mode is used while executing the kRecGetImgArea or kRecPutImgArea functions.
[in] | sid | Settings Collection ID. |
[in] | ImgStretchMode | Image stretching mode to be applied. Possible values are: STRETCH_DELETE, STRETCH_OR, STRETCH_AND and STRETCH_AVG. |
RECERR |
RECERR kRecSetImgStretchMode(int sid, IMG_STRETCHMODE ImgStretchMode);
RECERR RECAPIKRN kRecSetImgThreshold | ( | int | sid, |
int | Threshold | ||
) |
Setting the binarization threshold.
The kRecSetImgThreshold function specifies the threshold parameter of an image conversion to a B/W image. This parameter has an effect only when the CNV_SET image conversion mode has been set. This setting is used during both the primary and the secondary image conversion.
[in] | sid | Settings Collection ID. |
[in] | Threshold | The image conversion threshold value to be set. It ranges between zero (0) and 255, default: 128. |
RECERR |
RECERR kRecSetImgThreshold(int sid, int Threshold);
RECERR RECAPIKRN kRecSetPreserveOriginalImg | ( | int | sid, |
INTBOOL | preserve | ||
) |
Changing the keep original image setting.
This function changes the setting Kernel.Img.KeepOriginalImage, which determines whether the original image (II_ORIGINAL) is kept after the preprocessing step or not. The original image is used only as an input image of the preprocessing step PID_IMGPREPROCESS, thus after preprocessing it can be deleted for saving memory. For more information about this setting see Settings of the Image Handling Module. For information about the lifetime of the thumbnail image see IMAGEINDEX.
[in] | sid | Settings Collection ID. |
[in] | preserve | If this is TRUE, the original image is kept. |
RECERR |
RECERR kRecSetPreserveOriginalImg(int sid, bool preserve);
RECERR RECAPIKRN kRecSetRetainColor | ( | int | sid, |
RETAINCOLOR | RetainColor | ||
) |
Changing retain color setting.
This function changes the retain color setting.
[in] | sid | Settings Collection ID. |
[in] | RetainColor | The retain color value to be set. |
RECERR |
RECERR kRecSetRetainColor(int sid, RETAINCOLOR RetainColor);
Changing the thumbnail image info settings.
This function changes the settings under the node Kernel.Img.Thumbnail, which determines the image info used at the creation of the thumbnail image. For more information about this setting see Settings of the Image Handling Module. For information about the lifetime of the thumbnail image see IMAGEINDEX.
[in] | sid | Settings Collection ID. |
[in] | pThumbnail | This is the image information to be set. Only its fields IMG_INFO::BitsPerPixel and IMG_INFO::Size are considered. The BitsPerPixel can be 1, 8 or 24. The Size is the width and height of the thumbnail image. If either the horizontal or vertical size is set to zero, its value is automatically determined so as to preserve the aspect ratio of the source page. If both size values are given, the aspect ratio is still preserved, with the thumbnail color placed in the unused space (see II_THUMBNAIL). |
[in] | color | This thumbnail color is placed in the background if the thumbnail image does not cover the whole thumbnail area. See II_THUMBNAIL. |
RECERR |
RECERR kRecSetThumbnailImgInfo(int sid, [In] IMG_INFO pThumbnail, uint color);
RECERR RECAPIKRN kRecStartReadImg | ( | int | sid, |
HPAGE | hPage, | ||
IMAGEINDEX | iiImg, | ||
LPCRECT | pRect, | ||
IMG_ROTATE | ImgRotation, | ||
LPWORD | pBytes | ||
) |
Starting to read an image line-by-line.
The kRecStartReadImg function initiates the line-by-line reading process to export an image stored in the image management module.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page which contains the image to be processed. |
[in] | iiImg | Index to the image in the page. |
[in] | pRect | Pointer to the structure defining the requested area of the image or NULL for the entire image. |
[in] | ImgRotation | Orientation of the lines during reading. Possible values are all the values of the type IMG_ROTATE except ROT_AUTO. |
[out] | pBytes | Pointer to a variable to hold the length of the lines to be read in bytes. |
RECERR |
RECERR RECAPIKRN kRecStartWriteImg | ( | int | sid, |
LPCIMG_INFO | pImg | ||
) |
Starting to write an image line-by-line.
The kRecStartWriteImg function initiates a line-by-line bitmap transfer for direct raw image download from the application's image source. The kRecStartWriteImg function sends pertinent information about the image to the Engine and prepares for creating a new HPAGE.
[in] | sid | Settings Collection ID. |
[in] | pImg | Pointer to a filled IMG_INFO structure describing the image to be transferred. |
RECERR |
kRecStopWriteImg
creates the mentioned new HPAGE
and returns with it. RECERR RECAPIKRN kRecStopReadImg | ( | int | sid | ) |
Stopping to read an image line-by-line.
The kRecStopReadImg function stops the line-by-line image exporting process started and performed with the functions kRecStartReadImg and kRecReadImg.
[in] | sid | Settings Collection ID. |
RECERR |
IMG_NOMORE_WARN
from a kRecReadImg call. Stopping the writing of an image line-by-line.
The kRecStopWriteImg function completes the image download operation started with kRecStartWriteImg and kRecWriteImg calls. It stores the downloaded image in a newly created HPAGE.
[in] | sid | Settings Collection ID. |
[out] | phPage | Address of a variable to store the handle of the created page. |
RECERR |
RECERR RECAPIKRN kRecTransformCoordinates | ( | HPAGE | hPage, |
IMAGEINDEX | iiDst, | ||
IMAGEINDEX | iiSrc, | ||
int | nP, | ||
LPPOINT | pPoint | ||
) |
Transforming coordinates between images of a page.
This function retrieves the coordinates of the destination image according to those of the source image. The transformation used is able to convert the coordinate system of the source image into that of the destination image of the same page.
[in] | hPage | Handle of the page. |
[in] | iiDst | Index of the destination image. |
[in] | iiSrc | Index of the source image. |
[in] | nP | Number of points in the buffer. |
[in,out] | pPoint | Buffer of the points to be converted. The result will rewrite the coordinates in place. |
RECERR |
RECERR kRecTransformCoordinates(IntPtr hPage, IMAGEINDEX iiDst, IMAGEINDEX iiSrc, POINT[] pPoint);
RECERR RECAPIKRN kRecTransformImg | ( | int | sid, |
HPAGE | hPage, | ||
IMAGEINDEX | iiImg, | ||
LPCRECT | pSrcRect, | ||
LPCSIZE | pDstSize, | ||
WORD | BitsPerPixel, | ||
HPAGE * | phPageOut | ||
) |
Transforming an image.
The kRecTransformImg function creates a new image from an existing one. During this transformation, a rectangular area of the selected image of the input page is copied to the original image (II_ORIGINAL) of the output page. This area is compressed or stretched according to the ratio of the source rectangular area and the destination size.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the input page. |
[in] | iiImg | Index of the input image whose area should be transformed. |
[in] | pSrcRect | Rectangular area of the image to be transformed. NULL means: the whole image is transformed. |
[in] | pDstSize | Size of the image to be created in pixels. A value of NULL here means that the destination size is equal to the size of the source rectangle. |
[in] | BitsPerPixel | Type of the image (number of bits per pixel). Possible values are: 1, 4, 8, 24 for B/W, 4-bit gray-scale, 8-bit gray-scale and 24-bit color image, respectively. |
[out] | phPageOut | Pointer of a variable to store the handle of the output page to be created. |
RECERR |
RECERR kRecTransformImg(int sid, IntPtr hPage, IMAGEINDEX iiImg, RECT pSrcRect, SIZE pDstSize, ushort BitsPerPixel, out IntPtr phPageOut); // or when pSrcRect is NULL in C/C++ RECERR kRecTransformImg(int sid, IntPtr hPage, IMAGEINDEX iiImg, SIZE pDstSize, ushort BitsPerPixel, out IntPtr phPageOut); // or when pDstSize is NULL in C/C++ RECERR kRecTransformImg(int sid, IntPtr hPage, IMAGEINDEX iiImg, RECT pSrcRect, ushort BitsPerPixel, out IntPtr phPageOut); // or when both are NULL RECERR kRecTransformImg(int sid, IntPtr hPage, IMAGEINDEX iiImg, ushort BitsPerPixel, out IntPtr phPageOut);
RECERR RECAPIKRN kRecTransformImgByMatrix | ( | int | sid, |
HPAGE | hPage, | ||
const SIZE * | newsize, | ||
const double * | matrix | ||
) |
Performing geometrical transformation determined by a matrix.
The kRecTransformImgByMatrix function performs a geometrical transformation on the II_CURRENT image of the given page. If there are BW (II_BW) and thumbnail (II_THUMBNAIL) images they are regenerated from the transformed current image.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the page containing the image(s) to be transformed. |
[in] | newsize | The new size of the current image. The size is not changed if it is NULL . |
[in] | matrix | The transformation matrix containing 8 elements. |
RECERR |
M
matrix in the following order: M[0][0], M[0][1], M[0][2], M[1][0], M[1][1], M[1][2], M[2][0], M[2][1].
The last (M[2][2]
) element is always supposed to be 1.0. The function uses the following algorithm, (x0,y0)
is the original point and (x2,y2)
is the transformed point, [x, y, z]
is a column vector: [x1, y1, z1] = M * [x0,y0,1] x2 = x1 / z1 y2 = y1 / z1
x
degrees: cos(x),sin(x),0,-sin(x),cos(x),0,0,0
(x,y)
: 1,0,x,0,1,y,0,0
s:
s,0,0,0,s,0,0,0
T2
given by matrix M2
after T1
given by matrix M1
) can be performed in one step calculating and passing the combined matrix M2 * M1
. If the M[2][2]
element of the combined matrix is not 1.0 the matrix should be normalized (i.e. its elements should be divided by M[2][2]
). RECERR kRecTransformImgByMatrix(int sid, IntPtr hPage, SIZE newsize, double[] pMatrix); // or when newsize is NULL in C/C++ RECERR kRecTransformImgByMatrix(int sid, IntPtr hPage, double[] pMatrix);
RECERR RECAPIKRN kRecTransformImgByPoints | ( | int | sid, |
HPAGE | hPage, | ||
const SIZE * | newsize, | ||
const POINT * | pOriginal, | ||
const POINT * | pTransformed, | ||
int | nPoints | ||
) |
Performing geometrical transformation determined by points.
The kRecTransformImgByPoints function performs a geometrical transformation on the II_CURRENT image of the given page. It creates a transformation matrix which transforms the pOriginal
points to pTransformed
, and applies it to the image. If there are BW (II_BW) and thumbnail (II_THUMBNAIL) images they are regenerated from the transformed current image.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of page containing the image(s) to be transformed. |
[in] | newsize | The new size of the current image. The size is not changed if it is NULL. |
[in] | pOriginal | Array of original points. |
[in] | pTransformed | Array of transformed points. |
[in] | nPoints | The number of given points in pOriginal and pTransformed array. |
RECERR |
nPoints
== 1,nPoints
== 2,nPoints
== 3, andnPoints
>= 4.nPoints
> 4 the transformation does not exactly transform all original points to transformed ones. RECERR kRecTransformImgByPoints(int sid, IntPtr hPage, SIZE newsize, POINT[] pOriginal, POINT[] pTransformed); // or when newsize is NULL in C/C++ RECERR kRecTransformImgByPoints(int sid, IntPtr hPage, POINT[] pOriginal, POINT[] pTransformed);
RECERR RECAPIKRN kRecTransformImgPalette | ( | int | sid, |
HPAGE | hPage, | ||
IMAGEINDEX | iiImg, | ||
LPCRECT | pSrcRect, | ||
LPCSIZE | pDstSize, | ||
HPAGE * | phPageOut | ||
) |
Transforming palette-color images.
The kRecTransformImgPalette function creates a new palette-color image from an existing image. During this transformation, a rectangular area of the selected image of the input page is copied to the original image (II_ORIGINAL) of the output page. This area is compressed or stretched according to the ratio of the source rectangular area's size and that of the destination image.
[in] | sid | Settings Collection ID. |
[in] | hPage | Handle of the source page. |
[in] | iiImg | Index of the image in the source page to be transformed. |
[in] | pSrcRect | Rectangular area of the selected image to be transformed. NULL means the whole image is transformed. |
[in] | pDstSize | Size of the output image to be created in pixels. A value of NULL here means that the destination size is equal to the size of the source rectangle. |
[out] | phPageOut | Pointer of a variable to store the handle of the output page. |
RECERR |
RECERR kRecTransformImgPalette(int sid, IntPtr hPage, IMAGEINDEX iiImg, RECT pSrcRect, SIZE pDstSize, out IntPtr phPageOut); // or when pSrcRect is NULL in C/C++ RECERR kRecTransformImgPalette(int sid, IntPtr hPage, IMAGEINDEX iiImg, SIZE pDstSize, out IntPtr phPageOut); // or when pDstSize is NULL in C/C++ RECERR kRecTransformImgPalette(int sid, IntPtr hPage, IMAGEINDEX iiImg, RECT pSrcRect, out IntPtr phPageOut); // or when both are NULL RECERR kRecTransformImgPalette(int sid, IntPtr hPage, IMAGEINDEX iiImg, out IntPtr phPageOut);
RECERR RECAPIKRN kRecWriteImg | ( | int | sid, |
const LPBYTE | pBuff | ||
) |
Writing an image line-by-line.
The kRecWriteImg function downloads a line of raw image data from the application's buffer to the Engine. It should be repeatedly called to send successive lines of the image to an image in the image management module.
[in] | sid | Settings Collection ID. |
[in] | pBuff | Pointer to a buffer containing the line of image data to be downloaded to the Engine. |
RECERR |