空图片的保护处理

nx2024
Matthew 4 months ago
parent e1e4a61443
commit 25c42a891b

@ -1599,6 +1599,10 @@ void visualize(const char* filename, const ncnn::Mat& m)
void DrawOutlineText(cv::Ptr<cv::ft::FreeType2> ft2, cv::Mat& mat, const std::string& str, cv::Point startPoint, int fontSize, cv::Scalar clr, int thickness) void DrawOutlineText(cv::Ptr<cv::ft::FreeType2> ft2, cv::Mat& mat, const std::string& str, cv::Point startPoint, int fontSize, cv::Scalar clr, int thickness)
{ {
if (mat.empty())
{
return;
}
std::vector<std::string> lines = split(str, "\n"); std::vector<std::string> lines = split(str, "\n");
int lineHeight = 0; int lineHeight = 0;
cv::Point pt = startPoint; cv::Point pt = startPoint;
@ -1672,6 +1676,12 @@ bool CPhoneDevice::onOneCapture(std::shared_ptr<ACameraMetadata> characteristics
closeThread.detach(); closeThread.detach();
} }
if (rgb.empty())
{
TakePhotoCb(0, photoInfo, "", takingTime);
return true;
}
CPhoneDevice* pThis = this; CPhoneDevice* pThis = this;
std::thread th([pThis, characteristics, result, photoInfo, osds, path, rgb, facing, sensorOrientation, ldr, duration, takingTime]()mutable std::thread th([pThis, characteristics, result, photoInfo, osds, path, rgb, facing, sensorOrientation, ldr, duration, takingTime]()mutable
{ {
@ -2039,11 +2049,20 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr<ACameraMetadata> characteristi
} }
cv::cvtColor(rgb, rgb, cv::COLOR_RGB2BGR); cv::cvtColor(rgb, rgb, cv::COLOR_RGB2BGR);
#endif // USING_EXEC_HDRP #endif // USING_EXEC_HDRP
if (rgb.empty())
{
pThis->TakePhotoCb(0, photoInfo, path, takingTime);
}
else
{
bool res = pThis->PostProcessPhoto(photoInfo, osds, path, cameraInfo, rgb); bool res = pThis->PostProcessPhoto(photoInfo, osds, path, cameraInfo, rgb);
if (res) if (res)
{ {
// TakePhotoCb(2, photoInfo, path, takingTime); // TakePhotoCb(2, photoInfo, path, takingTime);
} }
}
}); });
th.detach(); th.detach();
@ -2348,11 +2367,19 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr<ACameraMetadata> characteristi
cv::cvtColor(rgb, rgb, cv::COLOR_RGB2BGR); cv::cvtColor(rgb, rgb, cv::COLOR_RGB2BGR);
} }
if (rgb.empty())
{
pThis->TakePhotoCb(0, photoInfo, path, takingTime);
}
else
{
bool res = pThis->PostProcessPhoto(photoInfo, osds, path, cameraInfo, rgb); bool res = pThis->PostProcessPhoto(photoInfo, osds, path, cameraInfo, rgb);
if (res) if (res)
{ {
// TakePhotoCb(2, photoInfo, path, takingTime); // TakePhotoCb(2, photoInfo, path, takingTime);
} }
}
}); });
th.detach(); th.detach();

Loading…
Cancel
Save