ENVIRONMENT
C++ in MFC using namespace Vieworks::vivix,
Instance : CVivixSDK vivixSDK; CDetector* detectorIns;
C# in Winform using Vieworks.vivix.net, using Vieworks.vivix.net.detector; using Vieworks.vivix.net.scu;
Instance: VivixNet netSDK; DETECTOR_INFO DetInfo;Detector detectorIns;
DISCRIPTION
Offsetcalibration process is needed too much API. but you can perform offset calibration simply by offsetrefresh API, but offsetrefresh can be performed after performing offset calibration or being loaded
C++
void CSDKCplusExampleApp::TestOffsetrefresh(int count)
{
RESULT nResult;
if (detectorIns != NULL)
{
detectorIns->SetNotifyCalibrationOffsetRefreshStep(NotifyCalibrationOffsetRefreshStep);
detectorIns->SetNotifyCalibrationOffsetRefreshResult(NotifyCalibrationOffsetRefreshResult);
nResult = detectorIns->OffsetRefresh(count);
if (nResult == Vieworks::vivix::RESULT::RESULT_SUCCESS)
{
// Succeeded to start offset refresh.
}
else
{
// Failed to start offset refresh.
}
}
}
void CSDKCplusExampleApp::NotifyCalibrationOffsetRefreshStep(Vieworks::vivix::DETECTOR_ID id, unsigned int stage, float avgValue, Vieworks::vivix::IMAGE_INFO* image)
{
}
void CSDKCplusExampleApp::NotifyCalibrationOffsetRefreshResult(DETECTOR_ID id, OFFSET_REFRESH_STATUS status)
{
switch (status)
{
case OFFSET_REFRESH_STATUS::OFFSET_REFRESH_DONE:
// Succeeded to refresh offset.
break;
default:
// Failed to refresh offset.
break;
}
}
C#
public void TestOffsetRefresh(int count)
{
if (detector != null)
{
detector.SetDelegateCalibrationOffsetRefreshStep(OnDelegateCalibrationOffsetRefreshStep);
detector.SetDelegateCalibrationOffsetRefreshResult(OnDelegateCalibrationOffsetRefreshResult);
result = detector.OffsetRefresh(count);
if (result == RESULT.RESULT_SUCCESS)
{
// Succeeded to start offset refresh.
}
else
{
// Failed to start offset refresh.
}
}
}
public void OnDelegateCalibrationOffsetRefreshStep(int id, uint stage, float avgValue, IMAGE_INFO image)
{
}
public void OnDelegateCalibrationOffsetRefreshResult(int id, OFFSET_REFRESH_STATUS status)
{
switch (status)
{
case OFFSET_REFRESH_STATUS.OFFSET_REFRESH_DONE:
// Succeeded to refresh offset.
break;
default:
// Failed to refresh offset.
break;
}
}