From 89b390115fa36dd0785bb19b9f1dbe3cdfd964d8 Mon Sep 17 00:00:00 2001 From: user_ch-ml <1303079376@qq.com> Date: 星期四, 26 六月 2025 15:34:45 +0800 Subject: [PATCH] Merge branch 'master' of ssh://115.28.86.8:29418/~admin/智能网联_25-0305_617_v1 --- Server/汪卫军/code/ImageStorage.h | 17 ++++++++ /dev/null | 0 Server/刘斌/log/日志_刘斌_20250625.doc | 0 Server/汪卫军/code/ImageStorage.cpp | 54 +++++++++++++++++++++++++++ Client/牛彦江/log/日志_牛彦江_250625.doc | 0 5 files changed, 71 insertions(+), 0 deletions(-) diff --git "a/Client/\347\211\233\345\275\246\346\261\237/log/\346\227\245\345\277\227_\347\211\233\345\275\246\346\261\237_250625.doc" "b/Client/\347\211\233\345\275\246\346\261\237/log/\346\227\245\345\277\227_\347\211\233\345\275\246\346\261\237_250625.doc" new file mode 100644 index 0000000..f21c8c4 --- /dev/null +++ "b/Client/\347\211\233\345\275\246\346\261\237/log/\346\227\245\345\277\227_\347\211\233\345\275\246\346\261\237_250625.doc" Binary files differ diff --git "a/Server/\345\210\230\346\226\214/log/~$_\345\210\230\346\226\214_20250623.doc" "b/Server/\345\210\230\346\226\214/log/~$_\345\210\230\346\226\214_20250623.doc" deleted file mode 100644 index d372c3b..0000000 --- "a/Server/\345\210\230\346\226\214/log/~$_\345\210\230\346\226\214_20250623.doc" +++ /dev/null Binary files differ diff --git "a/Server/\345\210\230\346\226\214/log/\346\227\245\345\277\227_\345\210\230\346\226\214_20250625.doc" "b/Server/\345\210\230\346\226\214/log/\346\227\245\345\277\227_\345\210\230\346\226\214_20250625.doc" new file mode 100644 index 0000000..ca18304 --- /dev/null +++ "b/Server/\345\210\230\346\226\214/log/\346\227\245\345\277\227_\345\210\230\346\226\214_20250625.doc" Binary files differ diff --git "a/Server/\346\261\252\345\215\253\345\206\233/code/ImageStorage.cpp" "b/Server/\346\261\252\345\215\253\345\206\233/code/ImageStorage.cpp" new file mode 100644 index 0000000..b43bc2e --- /dev/null +++ "b/Server/\346\261\252\345\215\253\345\206\233/code/ImageStorage.cpp" @@ -0,0 +1,54 @@ +// ImageStorage.cpp - 照片存储模块实现 +#include "stdafx.h" +#include "ImageStorage.h" +#include <fstream> +#include <opencv2/opencv.hpp> + +ImageStorage::ImageStorage() {} + +ImageStorage::~ImageStorage() {} + +bool ImageStorage::SaveImage(const std::string& filePath, const unsigned char* imageData, + int width, int height) { + try { + // 创建OpenCV图像 + cv::Mat image(height, width, CV_8UC3, const_cast<unsigned char*>(imageData)); + + // 保存图像 + return cv::imwrite(filePath, image); + } + catch (const std::exception& e) { + std::cerr << "保存图像失败: " << e.what() << std::endl; + return false; + } +} + +bool ImageStorage::LoadImage(const std::string& filePath, unsigned char*& imageData, + int& width, int& height) const { + try { + // 加载图像 + cv::Mat image = cv::imread(filePath, cv::IMREAD_COLOR); + + if (image.empty()) { + return false; + } + + // 分配内存并复制数据 + width = image.cols; + height = image.rows; + size_t dataSize = width * height * 3; + + imageData = new unsigned char[dataSize]; + memcpy(imageData, image.data, dataSize); + + return true; + } + catch (const std::exception& e) { + std::cerr << "加载图像失败: " << e.what() << std::endl; + return false; + } +} + +bool ImageStorage::DeleteImage(const std::string& filePath) { + return (remove(filePath.c_str()) == 0); +} \ No newline at end of file diff --git "a/Server/\346\261\252\345\215\253\345\206\233/code/ImageStorage.h" "b/Server/\346\261\252\345\215\253\345\206\233/code/ImageStorage.h" new file mode 100644 index 0000000..3b754d6 --- /dev/null +++ "b/Server/\346\261\252\345\215\253\345\206\233/code/ImageStorage.h" @@ -0,0 +1,17 @@ +// ImageStorage.h - 照片存储模块 +#pragma once +#include <string> +#include <vector> +#include "FaceImageManager.h" + +class ImageStorage { +public: + ImageStorage(); + ~ImageStorage(); + + bool SaveImage(const std::string& filePath, const unsigned char* imageData, + int width, int height); + bool LoadImage(const std::string& filePath, unsigned char*& imageData, + int& width, int& height) const; + bool DeleteImage(const std::string& filePath); +}; \ No newline at end of file diff --git "a/Server/\346\261\252\345\215\253\345\206\233/code/\351\234\200\346\261\202\345\210\206\346\236\220\346\226\207\346\241\243.doc" "b/Server/\346\261\252\345\215\253\345\206\233/code/\351\234\200\346\261\202\345\210\206\346\236\220\346\226\207\346\241\243.doc" deleted file mode 100644 index f4b04c3..0000000 --- "a/Server/\346\261\252\345\215\253\345\206\233/code/\351\234\200\346\261\202\345\210\206\346\236\220\346\226\207\346\241\243.doc" +++ /dev/null Binary files differ -- Gitblit v1.8.0