备份
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.14.0)
|
||||
project(handdleai VERSION 0.1.0)
|
||||
string(TIMESTAMP RUN_TIME)
|
||||
message( " project start : " ${RUN_TIME})
|
||||
|
||||
add_compile_definitions(NOMINMAX)
|
||||
|
||||
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
|
||||
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
|
||||
|
||||
@@ -100,18 +100,6 @@ static cv::Mat qImageToCvMat(const QImage& inImage)
|
||||
}
|
||||
return cv::Mat();
|
||||
}
|
||||
template<typename T>
|
||||
T getMax(const T& a, const T& b) {
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
template<typename T>
|
||||
T getMin(const T& a, const T& b) {
|
||||
return (a < b) ? a : b;
|
||||
}
|
||||
template<typename T>
|
||||
T getAbs(const T& value) {
|
||||
return (value < 0) ? -value : value;
|
||||
}
|
||||
static void cvMatToQPixMap(cv::Mat& src,QPixmap& pixmap)
|
||||
{
|
||||
pixmap = QPixmap::fromImage(cvMatToQImage(src));
|
||||
|
||||
+10
-10
@@ -88,16 +88,16 @@ static cv::Mat cutImg2Cls(cv::Rect boundingBox, cv::Mat imgInput, cv::Size targe
|
||||
|
||||
// 以目标框中心为正方形中心,边长为 max(max(w,h),128)
|
||||
const cv::Point mid(boundingBox.x + boundingBox.width / 2, boundingBox.y + boundingBox.height / 2);
|
||||
const int sideLength = getMax(getMax(boundingBox.width, boundingBox.height), 128);
|
||||
const int sideLength = std::max(std::max(boundingBox.width, boundingBox.height), 128);
|
||||
|
||||
// 期望在原图上的 ROI(可能越界)
|
||||
cv::Rect expectRect(mid.x - sideLength / 2, mid.y - sideLength / 2, sideLength, sideLength);
|
||||
|
||||
// 计算需要的边界填充(反射填充)
|
||||
const int left = getMax(0, -expectRect.x);
|
||||
const int top = getMax(0, -expectRect.y);
|
||||
const int right = getMax(0, expectRect.x + expectRect.width - imgInput.cols);
|
||||
const int bottom = getMax(0, expectRect.y + expectRect.height - imgInput.rows);
|
||||
const int left = std::max(0, -expectRect.x);
|
||||
const int top = std::max(0, -expectRect.y);
|
||||
const int right = std::max(0, expectRect.x + expectRect.width - imgInput.cols);
|
||||
const int bottom = std::max(0, expectRect.y + expectRect.height - imgInput.rows);
|
||||
|
||||
cv::Mat padded;
|
||||
if (left || top || right || bottom) {
|
||||
@@ -126,7 +126,7 @@ static std::vector<cv::Mat> cutImg2ClsVec(cv::Rect boundingBox, cv::Mat imgInput
|
||||
|
||||
const int w = boundingBox.width;
|
||||
const int h = boundingBox.height;
|
||||
const int minSide = getMin(w, h);
|
||||
const int minSide = std::min(w, h);
|
||||
if (minSide <= 0) {
|
||||
std::cerr << "Bounding box has zero width or height." << std::endl;
|
||||
return result;
|
||||
@@ -622,7 +622,7 @@ static cv::Rect doMatchTemplate(const cv::Mat& templateImg, const cv::Mat& srcIm
|
||||
static bool isContoursOverlap(const std::vector<cv::Point>& contour1, const std::vector<cv::Point>& contour2, double thresholdPercent = 0) {
|
||||
cv::Rect rect1 = cv::boundingRect(contour1);
|
||||
cv::Rect rect2 = cv::boundingRect(contour2);
|
||||
cv::Size tempImgSize(getMax(rect1.x + rect1.width, rect2.x + rect2.width), getMax(rect1.y + rect1.height, rect2.y + rect2.height));
|
||||
cv::Size tempImgSize(std::max(rect1.x + rect1.width, rect2.x + rect2.width), std::max(rect1.y + rect1.height, rect2.y + rect2.height));
|
||||
cv::Mat binaryImage = cv::Mat::zeros(tempImgSize, CV_8U);
|
||||
|
||||
// 画出目标轮廓
|
||||
@@ -651,7 +651,7 @@ static bool isRectOverlap(const cv::Rect& rect1, const cv::Rect& rect2, double t
|
||||
cv::Rect intersection = rect1 & rect2;
|
||||
if (thresholdPercent != 0)//如果有阈值
|
||||
{
|
||||
int maxCnotourArea = getMax(rect1.area(), rect2.area());
|
||||
int maxCnotourArea = std::max(rect1.area(), rect2.area());
|
||||
if (intersection.area() / maxCnotourArea < thresholdPercent)
|
||||
return false;
|
||||
}
|
||||
@@ -740,7 +740,7 @@ static cv::Mat tiledImages(std::vector<cv::Mat>& imgs)
|
||||
int matWidth = 0, matHeight = 0;
|
||||
for (auto& mat : imgs)
|
||||
{
|
||||
matHeight = getMax(mat.rows, matHeight);
|
||||
matHeight = std::max(mat.rows, matHeight);
|
||||
matWidth += mat.cols;
|
||||
}
|
||||
cv::Mat showMat(matHeight, matWidth, CV_8UC3);
|
||||
@@ -806,7 +806,7 @@ static void denoiseImage(const cv::Mat& inputMat, cv::Mat& outputMat, int kernel
|
||||
}
|
||||
|
||||
// 兜底:使用可分离高斯滤波,适合较大核或需要指定平滑强度的场景
|
||||
const double sigmaChecked = getMax(0.0, sigma);
|
||||
const double sigmaChecked = std::max(0.0, sigma);
|
||||
cv::GaussianBlur(inputMat, outputMat, cv::Size(k, k), sigmaChecked, sigmaChecked, cv::BORDER_DEFAULT);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
// std::vector < std::pair<std::string, std::string>>
|
||||
// sonMerges = writeExcelLoop(sheet, input.nexCols[i], depth + 1, cols + depthCount);
|
||||
// mergeStr.insert(mergeStr.end(), sonMerges.begin(), sonMerges.end());
|
||||
// depthCount += getMax((int)input.nexCols[i].nexCols.size(), 1);
|
||||
// depthCount += std::max((int)input.nexCols[i].nexCols.size(), 1);
|
||||
// }
|
||||
// std::string endUnit = char(65 + depth) + std::to_string(cols + getMax(depthCount - 1, 0));
|
||||
// std::string endUnit = char(65 + depth) + std::to_string(cols + std::max(depthCount - 1, 0));
|
||||
// sheet.cell(startUnit).value() = input.text;
|
||||
// mergeStr.push_back(std::make_pair(startUnit, endUnit));
|
||||
// return mergeStr;
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
if (data->resultImgs.size() > 0) {
|
||||
|
||||
for (int i = 0; i < data->resultImgs.size() && i < data->resultImgShowSet.size(); i++) {
|
||||
auto pack = data->resultImgShowSet[getMin(i, (int)data->resultImgShowSet.size() - 1)];
|
||||
auto pack = data->resultImgShowSet[std::min(i, (int)data->resultImgShowSet.size() - 1)];
|
||||
int resizeRate = qMax(data->resultImgs[i].cols / uiShowImgCompressThreshold, data->resultImgs[i].rows / uiShowImgCompressThreshold) ;
|
||||
resizeRate = std::pow(2, resizeRate);
|
||||
if (resizeRate > 1) {
|
||||
|
||||
@@ -459,7 +459,7 @@ protected:
|
||||
void mouseMoveEvent(QMouseEvent* event) override {
|
||||
if (event->buttons() == Qt::LeftButton && isMoving) {
|
||||
QPoint pos = event->globalPos();
|
||||
if (getMax(getAbs(pos.x()- startPos.x()), getAbs(pos.y() - startPos.y()))>10)
|
||||
if (std::max(std::abs(pos.x()- startPos.x()), std::abs(pos.y() - startPos.y()))>10)
|
||||
if(lastWindowMoveTime.elapsed()> freshDelay)//每秒刷新100次
|
||||
{
|
||||
lastWindowMoveTime.restart();
|
||||
|
||||
@@ -48,8 +48,8 @@ public:
|
||||
}
|
||||
void addData(int value)
|
||||
{
|
||||
maxValue = getMax(value, maxValue);
|
||||
minValue = getMin(value, minValue);
|
||||
maxValue = std::max(value, maxValue);
|
||||
minValue = std::min(value, minValue);
|
||||
currentValue = value;
|
||||
if((maxValue - minValue) ==0)
|
||||
setProgress(1);
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
{
|
||||
int time1 = startTimeEdit->time().hour() * 60 + startTimeEdit->time().minute();
|
||||
int time2 = endTimeEdit->time().hour() * 60 + startTimeEdit->time().minute();
|
||||
return { getMax(time1,time2),getMax(time1,time2) };
|
||||
return { std::max(time1,time2),std::max(time1,time2) };
|
||||
}
|
||||
|
||||
QTime getStartTime() const {
|
||||
|
||||
@@ -211,7 +211,7 @@ protected:
|
||||
// deleteAllRect();
|
||||
|
||||
// if (width != 0 && height != 0) {
|
||||
// double scaleRate = getMax(width == 0 ? 1.0 : rect().width() / width,height == 0 ? 1.0 : rect().height() / height);
|
||||
// double scaleRate = std::max(width == 0 ? 1.0 : rect().width() / width,height == 0 ? 1.0 : rect().height() / height);
|
||||
// scale(scaleRate, scaleRate);
|
||||
// centerOn(startPos + QPointF(width / 2, height / 2));
|
||||
// }
|
||||
|
||||
@@ -121,7 +121,7 @@ cv::Mat LocalCutImg_DET(handdleAI::pDetection* pDet, cv::Mat src, float zoom, in
|
||||
static std::vector<cv::Mat>dingGaiHanClsCut(cv::Rect boundingBox, cv::Mat imgInput, cv::Size targetSize = cv::Size(128, 128))
|
||||
{
|
||||
std::vector<cv::Mat> result;
|
||||
int splitCount = getMax(boundingBox.width, boundingBox.height) / getMax(boundingBox.width, boundingBox.height);
|
||||
int splitCount = std::max(boundingBox.width, boundingBox.height) / std::max(boundingBox.width, boundingBox.height);
|
||||
//std::cout << "splitCount" << splitCount;
|
||||
if (splitCount > 2) {//大于2分段裁
|
||||
if (boundingBox.width > boundingBox.height) {//宽大于高,横着裁
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
Language: Cpp
|
||||
BasedOnStyle: Google
|
||||
UseTab: Never # 使用空格而不是制表符。
|
||||
IndentWidth: 4 # 缩进宽度为4个空格。
|
||||
TabWidth: 4 # Tab长度
|
||||
ColumnLimit: 0
|
||||
SortIncludes: false
|
||||
Binary file not shown.
@@ -0,0 +1,54 @@
|
||||
@echo off
|
||||
echo Starting code formatting...
|
||||
|
||||
:: 定义要格式化的多个文件夹
|
||||
set "FOLDER_1=../src"
|
||||
set "FOLDER_2=../include"
|
||||
set "FOLDER_3=../subModule"
|
||||
set "FOLDER_4=../rpcModule"
|
||||
|
||||
echo Formatting multiple folders...
|
||||
echo.
|
||||
|
||||
:: 格式化第一个文件夹
|
||||
if exist "%FOLDER_1%" (
|
||||
echo Processing folder: %FOLDER_1%
|
||||
for /r "%FOLDER_1%" %%i in (*.cpp *.h) do (
|
||||
echo Formatting: %%i
|
||||
clang-format -i "%%i"
|
||||
)
|
||||
echo.
|
||||
)
|
||||
|
||||
:: 格式化第二个文件夹
|
||||
if exist "%FOLDER_2%" (
|
||||
echo Processing folder: %FOLDER_2%
|
||||
for /r "%FOLDER_2%" %%i in (*.cpp *.h) do (
|
||||
echo Formatting: %%i
|
||||
clang-format -i "%%i"
|
||||
)
|
||||
echo.
|
||||
)
|
||||
|
||||
:: 格式化第三个文件夹
|
||||
if exist "%FOLDER_3%" (
|
||||
echo Processing folder: %FOLDER_3%
|
||||
for /r "%FOLDER_3%" %%i in (*.cpp *.h) do (
|
||||
echo Formatting: %%i
|
||||
clang-format -i "%%i"
|
||||
)
|
||||
echo.
|
||||
)
|
||||
|
||||
:: 格式化第4个文件夹
|
||||
if exist "%FOLDER_4%" (
|
||||
echo Processing folder: %FOLDER_4%
|
||||
for /r "%FOLDER_4%" %%i in (*.cpp *.h) do (
|
||||
echo Formatting: %%i
|
||||
clang-format -i "%%i"
|
||||
)
|
||||
echo.
|
||||
)
|
||||
|
||||
echo Formatting completed!
|
||||
pause
|
||||
Binary file not shown.
Reference in New Issue
Block a user