From 125db633619a0b4c7bd1d498ea2bf1cefa4f73d3 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 09 二月 2023 18:54:13 +0800
Subject: [PATCH] '远程OCR'

---
 ConsoleApplication/ImgUtil.cpp |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/ConsoleApplication/ImgUtil.cpp b/ConsoleApplication/ImgUtil.cpp
index c272ddd..501a450 100644
--- a/ConsoleApplication/ImgUtil.cpp
+++ b/ConsoleApplication/ImgUtil.cpp
@@ -1074,3 +1074,31 @@
 	return TRUE;
 }
 
+//标记1维图像
+cv::Mat  ImgUtil::markMat(cv::Mat mat, cv::Rect rect, uchar borderColor, int borderWidth) {
+	for (int r = rect.y; r < rect.y + borderWidth; r++) {
+		for (int c = rect.x; c < rect.x + rect.width; c++) {
+			mat.ptr<uchar>(r)[c] = borderColor;
+		}
+	}
+
+	for (int r = rect.y + rect.height- borderWidth; r < rect.y + rect.height; r++) {
+		for (int c = rect.x; c < rect.x + rect.width; c++) {
+			mat.ptr<uchar>(r)[c] = borderColor;
+		}
+	}
+
+	for (int r = rect.y + borderWidth; r < rect.y + rect.height; r++) {
+		for (int c = rect.x; c < rect.x + borderWidth; c++) {
+			mat.ptr<uchar>(r)[c] = borderColor;
+		}
+	}
+
+	for (int r = rect.y + borderWidth; r < rect.y + rect.height; r++) {
+		for (int c = rect.x+rect.width - borderWidth; c < rect.x + rect.width; c++) {
+			mat.ptr<uchar>(r)[c] = borderColor;
+		}
+	}
+
+	return mat;
+}

--
Gitblit v1.8.0