iDRS™ SDK 16
Loading...
Searching...
No Matches
CPerspective_interface.h File Reference

Interface for CPerspective wrapper. More...

Go to the source code of this file.

Functions

CPerspective CPerspective_Create (const CIDRS objIdrs, idrs_exception *pargException)
 Creates a new CPerspective object.
 
PerspectiveCorners CPerspective_DetectDocumentCorners (CPerspective argCPerspective, const CImage argImage, idrs_exception *pargException)
 DetectDocumentCorners retrieves the corners for the supplied image.
 
void CPerspective_CorrectPerspective (CPerspective argCPerspective, CImage argImage, const PerspectiveCorners *stPerspectiveCorners, idrs_exception *pargException)
 ApplyCorrection corrects perspective distortion of the supplied image using the provided corners.
 
void CPerspective_SetCropToDocumentArea (CPerspective argCPerspective, IDRS_BOOL const bCropToDocumentArea, idrs_exception *pargException)
 Sets the flag to crop to document area.
 
IDRS_BOOL CPerspective_GetCropToDocumentArea (const CPerspective argCPerspective, idrs_exception *pargException)
 Gets the flag to crop to document area.
 
void CPerspective_Destroy (CPerspective argCPerspective, idrs_exception *pargException)
 Destroys a CPerspective handle.
 

Detailed Description

Interface for CPerspective wrapper.

Function Documentation

◆ CPerspective_CorrectPerspective()

void CPerspective_CorrectPerspective ( CPerspective  argCPerspective,
CImage  argImage,
const PerspectiveCorners stPerspectiveCorners,
idrs_exception *  pargException 
)

ApplyCorrection corrects perspective distortion of the supplied image using the provided corners.

Parameters
argCPerspectiveCPerspective handle
argImageThe image where perspective distortions will be corrected, using the corners provided in pcPerspectiveCorners
stPerspectiveCornersThe corners of corrected document (usually obtained using
See also
DetectDocumentCorners).
Parameters
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CPerspective_Create()

CPerspective CPerspective_Create ( const CIDRS  objIdrs,
idrs_exception *  pargException 
)

Creates a new CPerspective object.

Parameters
objIdrsIdrs handle
pargExceptionPointer to exception structure that will be filled if an exception occurs
Returns
The newly created CPerspective object.
Remarks
Instances created by this method can also be provided to CImageOperation methods

◆ CPerspective_Destroy()

void CPerspective_Destroy ( CPerspective  argCPerspective,
idrs_exception *  pargException 
)

Destroys a CPerspective handle.

Parameters
argCPerspectiveCPerspective handle to destroy
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CPerspective_DetectDocumentCorners()

PerspectiveCorners CPerspective_DetectDocumentCorners ( CPerspective  argCPerspective,
const CImage  argImage,
idrs_exception *  pargException 
)

DetectDocumentCorners retrieves the corners for the supplied image.

Parameters
argCPerspectiveCPerspective handle
argImageThe image for which the perspective distortion corners will be computed.
pargExceptionPointer to exception structure that will be filled if an exception occurs
Returns
The perspective distortion corners.

◆ CPerspective_GetCropToDocumentArea()

IDRS_BOOL CPerspective_GetCropToDocumentArea ( const CPerspective  argCPerspective,
idrs_exception *  pargException 
)

Gets the flag to crop to document area.

If the flag is set to IDRS_TRUE, the method CorrectPerspective () will crop the underlying CImage or CPage object so that it contains only the area delimited by the four corners provided as parameters. If the flag is set to IDRS_FALSE, the method CorrectPerspective () will keep all pixels of the underlying CImage object (and add extra pixels for area not represented by the original image)

Default value for the flag is IDRS_TRUE.

Returns
The value of the flag.
Parameters
argCPerspectiveCPerspective handle
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CPerspective_SetCropToDocumentArea()

void CPerspective_SetCropToDocumentArea ( CPerspective  argCPerspective,
IDRS_BOOL const  bCropToDocumentArea,
idrs_exception *  pargException 
)

Sets the flag to crop to document area.

If the flag is set to IDRS_TRUE, the method CorrectPerspective () will crop the underlying CImage or CPage object so that it contains only the area delimited by the four corners provided as parameters. If the flag is set to IDRS_FALSE, the method CorrectPerspective () will keep all pixels of the underlying CImage object (and add extra pixels for area not represented by the original image)

Remarks
If the flag is set to IDRS_FALSE, the method DetectDocumentCorners() may fail with a specific exception thrown: IDRS_ERROR_PREPRO_CAMERA_IMAGE_PERSPECTIVE_DISTORTION_TOO_LARGE. This will happen when the detected perspective is considered too large; which consists in the following cases:
  • The angle of any of the corners is less than 23 degrees
  • The dimension (width or height) of the corrected image would be more than 2.5 times the corresponding dimension of the original image. When such an exception is thrown, an integrator can fallback to performing perspective correction with CropToDocumentArea flag set to IDRS_TRUE.
Parameters
argCPerspectiveCPerspective handle
bCropToDocumentAreathe value for the flag.
pargExceptionPointer to exception structure that will be filled if an exception occurs