SysAssertf(__pQrCodeRecognizerImpl != null, "Not yet constructed! Consruct() should be called before use.");
SysTryReturn(NID_UIX, width > 0 && height > 0, false, E_INVALID_ARG,
- "raw pointer must not be null. [E_INVALID_ARG]");
+ "width and height must be greater then 0. [E_INVALID_ARG]");
return __pQrCodeRecognizerImpl->SetFrameSize(width, height) ? E_SUCCESS : E_FAILURE;
}
{
SysAssertf(__pQrCodeRecognizerImpl != null, "Not yet constructed! Consruct() should be called before use.");
- static float array[4] = {0.f};
+ static int array[4] = {0};
result r = __pQrCodeRecognizerImpl->GetROI(array) ? E_SUCCESS : E_FAILURE;
if (r == E_SUCCESS)
}
bool
-_QrCodeRecognizerImpl::SetFrameSize(unsigned int width, unsigned int height)
+_QrCodeRecognizerImpl::SetFrameSize(int width, int height)
{
+ __width = width;
+ __height = height;
return __qrCodeRecognizer.setFrameSize(width, height);
}
}
bool
-_QrCodeRecognizerImpl::GetROI(float* roi)
+_QrCodeRecognizerImpl::GetROI(int* roi)
{
- return __qrCodeRecognizer.getROI(roi);
+
+ static float array[4] = {0.};
+ result r = __qrCodeRecognizer.getROI(array) ? E_SUCCESS : E_FAILURE;
+
+ if (E_SUCCESS == r)
+ {
+ roi[0] = ((1. + array[0]) / 2.) * __width;
+ roi[1] = ((1. + array[1]) / 2.) * __height;
+ roi[2] = ((1. + array[2]) / 2.) * __width;
+ roi[3] = ((1. + array[3]) / 2.) * __height;
+ }
+
+ return E_SUCCESS == r;
}
void
_QrCodeRecognizerImpl(void);
~_QrCodeRecognizerImpl(void);
- bool SetFrameSize(unsigned int width, unsigned int height);
+ bool SetFrameSize(int width, int height);
bool ProcessFrame(const unsigned char* raw);
- bool GetROI(float* roi);
+ bool GetROI(int* roi);
void SetSceneTransform(const float* left, const float* right);
void FillObjectStorage(void);
_QrCodeRecognizerImpl& operator=(const _QrCodeRecognizerImpl&); ///< Forbides assignment operator.
QrCodeObject* __objectStorage;
int __objectStorageSize;
+ int __width;
+ int __height;
sari2::QRCodeRecognizer __qrCodeRecognizer;
};