|
|
|
@ -140,7 +140,7 @@ CPhoneDevice::CPhoneCamera::CPhoneCamera(CPhoneDevice* dev, int32_t width, int32
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CPhoneDevice::CPhoneCamera::on_image(const cv::Mat& rgb)
|
|
|
|
|
bool CPhoneDevice::CPhoneCamera::on_image(cv::Mat& rgb)
|
|
|
|
|
{
|
|
|
|
|
if (m_dev != NULL)
|
|
|
|
|
{
|
|
|
|
@ -613,6 +613,7 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<
|
|
|
|
|
params.autoExposure = mPhotoInfo.autoExposure;
|
|
|
|
|
params.exposureTime = mPhotoInfo.exposureTime;
|
|
|
|
|
params.sensibility = mPhotoInfo.sensibility;
|
|
|
|
|
params.orientation = mPhotoInfo.orientation;
|
|
|
|
|
|
|
|
|
|
mCamera = new CPhoneCamera(this, photoInfo.width, photoInfo.height, params);
|
|
|
|
|
if (mCamera->open(to_string(mPhotoInfo.cameraId).c_str()) == 0)
|
|
|
|
@ -648,7 +649,7 @@ void CPhoneDevice::CloseCamera2(CPhoneDevice::CPhoneCamera* camera)
|
|
|
|
|
delete camera;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CPhoneDevice::OnImageReady(const cv::Mat& mat)
|
|
|
|
|
bool CPhoneDevice::OnImageReady(cv::Mat& mat)
|
|
|
|
|
{
|
|
|
|
|
mPhotoInfo.photoTime = time(NULL);
|
|
|
|
|
int baseline = 0;
|
|
|
|
@ -713,15 +714,15 @@ bool CPhoneDevice::OnImageReady(const cv::Mat& mat)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vector <int> compression_params;
|
|
|
|
|
compression_params.push_back(cv::IMWRITE_JPEG_QUALITY);
|
|
|
|
|
compression_params.push_back(mPhotoInfo.quality);
|
|
|
|
|
vector <int> params;
|
|
|
|
|
params.push_back(cv::IMWRITE_JPEG_QUALITY);
|
|
|
|
|
params.push_back(mPhotoInfo.quality);
|
|
|
|
|
|
|
|
|
|
bool res = false;
|
|
|
|
|
std::string fullPath = mPath + CTerminal::BuildPhotoFileName(mPhotoInfo);
|
|
|
|
|
if (!std::filesystem::exists(std::filesystem::path(fullPath)))
|
|
|
|
|
{
|
|
|
|
|
bool res = cv::imwrite(fullPath.c_str(), mat, compression_params);
|
|
|
|
|
bool res = cv::imwrite(fullPath.c_str(), mat, params);
|
|
|
|
|
if (!res)
|
|
|
|
|
{
|
|
|
|
|
ALOGE("Failed to write photo: %s", fullPath.c_str());
|
|
|
|
|