Resource Base
Table of contents

Multiple-File Processing

API Name Description
SetInput Sets an image source to provide images for consecutive processing.
GetInput Gets the attached image source adapter object of the capture vision router.
AddCaptureStateListener Adds an object that listens to the state changes of the capture process.
RemoveCaptureStateListener Removes an object which listens to the state changes of the capture process.
AddImageSourceStateListener Adds an object that listens to state changes of the image source.
RemoveImageSourceStateListener Removes an object which listens to state changes of the image source.
AddResultReceiver Adds an object as the receiver of captured results.
RemoveResultReceiver Removes an object which was added as a receiver of captured results.
AddResultFilter Adds an object as the filter of captured results.
RemoveResultFilter Removes an object which was added as a filter of captured results.
StartCapturing Starts to process images consecutively.
StopCapturing Stops the consecutive processing.
PauseCapturing Pauses the capture process. The current thread will be blocked until the capture process is resumed.
ResumeCapturing Resumes the capture process. The current thread will be unblocked after the capture process is resumed.

SetInput

Sets an image source to provide images for consecutive processing.

int SetInput(CImageSourceAdapter* pAdaptor);

Parameters

[in] pAdaptor Specifies an object which has implemented the Image Source Adapter Interface.

Return Value

Returns an error code. Zero indicates success.

Error Code Value Description
EC_CALL_REJECTED_WHEN_CAPTURING -10062 Function call is rejected when capturing in progress.

Code Snippet

int errorCode = 0;
char szErrorMsg[256];
errorCode = CLicenseManager::InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
CCaptureVisionRouter* router = new CCaptureVisionRouter();
CDirectoryFetcher* fetcher = new CDirectoryFetcher();
router->SetInput(fetcher);
//...
delete router;

See Also

CImageSourceAdapter

CDirectoryFetcher

CFileFetcher

GetInput

Gets the attached image source adapter object of the capture vision router.

CImageSourceAdapter* GetInput();

Return Value

Returns the attached image source adapter object of the capture vision router.

Code Snippet

int errorCode = 0;
char szErrorMsg[256];
errorCode = CLicenseManager::InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
CCaptureVisionRouter* router = new CCaptureVisionRouter();
CDirectoryFetcher* fetcher = new CDirectoryFetcher();
router->SetInput(fetcher);
CImageSourceAdapter* input = router->GetInput();
//...
delete router;

See Also

CImageSourceAdapter

CDirectoryFetcher

CFileFetcher

AddCaptureStateListener

Adds an object that listens to the state changes of the capture process.

int AddCaptureStateListener(CCaptureStateListener* listener);

Parameters

[in] listener Specifies a listening object of the type CCaptureStateListener to be added.

Return Value

Returns an error code. Zero indicates success.

Code Snippet

class MyCaptureStateListener: public CCaptureStateListener
{
public:
    void OnCaptureStateChanged(CaptureState state) {
        // user code...
    }
};
int errorCode = 0;
char szErrorMsg[256];
errorCode = CLicenseManager::InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
CCaptureVisionRouter* router = new CCaptureVisionRouter();
CCaptureStateListener* listener = new MyCaptureStateListener();
router->AddCaptureStateListener(listener);
//...
delete router;

See Also

CCaptureStateListener

RemoveCaptureStateListener

Removes an object which listens to the state changes of the capture process.

int RemoveCaptureStateListener(CCaptureStateListener* listener);

Parameters

[in] listener Specifies a listening object of the type CCaptureStateListener to be removed.

Return Value

Returns an error code. Zero indicates success.

Code Snippet

class MyCaptureStateListener: public CCaptureStateListener
{
public:
    void OnCaptureStateChanged(CaptureState state) {
        // user code...
    }
};
int errorCode = 0;
char szErrorMsg[256];
errorCode = CLicenseManager::InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
CCaptureVisionRouter* router = new CCaptureVisionRouter();
CCaptureStateListener* listener = new MyCaptureStateListener();
router->AddCaptureStateListener(listener);
//...
router->RemoveCaptureStateListener(listener);
delete router;

See Also

CCaptureStateListener

AddImageSourceStateListener

Adds an object that listens to state changes of the image source.

int AddImageSourceStateListener(CImageSourceStateListener* listener);

Parameters

[in] listener Specifies a listening object of the type CImageSourceStateListener to be added.

Return Value

Returns an error code. Zero indicates success.

Code Snippet

class CMyImageSourceStateListener: public CImageSourceStateListener
{
public:
    void OnImageSourceStateReceived(ImageSourceState state) {
        // user code...
    }
};
int errorCode = 0;
char szErrorMsg[256];
errorCode = CLicenseManager::InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
CCaptureVisionRouter* router = new CCaptureVisionRouter();
CImageSourceStateListener* listener = new CMyImageSourceStateListener();
router->AddImageSourceStateListener(listener);
//...
delete router;

See Also

CImageSourceStateListener

RemoveImageSourceStateListener

Removes an object which listens to state changes of the image source.

int RemoveImageSourceStateListener(CImageSourceStateListener* listener);

Parameters

[in] listener Specifies a listening object of the type CImageSourceStateListener to be removed.

Return Value

Returns an error code. Zero indicates success.

Code Snippet

class CMyImageSourceStateListener: public CImageSourceStateListener
{
public:
    void OnImageSourceStateReceived(ImageSourceState state) {
        // user code...
    }
};
int errorCode = 0;
char szErrorMsg[256];
errorCode = CLicenseManager::InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
CCaptureVisionRouter* router = new CCaptureVisionRouter();
CImageSourceStateListener* listener = new CMyImageSourceStateListener();
router->AddImageSourceStateListener(listener);
//...
router->RemoveImageSourceStateListener(listener);
delete router;

See Also

CImageSourceStateListener

AddResultReceiver

Adds an object as the receiver of captured results.

int AddResultReceiver(CCapturedResultReceiver* receiver);

Parameters

[in] receiver Specifies a receiver object of the type CCapturedResultReceiver to be added.

Return Value

Returns an error code. Zero indicates success.

Code Snippet

class MyResultReceiver: public CCapturedResultReceiver
{
public:
    void OnCapturedResultReceived(const CCapturedResult* result) {
        // user code...
    }
};
int errorCode = 0;
char szErrorMsg[256];
errorCode = CLicenseManager::InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
CCaptureVisionRouter* router = new CCaptureVisionRouter();
CCapturedResultReceiver* receiver = new MyResultReceiver();
router->AddResultReceiver(receiver);
//...
delete router;

See Also

CCapturedResultReceiver

RemoveResultReceiver

Removes an object which was added as a receiver of captured results.

int RemoveResultReceiver(CCapturedResultReceiver* receiver);

Parameters

[in] receiver Specifies a receiver object of the type CCapturedResultReceiver to be removed.

Return Value

Returns an error code. Zero indicates success.

Code Snippet

class MyResultReceiver: public CCapturedResultReceiver
{
public:
    void OnCapturedResultReceived(const CCapturedResult* result) {
        // user code...
    }
};
int errorCode = 0;
char szErrorMsg[256];
errorCode = CLicenseManager::InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
CCaptureVisionRouter* router = new CCaptureVisionRouter();
CCapturedResultReceiver* receiver = new MyResultReceiver();
router->AddResultReceiver(receiver);
//...
router->RemoveResultReceiver(receiver);
delete router;

See Also

CCapturedResultReceiver

AddResultFilter

Adds an object as the filter of captured results.

int AddResultFilter(CCapturedResultFilter* filter);

Parameters

[in] filter Specifies a filter object of the type CCapturedResultFilter to be added.

Return Value

Returns an error code. Zero indicates success.

Code Snippet

int errorCode = 0;
char szErrorMsg[256];
errorCode = CLicenseManager::InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
CCaptureVisionRouter* router = new CCaptureVisionRouter();
CCapturedResultFilter* filter = new CMultiFrameResultCrossFilter();
router->AddResultFilter(filter);
//...
delete router;

See Also

CCapturedResultFilter

RemoveResultFilter

Removes an object which was added as a filter of captured results.

int RemoveResultFilter(CCapturedResultFilter* filter);

Parameters

[in] filter Specifies a filter object of the type CCapturedResultFilter to be removed.

Return Value

Returns an error code. Zero indicates success.

Code Snippet

int errorCode = 0;
char szErrorMsg[256];
errorCode = CLicenseManager::InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
CCaptureVisionRouter* router = new CCaptureVisionRouter();
CCapturedResultFilter* filter = new CMultiFrameResultCrossFilter();
router->AddResultFilter(filter);
//...
router->RemoveResultFilter(filter);
delete router;

See Also

CCapturedResultFilter

StartCapturing

Starts to process images consecutively.

int StartCapturing(const char* templateName = "", bool waitForThreadExit = false, char errorMsgBuffer[]=NULL, const int errorMsgBufferLen=0);

Parameters

[in] templateName Specifies a template to use for capturing. If not specified, an empty string is used which means the factory default template.

[in] waitForThreadExit Indicates whether to wait for the capture process to complete before returning. The default value is false.

[out] errorMsgBuffer Stores any error messages generated during the capturing process. If no buffer is provided, the error messages will not be output.

[in] errorMsgBufferLen Specifies the length of the provided error message buffer. If no buffer is provided, this parameter is ignored.

Return Value

The function returns an integer value representing the success or failure of the capturing process. A value of 0 indicates success, while a non-zero value indicates failure. If an error message buffer is provided, any error messages generated during the capturing process will be stored in the buffer.

Error Code Value Description
EC_TEMPLATE_NAME_INVALID -10036 The target template name is invalid.
EC_CALL_REJECTED_WHEN_CAPTURING -10062 Function call is rejected when capturing in progress.
EC_NO_IMAGE_SOURCE -10063 Can not start capturing before you set the input.

Code Snippet

int errorCode = 0;
char szErrorMsg[256];
errorCode = CLicenseManager::InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
CCaptureVisionRouter* router = new CCaptureVisionRouter();
router->StartCapturing("myTemplate", true, szErrorMsg, 256);
//...
delete router;

StopCapturing

Stops the multiple-file processing.

void StopCapturing(bool waitForRemainingTasks = true, bool waitForThreadExit = false);

Parameters

[in] waitForRemainingTasks Indicates whether to wait for the remaining tasks to complete before returning. The default value is true.
[in] waitForThreadExit Indicates whether to wait for the capture process to complete before returning. The default value is false.

Code Snippet

int errorCode = 0;
char szErrorMsg[256];
errorCode = CLicenseManager::InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256);
CCaptureVisionRouter* router = new CCaptureVisionRouter();
char szErrorMsg2[256];
router->StartCapturing("myTemplate", true, szErrorMsg2, 256);
//...
router->StopCapturing(true);
delete router;

PauseCapturing

Pauses the capture process. The current thread will be blocked until the capture process is resumed.

void PauseCapturing();

ResumeCapturing

Resumes the capture process. The current thread will be unblocked after the capture process is resumed.

void ResumeCapturing();

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

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