注册分辨率加入分辨率读取。

This commit is contained in:
luocai 2024-08-12 10:20:37 +08:00
parent 928326efb2
commit 219c68ea45
2 changed files with 6 additions and 4 deletions

View File

@ -215,7 +215,7 @@ void Application::enrollExtended(const QString &username, bool persistence, uint
void Application::uploadImage(const QString &path, int operation) { void Application::uploadImage(const QString &path, int operation) {
m_uploadImageSendedSize = 0; m_uploadImageSendedSize = 0;
ModuleCommunication::UploadImageInformation request;
if (path.endsWith(".jpg")) { if (path.endsWith(".jpg")) {
auto image = ImageDecoder::extractJpegYComponent(path.toStdString()); auto image = ImageDecoder::extractJpegYComponent(path.toStdString());
if (!image) { if (!image) {
@ -224,18 +224,21 @@ void Application::uploadImage(const QString &path, int operation) {
} }
m_uploadBuffer = image->data; m_uploadBuffer = image->data;
LOG(info) << "width: " << image->width << ", height: " << image->height; LOG(info) << "width: " << image->width << ", height: " << image->height;
request.width = image->width;
request.height = image->height;
} else if (path.endsWith(".yuv")) { } else if (path.endsWith(".yuv")) {
std::ifstream ifs(Amass::StringUtility::UTF8ToGBK(path.toStdString()), std::ofstream::binary); std::ifstream ifs(Amass::StringUtility::UTF8ToGBK(path.toStdString()), std::ofstream::binary);
m_uploadBuffer = std::vector<uint8_t>((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>()); m_uploadBuffer = std::vector<uint8_t>((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
if (m_uploadBuffer.empty()) { if (m_uploadBuffer.empty()) {
LOG(error) << "file is empty."; LOG(error) << "file is empty.";
} }
request.width = 600;
request.height = 800;
} else { } else {
LOG(error) << "not supported format."; LOG(error) << "not supported format.";
return; return;
} }
ModuleCommunication::UploadImageInformation request;
mbedtls_md5_context context; mbedtls_md5_context context;
mbedtls_md5_init(&context); mbedtls_md5_init(&context);
mbedtls_md5_starts(&context); mbedtls_md5_starts(&context);
@ -244,8 +247,6 @@ void Application::uploadImage(const QString &path, int operation) {
mbedtls_md5_free(&context); mbedtls_md5_free(&context);
request.operation = operation; request.operation = operation;
request.width = 600;
request.height = 800;
request.size = m_uploadBuffer.size(); request.size = m_uploadBuffer.size();
strncpy(request.username, "下发测试", sizeof(request.username)); strncpy(request.username, "下发测试", sizeof(request.username));
m_communication->uploadImageInfo(request); m_communication->uploadImageInfo(request);

View File

@ -61,6 +61,7 @@ public:
Failed4ReadFile = 19, Failed4ReadFile = 19,
Failed4WriteFile = 20, Failed4WriteFile = 20,
Failed4NoEncrypt = 21, Failed4NoEncrypt = 21,
PalmNotDetected = 23,
Needmore = 25, Needmore = 25,
}; };