Resource Base
Table of contents

Detecting and Normalizing Methods

Method Description
DDN_DetectQuadFromBuffer Detects quad from source image specified by the raw buffer.
DDN_DetectQuadFromFile Detects quad from source image specified by file path.
DDN_NormalizeBuffer Normalizes the source image specified by file path.
DDN_NormalizeFile Normalizes the source image specified by raw buffer.

DDN_DetectQuadFromBuffer

Detects quad from source image specified by the raw buffer.

int DDN_DetectQuadFromBuffer(void* normalizer, const ImageData* sourceImage, const char* templateName, DetectedQuadResultArray** result)

Parameters

[in] normalizer Handle of the Dynamsoft Document Normalizer instance.

[in] sourceImage The source image buffer.

[in] templateName The template name. A template name is the value of key ImageParameter.Name defined in JSON formatted settings. If no template name is specified, current runtime settings will be used.

[out] result An array of all detected quad results. It is allocated by the SDK and should be freed by calling function DDN_FreeDetectedQuadResultArray.

Return Value

Returns error code (returns 0 if the function operates successfully).

You can call DC_GetErrorString to get detailed error message.

Code Snippet

void* ddn = NULL;
int errorCode = 0;
char szErrorMsg[256];
DetectedQuadResultArray* detectedQuadResultArray = NULL;
errorCode = DC_InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
//...handle the errorCode
ddn = DDN_CreateInstance();
//...generate imageData from somewhere else
errorCode = DDN_DetectQuadFromBuffer(ddn, imageData, "", &detectedQuadResultArray);
//...do something with the detectedQuadResultArray
DDN_FreeDetectedQuadResultArray(&detectedQuadResultArray);
DDN_DestroyInstance(ddn);

DDN_DetectQuadFromFile

Detects quad from source image specified by file path.

int DDN_DetectQuadFromFile(void* normalizer, const char* sourceFilePath, const char* templateName, DetectedQuadResultArray** result)

Parameters

[in] normalizer Handle of the Dynamsoft Document Normalizer instance.

[in] sourceFilePath A string defining the source file path. It supports BMP, JPEG, PNG, TIFF and PDF files.

[in] templateName The template name. A template name is the value of key ImageParameter.Name defined in JSON formatted settings. If no template name is specified, current runtime settings will be used.

[out] result An array of all detected quad results. It is allocated by the SDK and should be freed by calling function DDN_FreeDetectedQuadResultArray.

Return Value

Returns error code (returns 0 if the function operates successfully).

You can call DC_GetErrorString to get detailed error message.

Code Snippet

void* ddn = NULL;
int errorCode = 0;
char szErrorMsg[256];
DetectedQuadResultArray* detectedQuadResultArray = NULL;
errorCode = DC_InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
//...handle the errorCode
ddn = DDN_CreateInstance();
errorCode = DDN_DetectQuadFromFile(ddn, "YOUR-SOURCE-FILE-PATH", "", &detectedQuadResultArray);
//...do something with the detectedQuadResultArray
DDN_FreeDetectedQuadResultArray(&detectedQuadResultArray);
DDN_DestroyInstance(ddn);

DDN_NormalizeBuffer

Normalizes the source image specified by raw buffer.

int DDN_NormalizeBuffer(void* normalizer, const ImageData* sourceImage, const char* templateName, const Quadrilateral* quad, NormalizedImageResult** result)

Parameters

[in] normalizer Handle of the Dynamsoft Document Normalizer instance.

[in] sourceImage The source image buffer.

[in] templateName The template name. A template name is the value of key ImageParameter.Name defined in JSON formatted settings. If no template name is specified, current runtime settings will be used.

[in] quad The quadrilateral representing the boundary of the content to be normalized.

[out] result The normalized image result. It is allocated by the SDK and should be freed by calling function DDN_FreeNormalizedImageResult.

Return Value

Returns error code (returns 0 if the function operates successfully).

You can call DC_GetErrorString to get detailed error message.

Code Snippet

void* ddn = NULL;
int errorCode = 0;
char szErrorMsg[256];
NormalizedImageResult* normalizedResult = NULL;
errorCode = DC_InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
//...handle the errorCode
ddn = DDN_CreateInstance();
//...generate imageData from somewhere else
errorCode = DDN_NormalizeBuffer(ddn, imageData, "", NULL, &normalizedResult);
//...do something with the normalizedResult
DDN_FreeNormalizedImageResult(&normalizedResult);
DDN_DestroyInstance(ddn);

DDN_NormalizeFile

Normalizes the source image specified by file path.

int DDN_NormalizeFile(void* normalizer, const char* sourceFilePath, const char* templateName, const Quadrilateral* quad, NormalizedImageResult** result)

Parameters

[in] normalizer Handle of the Dynamsoft Document Normalizer instance.

[in] sourceFilePath A string defining the source file path. It supports BMP, JPEG, PNG, TIFF and PDF files.

[in] templateName The template name. A template name is the value of key ImageParameter.Name defined in JSON formatted settings. If no template name is specified, current runtime settings will be used.

[in] quad The quadrilateral representing the boundary of the content to be normalized.

[out] result The normalized image result. It is allocated by the SDK and should be freed by calling function DDN_FreeNormalizedImageResult.

Return Value

Returns error code (returns 0 if the function operates successfully).

You can call DC_GetErrorString to get detailed error message.

Code Snippet

void* ddn = NULL;
int errorCode = 0;
char szErrorMsg[256];
NormalizedImageResult* normalizedResult = NULL;
errorCode = DC_InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
//...handle the errorCode
ddn = DDN_CreateInstance();
errorCode = DDN_NormalizeFile(ddn, "YOUR-SOURCE-FILE-PATH", "", NULL, &normalizedResult);
//...do something with the normalizedResult and errorCode
DDN_FreeNormalizedImageResult(&normalizedResult);
DDN_DestroyInstance(ddn);

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version(2.2.10)
  • Version 2.x
    • Version 2.2.0
    • Version 2.0.20
    • Version 2.0.10
    • Version 2.0.0
  • Version 1.x
    • Version 1.0.20
    • Version 1.0.10
    • Version 1.0.0
Change +
© 2003–2024 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support