【python】OpenCV—Aruco

在这里插入图片描述

文章目录

  • Detect Aruco
  • Guess Aruco Type

Detect Aruco

学习参考来自:OpenCV基础(19)使用 OpenCV 和 Python 检测 ArUco 标记

更多使用细节可以参考:【python】OpenCV—Color Correction

源码:

链接:https://pan.baidu.com/s/1bEPuiix0MrtL7Fu3paoRug
提取码:123a

在这里插入图片描述

# -----------------------------
#   USAGE
# -----------------------------
# python detect_aruco_image.py --image images/example_01.png --type DICT_5X5_100
# python detect_aruco_image.py --image images/example_02.png --type DICT_ARUCO_ORIGINAL# -----------------------------
#   IMPORTS
# -----------------------------
# Import the necessary packages
import argparse
import imutils
import cv2
import sys# Construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True, help="Path to the input image containing the ArUCo tag")
ap.add_argument("-t", "--type", type=str, default="DICT_ARUCO_ORIGINAL", help="Tpe of ArUCo tag to detect")
args = vars(ap.parse_args())# Define the names of each possible ArUco tag that OpenCV supports
ARUCO_DICT = {"DICT_4X4_50": cv2.aruco.DICT_4X4_50, "DICT_4X4_100": cv2.aruco.DICT_4X4_100,"DICT_4X4_250": cv2.aruco.DICT_4X4_250, "DICT_4X4_1000": cv2.aruco.DICT_4X4_1000,"DICT_5X5_50": cv2.aruco.DICT_5X5_50, "DICT_5X5_100": cv2.aruco.DICT_5X5_100,"DICT_5X5_250": cv2.aruco.DICT_5X5_250, "DICT_5X5_1000": cv2.aruco.DICT_5X5_1000,"DICT_6X6_50": cv2.aruco.DICT_6X6_50, "DICT_6X6_100": cv2.aruco.DICT_6X6_100,"DICT_6X6_250": cv2.aruco.DICT_6X6_250, "DICT_6X6_1000": cv2.aruco.DICT_6X6_1000,"DICT_7X7_50": cv2.aruco.DICT_7X7_50, "DICT_7X7_100": cv2.aruco.DICT_7X7_100,"DICT_7X7_250": cv2.aruco.DICT_7X7_250, "DICT_7X7_1000": cv2.aruco.DICT_7X7_1000,"DICT_ARUCO_ORIGINAL": cv2.aruco.DICT_ARUCO_ORIGINAL,"DICT_APRILTAG_16h5": cv2.aruco.DICT_APRILTAG_16h5,"DICT_APRILTAG_25h9": cv2.aruco.DICT_APRILTAG_25h9,"DICT_APRILTAG_36h10": cv2.aruco.DICT_APRILTAG_36h10,"DICT_APRILTAG_36h11": cv2.aruco.DICT_APRILTAG_36h11}# Load the input image from disk and resize it
print("[INFO] Loading image...")
image = cv2.imread(args["image"])
image = imutils.resize(image, width=600)# Verify that the supplied ArUCo tag exists is supported by OpenCV
if ARUCO_DICT.get(args["type"], None) is None:print("[INFO] ArUCo tag of '{}' is not supported!".format(args["type"]))sys.exit(0)# Load the ArUCo dictionary, grab the ArUCo parameters and detect the markers
print("[INFO] Detecting '{}' tags...".format(args["type"]))
arucoDict = cv2.aruco.Dictionary_get(ARUCO_DICT[args["type"]])
arucoParams = cv2.aruco.DetectorParameters_create()
(corners, ids, rejected) = cv2.aruco.detectMarkers(image, arucoDict, parameters=arucoParams)# Verify *at least* one ArUCo marker was detected
if len(corners) > 0:# Flatten the ArUCo IDs listids = ids.flatten()# Loop over the detected ArUCo cornersfor (markerCorner, markerID) in zip(corners, ids):# Extract the markers corners which are always returned in the following order:# TOP-LEFT, TOP-RIGHT, BOTTOM-RIGHT, BOTTOM-LEFTcorners = markerCorner.reshape((4, 2))(topLeft, topRight, bottomRight, bottomLeft) = corners# Convert each of the (x, y)-coordinate pairs to integerstopRight = (int(topRight[0]), int(topRight[1]))bottomRight = (int(bottomRight[0]), int(bottomRight[1]))bottomLeft = (int(bottomLeft[0]), int(bottomLeft[1]))topLeft = (int(topLeft[0]), int(topLeft[1]))# Draw the bounding box of the ArUCo detectioncv2.line(image, topLeft, topRight, (0, 255, 0), 2)cv2.line(image, topRight, bottomRight, (0, 255, 0), 2)cv2.line(image, bottomRight, bottomLeft, (0, 255, 0), 2)cv2.line(image, bottomLeft, topLeft, (0, 255, 0), 2)# Compute and draw the center (x, y) coordinates of the ArUCo markercX = int((topLeft[0] + bottomRight[0]) / 2.0)cY = int((topLeft[1] + bottomRight[1]) / 2.0)cv2.circle(image, (cX, cY), 4, (0, 0, 255), -1)# Draw the ArUco marker ID on the imagecv2.putText(image, str(markerID), (topLeft[0], topLeft[1] - 15), cv2.FONT_HERSHEY_SIMPLEX,0.5, (0, 255, 0), 2)print("[INFO] ArUco marker ID: {}".format(markerID))# write the output imagecv2.imwrite("{}_{}.jpg".format(args["type"], markerID), image)# Show the output imagecv2.imshow("Image", image)cv2.waitKey(0)

输入图像

在这里插入图片描述
依次输出 DICT_5X5_100_42
在这里插入图片描述
DICT_5X5_100_24
在这里插入图片描述
DICT_5X5_100_70
在这里插入图片描述
DICT_5X5_100_66
在这里插入图片描述

DICT_5X5_100_87
在这里插入图片描述


再来一组

输入图片

在这里插入图片描述

依次输出

DICT_ARUCO_ORIGINAL_241

在这里插入图片描述

DICT_ARUCO_ORIGINAL_1007

在这里插入图片描述
DICT_ARUCO_ORIGINAL_1001

在这里插入图片描述

DICT_ARUCO_ORIGINAL_923

在这里插入图片描述

演示了如何检测图片,下面是检测视频的代码

# -----------------------------
#   USAGE
# -----------------------------
# python detect_aruco_video.py# -----------------------------
#   IMPORTS
# -----------------------------
# Import the necessary packages
from imutils.video import VideoStream
import argparse
import imutils
import time
import cv2
import sys# Construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-t", "--type", type=str, default="DICT_ARUCO_ORIGINAL", help="Type of ArUCo tag to detect")
args = vars(ap.parse_args())# Define the names of each possible ArUCo tag that OpenCV supports
ARUCO_DICT = {"DICT_4X4_50": cv2.aruco.DICT_4X4_50, "DICT_4X4_100": cv2.aruco.DICT_4X4_100,"DICT_4X4_250": cv2.aruco.DICT_4X4_250, "DICT_4X4_1000": cv2.aruco.DICT_4X4_1000,"DICT_5X5_50": cv2.aruco.DICT_5X5_50, "DICT_5X5_100": cv2.aruco.DICT_5X5_100,"DICT_5X5_250": cv2.aruco.DICT_5X5_250, "DICT_5X5_1000": cv2.aruco.DICT_5X5_1000,"DICT_6X6_50": cv2.aruco.DICT_6X6_50, "DICT_6X6_100": cv2.aruco.DICT_6X6_100,"DICT_6X6_250": cv2.aruco.DICT_6X6_250, "DICT_6X6_1000": cv2.aruco.DICT_6X6_1000,"DICT_7X7_50": cv2.aruco.DICT_7X7_50, "DICT_7X7_100": cv2.aruco.DICT_7X7_100,"DICT_7X7_250": cv2.aruco.DICT_7X7_250, "DICT_7X7_1000": cv2.aruco.DICT_7X7_1000,"DICT_ARUCO_ORIGINAL": cv2.aruco.DICT_ARUCO_ORIGINAL,"DICT_APRILTAG_16h5": cv2.aruco.DICT_APRILTAG_16h5,"DICT_APRILTAG_25h9": cv2.aruco.DICT_APRILTAG_25h9,"DICT_APRILTAG_36h10": cv2.aruco.DICT_APRILTAG_36h10,"DICT_APRILTAG_36h11": cv2.aruco.DICT_APRILTAG_36h11}# Verify that the supplied ArUCo tag exists and is supported by OpenCV
if ARUCO_DICT.get(args["type"], None) is None:print("[INFO] ArUCo tag of '{}' is not supported".format(args["type"]))sys.exit(0)# Load the ArUCo dictionary and grab the ArUCo parameters
print("[INFO] Detecting '{}' tags...".format(args["type"]))
arucoDict = cv2.aruco.Dictionary_get(ARUCO_DICT[args["type"]])
arucoParams = cv2.aruco.DetectorParameters_create()# Initialize the video stream and allow the camera sensor to warm up
print("[INFO] Starting video stream...")
vs = VideoStream(src=0).start()
time.sleep(2.0)# Loop over the frames from the video stream
while True:# Grab the frame from the threaded video stream and resize it to have a maximum width of 600 pixelsframe = vs.read()frame = imutils.resize(frame, width=1000)# Detect ArUco markers in the input frame(corners, ids, rejected) = cv2.aruco.detectMarkers(frame, arucoDict, parameters=arucoParams)# Verify *at least* one ArUco marker was detectedif len(corners) > 0:# Flatten the ArUco IDs listids = ids.flatten()# Loop over the detected ArUCo cornersfor (markerCorner, markerID) in zip(corners, ids):# Extract the marker corners (which are always returned# in top-left, top-right, bottom-right, and bottom-left order)corners = markerCorner.reshape((4, 2))(topLeft, topRight, bottomRight, bottomLeft) = corners# Convert each of the (x, y)-coordinate pairs to integerstopRight = (int(topRight[0]), int(topRight[1]))bottomRight = (int(bottomRight[0]), int(bottomRight[1]))bottomLeft = (int(bottomLeft[0]), int(bottomLeft[1]))topLeft = (int(topLeft[0]), int(topLeft[1]))# Draw the bounding box of the ArUCo detectioncv2.line(frame, topLeft, topRight, (0, 255, 0), 2)cv2.line(frame, topRight, bottomRight, (0, 255, 0), 2)cv2.line(frame, bottomRight, bottomLeft, (0, 255, 0), 2)cv2.line(frame, bottomLeft, topLeft, (0, 255, 0), 2)# Compute and draw the center (x, y)-coordinates of the ArUco markercX = int((topLeft[0] + bottomRight[0]) / 2.0)cY = int((topLeft[1] + bottomRight[1]) / 2.0)cv2.circle(frame, (cX, cY), 4, (0, 0, 255), -1)# Draw the ArUco marker ID on the framecv2.putText(frame, str(markerID), (topLeft[0], topLeft[1] - 15),cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)# Show the output framecv2.imshow("Frame", frame)key = cv2.waitKey(1) & 0xFF# If the `q` key was pressed, break from the loopif key == ord("q"):break# Do a bit of cleanup
cv2.destroyAllWindows()
vs.stop()

Guess Aruco Type

学习参考来自:OpenCV基础(20)使用 OpenCV 和 Python 确定 ArUco 标记类型

源码:

链接:https://pan.baidu.com/s/1DmjKL1tVbQX0YkDUzki2Jw
提取码:123a

# ------------------------
#   USAGE
# ------------------------
#  python guess_aruco_type.py --image images/example_01.png
#  python guess_aruco_type.py --image images/example_02.png
#  python guess_aruco_type.py --image images/example_03.png
# -----------------------------
#   IMPORTS
# -----------------------------
# Import the necessary packages
import argparse
import imutils
import cv2# Construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True, help="Path to the input image containing ArUCo tag")
args = vars(ap.parse_args())# Define the names of each possible ArUCo tag that the OpenCV supports
ARUCO_DICT = {"DICT_4X4_50": cv2.aruco.DICT_4X4_50, "DICT_4X4_100": cv2.aruco.DICT_4X4_100,"DICT_4X4_250": cv2.aruco.DICT_4X4_250, "DICT_4X4_1000": cv2.aruco.DICT_4X4_1000,"DICT_5X5_50": cv2.aruco.DICT_5X5_50, "DICT_5X5_100": cv2.aruco.DICT_5X5_100,"DICT_5X5_250": cv2.aruco.DICT_5X5_250, "DICT_5X5_1000": cv2.aruco.DICT_5X5_1000,"DICT_6X6_50": cv2.aruco.DICT_6X6_50, "DICT_6X6_100": cv2.aruco.DICT_6X6_100,"DICT_6X6_250": cv2.aruco.DICT_6X6_250, "DICT_6X6_1000": cv2.aruco.DICT_6X6_1000,"DICT_7X7_50": cv2.aruco.DICT_7X7_50, "DICT_7X7_100": cv2.aruco.DICT_7X7_100,"DICT_7X7_250": cv2.aruco.DICT_7X7_250, "DICT_7X7_1000": cv2.aruco.DICT_7X7_1000,"DICT_ARUCO_ORIGINAL": cv2.aruco.DICT_ARUCO_ORIGINAL,"DICT_APRILTAG_16h5": cv2.aruco.DICT_APRILTAG_16h5,"DICT_APRILTAG_25h9": cv2.aruco.DICT_APRILTAG_25h9,"DICT_APRILTAG_36h10": cv2.aruco.DICT_APRILTAG_36h10,"DICT_APRILTAG_36h11": cv2.aruco.DICT_APRILTAG_36h11}# Load the input image from disk and resize it
print("[INFO] Loading image...")
image = cv2.imread(args["image"])
image = imutils.resize(image, width=800)# Loop over the types of ArUCo dictionaries
for (arucoName, arucoDictionary) in ARUCO_DICT.items():# Load the ArUCo dictionary, grab the ArUCo parameters and attempt to detect the markers for the current dictionaryarucoDict = cv2.aruco.Dictionary_get(arucoDictionary)arucoParams = cv2.aruco.DetectorParameters_create()(corners, ids, rejected) = cv2.aruco.detectMarkers(image, arucoDict, parameters=arucoParams)# If at least one ArUCo marker was detected display the ArUCo marker and its type name in the terminalif len(corners) > 0:print("[INFO] Detected {} markers for '{}'".format(len(corners), arucoName))

输入
在这里插入图片描述
输出

[INFO] Loading image...
[INFO] Detected 2 markers for 'DICT_5X5_50'
[INFO] Detected 5 markers for 'DICT_5X5_100'
[INFO] Detected 5 markers for 'DICT_5X5_250'
[INFO] Detected 5 markers for 'DICT_5X5_1000'

输入
在这里插入图片描述

输出

[INFO] Loading image...
[INFO] Detected 1 markers for 'DICT_4X4_50'
[INFO] Detected 1 markers for 'DICT_4X4_100'
[INFO] Detected 1 markers for 'DICT_4X4_250'
[INFO] Detected 1 markers for 'DICT_4X4_1000'
[INFO] Detected 4 markers for 'DICT_ARUCO_ORIGINAL'

输入

在这里插入图片描述

输出

[INFO] Loading image...
[INFO] Detected 5 markers for 'DICT_APRILTAG_36h11'

猜出来了 Aruco 的类型,我们就可以设定检测了

# ------------------------
#   USAGE
# ------------------------
#  python detect_aruco_image_type.py --image images/example_03.png# -----------------------------
#   IMPORTS
# -----------------------------
# Import the necessary packages
import argparse
import imutils
import cv2
import sys# Construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True, help="Path to the input image containing ArUCo tag")
args = vars(ap.parse_args())# Define the names of each possible ArUCo tag that the OpenCV supports
ARUCO_DICT = {"DICT_4X4_50": cv2.aruco.DICT_4X4_50, "DICT_4X4_100": cv2.aruco.DICT_4X4_100,"DICT_4X4_250": cv2.aruco.DICT_4X4_250, "DICT_4X4_1000": cv2.aruco.DICT_4X4_1000,"DICT_5X5_50": cv2.aruco.DICT_5X5_50, "DICT_5X5_100": cv2.aruco.DICT_5X5_100,"DICT_5X5_250": cv2.aruco.DICT_5X5_250, "DICT_5X5_1000": cv2.aruco.DICT_5X5_1000,"DICT_6X6_50": cv2.aruco.DICT_6X6_50, "DICT_6X6_100": cv2.aruco.DICT_6X6_100,"DICT_6X6_250": cv2.aruco.DICT_6X6_250, "DICT_6X6_1000": cv2.aruco.DICT_6X6_1000,"DICT_7X7_50": cv2.aruco.DICT_7X7_50, "DICT_7X7_100": cv2.aruco.DICT_7X7_100,"DICT_7X7_250": cv2.aruco.DICT_7X7_250, "DICT_7X7_1000": cv2.aruco.DICT_7X7_1000,"DICT_ARUCO_ORIGINAL": cv2.aruco.DICT_ARUCO_ORIGINAL,"DICT_APRILTAG_16h5": cv2.aruco.DICT_APRILTAG_16h5,"DICT_APRILTAG_25h9": cv2.aruco.DICT_APRILTAG_25h9,"DICT_APRILTAG_36h10": cv2.aruco.DICT_APRILTAG_36h10,"DICT_APRILTAG_36h11": cv2.aruco.DICT_APRILTAG_36h11}# Load the input image from disk and resize it
print("[INFO] Loading image...")
image = cv2.imread(args["image"])
image = imutils.resize(image, width=800)# Verify that the supplied ArUCo tag exists is supported by OpenCV
# if ARUCO_DICT.get(args["type"], None) is None:
#     print("[INFO] ArUCo tag of '{}' is not supported!".format(args["type"]))
#     sys.exit(0)# Loop over the types of ArUCo dictionaries
for (arucoName, arucoDictionary) in ARUCO_DICT.items():# Load the ArUCo dictionary, grab the ArUCo parameters and attempt to detect the markers for the current dictionaryarucoDict = cv2.aruco.Dictionary_get(arucoDictionary)arucoParams = cv2.aruco.DetectorParameters_create()(corners, ids, rejected) = cv2.aruco.detectMarkers(image, arucoDict, parameters=arucoParams)# If at least one ArUCo marker was detected display the ArUCo marker and its type name in the terminalif len(corners) > 0:print("[INFO] Detected {} markers for '{}'".format(len(corners), arucoName))# Flatten the ArUCo IDs listIDS = ids.flatten()# Loop over the detected ArUCo cornersfor (markerCorner, markerID) in zip(corners, IDS):# Extract the markers corners which are always returned in the following order:# TOP-LEFT, TOP-RIGHT, BOTTOM-RIGHT, BOTTOM-LEFTcorners = markerCorner.reshape((4, 2))(topLeft, topRight, bottomRight, bottomLeft) = corners# Convert each of the (x, y)-coordinate pairs to integerstopRight = (int(topRight[0]), int(topRight[1]))bottomRight = (int(bottomRight[0]), int(bottomRight[1]))bottomLeft = (int(bottomLeft[0]), int(bottomLeft[1]))topLeft = (int(topLeft[0]), int(topLeft[1]))# Draw the bounding box of the ArUCo detectioncv2.line(image, topLeft, topRight, (0, 255, 0), 2)cv2.line(image, topRight, bottomRight, (0, 255, 0), 2)cv2.line(image, bottomRight, bottomLeft, (0, 255, 0), 2)cv2.line(image, bottomLeft, topLeft, (0, 255, 0), 2)# Compute and draw the center (x, y) coordinates of the ArUCo markercX = int((topLeft[0] + bottomRight[0]) / 2.0)cY = int((topLeft[1] + bottomRight[1]) / 2.0)cv2.circle(image, (cX, cY), 4, (0, 0, 255), -1)# Get marker type namemarkerType = "{} -> {}".format(markerID, arucoName)# Draw the ArUco marker ID on the imagecv2.putText(image, str(markerType), (topLeft[0], topLeft[1] - 15), cv2.FONT_HERSHEY_SIMPLEX, 0.5,(0, 255, 0), 2)print("[INFO] ArUco marker ID: {}".format(markerID))# Write the output imagecv2.imwrite(f"{markerID}_{arucoName}.jpg", image)# Show the output imagecv2.imshow("Image", image)cv2.waitKey(0)

输入

在这里插入图片描述

依次输出

7_DICT_APRILTAG_36h11
在这里插入图片描述
3_DICT_APRILTAG_36h11
在这里插入图片描述

5_DICT_APRILTAG_36h11
在这里插入图片描述

14_DICT_APRILTAG_36h11

在这里插入图片描述
8_DICT_APRILTAG_36h11
在这里插入图片描述

再看看另外一个的案例

DICT_5X5_100
在这里插入图片描述

87_DICT_5X5_250
在这里插入图片描述

87_DICT_5X5_1000

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/36852.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

为什么IP地址会被列入黑名单?

您是否曾经历过网站访客数量骤减或电子邮件投递失败的困扰?这背后或许隐藏着一个常被忽略的原因:您的IP地址可能已经被列入了黑名单内。尽管您并没有进行任何违法的网络操作,但这个问题依然可能出现。那么,究竟黑名单是什么&#…

【VMware】VMware 开启的虚拟机无法联网的解决方案

目录 🌊1. 问题说明 🌊2. 解决方案 🌍2.1 查看虚拟网络编辑器 🌍2.2 设置 vmnet 🌍2.3 设置虚拟机网络 🌍2.4 Xshell连接虚拟机 🌊1. 问题说明 虚拟机 ping 其他网页显示失败,比如&#…

数据质量管理-时效性管理

前情提要 根据GB/T 36344-2018《信息技术 数据质量评价指标》的标准文档,当前数据质量评价指标框架中包含6评价指标,在实际的数据治理过程中,存在一个关联性指标。7个指标中存在4个定性指标,3个定量指标; 定性指标&am…

【旭日x3派】部署官方yolov5全流程

地平线旭日x3派部署yolov5--全流程 前言一、深度学习环境安装二、安装docker三、部署3.1、安装工具链镜像3.2、配置天工开物OpenExplorer工具包3.3、创建深度学习虚拟空间,安装依赖:3.4、下载yolov5项目源码并运行3.5、pytorch的pt模型文件转onnx3.6、最…

前端git约定式规范化提交-commitizen

当使用commitizen进行代码提交时,commitizen会提示你在提交代码时填写所必填的提交字段信息内容。 1、全局安装commitizen npm install -g commitizen4.2.4 2、安装并配置 cz-customizeable 插件 2.1 使用 npm 下载 cz-customizeable npm i cz-customizeable6.…

【论文复现】——基于LM优化的NDT点云配准算法

目录 一、算法原理1、论文概述2、参考文献二、代码实现三、结果展示本文由CSDN点云侠原创,原文链接,爬虫自重。如果你不是在点云侠的博客中看到该文章,那么此处便是不要脸的爬虫与GPT生成的文章。 一、算法原理 1、论文概述 传统的正态分布变换配准算法处理初始位姿变换相…

办公软件WPS与Office的区别

临近计算机考试很多同学在纠结我是报wps好?还是ms office好?下面就来详细说说。 1、wps属于国内金山公司的办公软件,里面包含word、Excel和PPT。考试是2021年开始的! 2、MS(Microsoft 微软) office属于美…

AI产品经理面试

把优秀当习惯把优秀当习惯肯定不是口头说说,那有什么判断标准吗? 当我做完一件事儿的时候,我会看它有没有突破我的舒适圈、能不能惊艳到我自己。这就是我的判断标准。 在自我介绍和经历介绍时,面试者应该注重以下几个方面&#xf…

核方法总结(四)——高斯过程回归学习笔记

一、定义 基于核方法的线性回归模型和传统线性回归一样,可以用未知数据进行预测,但不能确定 预测的可信度。在参考书第二章中可知,基于贝叶斯方法可以实现对未知数据依概率预测,进而可得到预测的可信度。这一方法中,通…

嵌入式Linux系统编程 — 4.7 regcomp、regexec、regfree正则表达式函数

目录 1 为什么需要正则表达式 2 正则表达式简介 3 正则表达式规则 4 regcomp、regexec、regfree函数 4.1 函数介绍 4.2 URL格式案例 1 为什么需要正则表达式 在许多的应用程序当中, 有这样的应用场景: 给定一个字符串,检查该字符串是否…

分布式锁及其实现与应用场景

分布式锁及其实现与应用场景 分布式锁是一种用于在分布式系统中协调多个进程或线程对共享资源进行访问的机制。它的主要目的是确保在同一时间只有一个进程或线程可以访问特定资源,从而避免数据竞争和不一致问题。分布式锁通常用于集群环境中,例如微服务…

Rpc服务的提供方(Rpcprovider)的调用流程

首先,服务的提供方,会通过rpcprovider向rpc服务方注册rpc服务对象和服务方法, 那么,我们通过protobuf提供的抽象层的service和method,将服务对象和它所对应的服务方法记录在map表中, 当它启动以后&#xff…

Qt之饼图(Pie Graph)

[TOC](Qt之饼图(Pie Graph)) 饼图名为Pie Graph,用于显示一个数据系列中各项的大小与各项总和的比例。本文基于QtCharts实现饼图的显示。 1.实现过程 1.1环境配置 (1)首先想要使用QtCharts模块,需要在安装qt时选择勾选安装QtCha…

【名企专访】|格行自有格行的骄傲,格行骄傲在哪?格行随身wifi火爆出圈的真实内幕!

最近刷视频在一个随身wifi的帖子下边看到,有个网友这样回复:“随身wifi行业真的该整治了,到处是跑路的,夸大宣传的,本来在线上买就是图个方便,现在搞得不敢买。本来利民的产品,被搞得乌烟瘴气&a…

甄选范文“论云上自动化运维及其应用”,软考高级论文,系统架构设计师论文

论文真题 云上自动化运维是传统IT运维和DevOps的延伸,通过云原生架构实现运维的再进化。云上自动化运维可以有效帮助企业降低IT运维成本,提升系统的灵活度,以及系统的交付速度,增强系统的可靠性,构建更加安全、可信、开放的业务平台。 请围绕“云上自动化运维及其应用”…

windows 10 安装tcping 使用教程

1 官网下载:tcping下载 2 复制tcping 到win10系统目录C:\Windows\System32 3 tcping 网址测试,可以指定端口 4 tcping 测试端口联通 5 tcping http模式

【原创图解 算法leetcode 146】实现一个LRU缓存淘汰策略策略的数据结构

1 概念 LRU是Least Recently Used的缩写,即最近最少使用,是一种常见的缓存淘汰算法。 其核心思想为:当内存达到上限时,淘汰最久未被访问的缓存。 2 LeetCode LeetCode: 146. LRU缓存 3 实现 通过上面LRU的淘汰策略可知&#…

【多维动态规划】Leetcode 221. 最大正方形【中等】

最大正方形 在一个由 ‘0’ 和 ‘1’ 组成的二维矩阵内,找到只包含 ‘1’ 的最大正方形,并返回其面积。 示例 1: 输入:matrix [[“1”,“0”,“1”,“0”,“0”],[“1”,“0”,“1”,“1”,“1”],[“1”,“1”,“1”,“1”,“…

程序中的Reduce(CPU和GPU)

前提 最近在看Reduce(归约)的相关知识和代码,做个总结。这里默认大家已经明白了Reduce的基础概念。 Reduce 根据参考链接一,Recude常见的划分方法有两种: 相邻配对:元素和它们相邻的元素配对 交错配对…

【Mybatis】Mybatis初识-通过源码学习执行流程

文章目录 1.Mybatis核心组件1.1 SqlSession1.2 SqlSessionFactory1.3 Mapper1.4 MappedStatement1.5 Executor 2. Mybatis各组件之间关系3. 构建SqlSessionFactory3.1 从XML文件中构建3.2 不使用XML构建SqlSessionFactory 4. 如何从SqlSessionFactory获取SqlSession5.获取Mappe…