上传废弃的照片(设置为不同的预置位)

master
Matthew 10 months ago
parent 913e9db795
commit 81a413b025

@ -1497,59 +1497,6 @@ bool CPhoneDevice::OnImageReady(cv::Mat& mat)
NdkCamera::CAPTURE_RESULT captureResult = mCamera->getCaptureResult();
#if 0
if (captureResult.avgY < 25 && mPhotoInfo.autoExposure != 0)
{
// Take another photo
CPhoneDevice* pThis = this;
std::string path = mPath;
IDevice::PHOTO_INFO photoInfo = mPhotoInfo;
std::vector<IDevice::OSD_INFO> osds = mOsds;
photoInfo.photoId += 1;
photoInfo.autoExposure = 0;
if (captureResult.avgY == 0)
{
photoInfo.exposureTime = 600000000;
photoInfo.sensitivity = 2500;
}
else if (captureResult.avgY <= 6)
{
photoInfo.exposureTime = captureResult.exposureTime * 150 / captureResult.avgY;
photoInfo.sensitivity = photoInfo.sensitivity * 80 / captureResult.avgY;
if (photoInfo.sensitivity < captureResult.sensitivity)
{
photoInfo.sensitivity = captureResult.sensitivity;
}
else if (photoInfo.sensitivity > 3000)
{
photoInfo.sensitivity = 3000;
}
}
else
{
photoInfo.exposureTime = captureResult.exposureTime * 120 / captureResult.avgY;
photoInfo.sensitivity = photoInfo.sensitivity * 60 / captureResult.avgY;
if (photoInfo.sensitivity < captureResult.sensitivity)
{
photoInfo.sensitivity = captureResult.sensitivity;
}
else if (photoInfo.sensitivity > 3000)
{
photoInfo.sensitivity = 3000;
}
}
std::thread t([=]
{
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
pThis->TakePhoto(photoInfo, osds, path);
});
t.detach();
}
#endif // 0
char extimeunit[4] = { 0 };
unsigned int extime = (captureResult.exposureTime >= 1000000) ? ((unsigned int)(captureResult.exposureTime / 1000000)) : ((unsigned int)(captureResult.exposureTime / 1000));
strcpy(extimeunit, (captureResult.exposureTime >= 1000000) ? "ms" : "μs");
@ -1640,16 +1587,24 @@ bool CPhoneDevice::OnImageReady(cv::Mat& mat)
#ifdef OUTPUT_CAMERA_DBG_INFO
bool shouldRetry = false;
if (captureResult.avgY > 230 || captureResult.avgY < 25)
if (captureResult.avgY > MAX_LIGHT_Y || captureResult.avgY < MIN_LIGHT_Y)
{
if (mPhotoInfo.retries < (DEFAULT_TAKE_PHOTO_RETRIES - 1))
{
shouldRetry = true;
replaceAll(fullPath, ".jpg", std::string("-") + std::to_string(mPhotoInfo.retries) + ".jpg");
replaceAll(fullPath, "/photos/", "/sentPhotos/");
// replaceAll(fullPath, ".jpg", std::string("-") + std::to_string(mPhotoInfo.retries) + ".jpg");
replaceAll(fullPath, "_FF_", std::to_string(mPhotoInfo.retries));
XYLOG(XYLOG_SEVERITY_ERROR, "Photo is TOO dark or light(LDR=%u), will RETRY it", (uint32_t)captureResult.avgY);
}
if (captureResult.avgY > MAX_LIGHT_Y)
{
mPhotoInfo.compensation = -2 * ((int16_t)((uint16_t)captureResult.avgY));
}
else
{
mPhotoInfo.compensation = 2 * captureResult.avgY;
}
}
#endif // OUTPUT_CAMERA_DBG_INFO

Loading…
Cancel
Save