|
|
@ -1241,6 +1241,41 @@ bool CPhoneDevice::OnImageReady(cv::Mat& mat)
|
|
|
|
cv::Scalar scalarRed(0, 0, 255); // red
|
|
|
|
cv::Scalar scalarRed(0, 0, 255); // red
|
|
|
|
|
|
|
|
|
|
|
|
NdkCamera::CAPTURE_RESULT captureResult = mCamera->getCaptureResult();
|
|
|
|
NdkCamera::CAPTURE_RESULT captureResult = mCamera->getCaptureResult();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 = 400;
|
|
|
|
|
|
|
|
photoInfo.sensitivity = 2000;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
photoInfo.exposureTime = captureResult.exposureTime / 100000 * 120 / captureResult.avgY;
|
|
|
|
|
|
|
|
photoInfo.sensitivity = photoInfo.sensitivity * 60 / captureResult.avgY;
|
|
|
|
|
|
|
|
if (photoInfo.sensitivity > 2000)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
photoInfo.sensitivity = 2000;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::thread t([=]
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
|
|
|
|
|
|
|
pThis->TakePhoto(photoInfo, osds, path);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t.detach();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char extimeunit[4] = { 0 };
|
|
|
|
char extimeunit[4] = { 0 };
|
|
|
|
unsigned int extime = (captureResult.exposureTime >= 1000000) ? ((unsigned int)(captureResult.exposureTime / 1000000)) : ((unsigned int)(captureResult.exposureTime / 1000));
|
|
|
|
unsigned int extime = (captureResult.exposureTime >= 1000000) ? ((unsigned int)(captureResult.exposureTime / 1000000)) : ((unsigned int)(captureResult.exposureTime / 1000));
|
|
|
|
strcpy(extimeunit, (captureResult.exposureTime >= 1000000) ? "ms" : "ns");
|
|
|
|
strcpy(extimeunit, (captureResult.exposureTime >= 1000000) ? "ms" : "ns");
|
|
|
|