|
|
|
@ -1719,30 +1719,41 @@ bool CPhoneDevice::OnImageReady(cv::Mat& mat)
|
|
|
|
|
#ifdef OUTPUT_CAMERA_DBG_INFO
|
|
|
|
|
|
|
|
|
|
bool shouldRetry = false;
|
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
|
|
if (captureResult.avgY > MAX_LIGHT_Y || captureResult.avgY < MIN_LIGHT_Y)
|
|
|
|
|
{
|
|
|
|
|
if (mPhotoInfo.retries < (DEFAULT_TAKE_PHOTO_RETRIES - 1))
|
|
|
|
|
{
|
|
|
|
|
shouldRetry = true;
|
|
|
|
|
char presetBuf[16] = { 0 };
|
|
|
|
|
snprintf(presetBuf, sizeof(presetBuf), "%02X", mPhotoInfo.retries);
|
|
|
|
|
// replaceAll(fullPath, ".jpg", std::string("-") + std::to_string(mPhotoInfo.retries) + ".jpg");
|
|
|
|
|
replaceAll(fullPath, "_FF_", std::string("_") + presetBuf + std::string("_"));
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_ERROR, "Photo is TOO dark or light(LDR=%u), will RETRY it", (uint32_t)captureResult.avgY);
|
|
|
|
|
}
|
|
|
|
|
if (mCamera != NULL) {
|
|
|
|
|
NdkCamera::CAPTURE_RESULT captureResult = mCamera->getCaptureResult();
|
|
|
|
|
|
|
|
|
|
if (captureResult.avgY > MAX_LIGHT_Y)
|
|
|
|
|
if (captureResult.avgY < MIN_LIGHT_Y)
|
|
|
|
|
{
|
|
|
|
|
mPhotoInfo.compensation = -2 * ((int16_t)((uint16_t)captureResult.avgY));
|
|
|
|
|
if (mPhotoInfo.retries < (DEFAULT_TAKE_PHOTO_RETRIES - 1))
|
|
|
|
|
{
|
|
|
|
|
shouldRetry = true;
|
|
|
|
|
char presetBuf[16] = {0};
|
|
|
|
|
snprintf(presetBuf, sizeof(presetBuf), "%02X", mPhotoInfo.retries);
|
|
|
|
|
// replaceAll(fullPath, ".jpg", std::string("-") + std::to_string(mPhotoInfo.retries) + ".jpg");
|
|
|
|
|
replaceAll(fullPath, "_FF_", std::string("_") + presetBuf + std::string("_"));
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_ERROR, "Photo is TOO dark or light(LDR=%u), will RETRY it",
|
|
|
|
|
(uint32_t) captureResult.avgY);
|
|
|
|
|
|
|
|
|
|
mPhotoInfo.usingRawFormat = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
else if (captureResult.avgY > MAX_LIGHT_Y)
|
|
|
|
|
{
|
|
|
|
|
mPhotoInfo.compensation = 2 * captureResult.avgY;
|
|
|
|
|
if (mPhotoInfo.retries < (DEFAULT_TAKE_PHOTO_RETRIES - 1))
|
|
|
|
|
{
|
|
|
|
|
shouldRetry = true;
|
|
|
|
|
char presetBuf[16] = {0};
|
|
|
|
|
snprintf(presetBuf, sizeof(presetBuf), "%02X", mPhotoInfo.retries);
|
|
|
|
|
// replaceAll(fullPath, ".jpg", std::string("-") + std::to_string(mPhotoInfo.retries) + ".jpg");
|
|
|
|
|
replaceAll(fullPath, "_FF_", std::string("_") + presetBuf + std::string("_"));
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_ERROR, "Photo is TOO dark or light(LDR=%u), will RETRY it",
|
|
|
|
|
(uint32_t) captureResult.avgY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mPhotoInfo.compensation = -2 * ((int16_t) ((uint16_t) captureResult.avgY));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif // OUTPUT_CAMERA_DBG_INFO
|
|
|
|
|
|
|
|
|
|
if (!std::filesystem::exists(std::filesystem::path(fullPath)))
|
|
|
|
|