From 36b24fd94ab369f95489b70cbe04d294f9f5059b Mon Sep 17 00:00:00 2001 From: gu12530 <2629144335@qq.com> Date: Thu, 28 Nov 2024 12:04:26 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 126e24c..87ec4e2 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ Lockzhiner Vision Module 拥有丰富的 IO 接口,其接口图片如下图所 * [凌智视觉模块人脸检测部署指南](example/vision/face_detection) * [凌智视觉模块人脸识别部署指南](example/vision/face_recognition) - +* [凌智视觉模块人脸识别系统部署指南](example/special/face_system) ## 🐛 Bug反馈 如果您遇到问题,您可以前往 [Lockzhiner Vision Module Issues](https://gitee.com/LockzhinerAI/LockzhinerVisionModule/issues) 并点击已完成按钮查看其他用户反馈且我们已经解决的 Bug。 -- Gitee From c79347690a3f2a988dcf444afafc4f7ce2be1321 Mon Sep 17 00:00:00 2001 From: gu12530 <2629144335@qq.com> Date: Thu, 28 Nov 2024 21:18:50 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0OpenCV?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 + example/opencv_example/OpenCV_API.md | 129 ++++++++++++++++++ .../opencv_circle_detect/README.md | 100 ++++++++++++++ .../python/images/circle.png | Bin 0 -> 7688 bytes .../python/images/img.png | Bin 0 -> 27923 bytes .../python/images/img_circles.png | Bin 0 -> 13227 bytes .../python/images/result.png | Bin 0 -> 32844 bytes .../python/images/ssh.png | Bin 0 -> 33441 bytes .../python/test_hough_circle.py | 31 +++++ .../opencv_edge_dection/README.md | 96 +++++++++++++ .../opencv_edge_dection/python/images/car.png | Bin 0 -> 199161 bytes .../python/images/edges.png | Bin 0 -> 3889 bytes .../opencv_edge_dection/python/images/img.png | Bin 0 -> 30324 bytes .../python/images/img_1.png | Bin 0 -> 45357 bytes .../python/images/img_2.png | Bin 0 -> 22299 bytes .../python/images/thresholded.png | Bin 0 -> 3529 bytes .../opencv_edge_dection/python/test_canny.py | 26 ++++ 17 files changed, 388 insertions(+) create mode 100644 example/opencv_example/OpenCV_API.md create mode 100644 example/opencv_example/opencv_circle_detect/README.md create mode 100644 example/opencv_example/opencv_circle_detect/python/images/circle.png create mode 100644 example/opencv_example/opencv_circle_detect/python/images/img.png create mode 100644 example/opencv_example/opencv_circle_detect/python/images/img_circles.png create mode 100644 example/opencv_example/opencv_circle_detect/python/images/result.png create mode 100644 example/opencv_example/opencv_circle_detect/python/images/ssh.png create mode 100644 example/opencv_example/opencv_circle_detect/python/test_hough_circle.py create mode 100644 example/opencv_example/opencv_edge_dection/README.md create mode 100644 example/opencv_example/opencv_edge_dection/python/images/car.png create mode 100644 example/opencv_example/opencv_edge_dection/python/images/edges.png create mode 100644 example/opencv_example/opencv_edge_dection/python/images/img.png create mode 100644 example/opencv_example/opencv_edge_dection/python/images/img_1.png create mode 100644 example/opencv_example/opencv_edge_dection/python/images/img_2.png create mode 100644 example/opencv_example/opencv_edge_dection/python/images/thresholded.png create mode 100644 example/opencv_example/opencv_edge_dection/python/test_canny.py diff --git a/README.md b/README.md index 87ec4e2..9d680a7 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,10 @@ Lockzhiner Vision Module 拥有丰富的 IO 接口,其接口图片如下图所 这一部分教程将引导你从零开始训练并部署各种深度学习模型,包括分类模型、检测模型、分割模型和 OCR 模型。通过这些实战教程,你将学习到如何利用 Lockzhiner Vision Module 的高性能计算能力以及借助飞桨生态系统的丰富资源,轻松实现视觉任务的训练和部署。 +### OpenCV 案例 + +* [OpenCV 圆形检测案例](example/vision/opencv/circle_detection) +* [OpenCV 边缘检测案例](example/vision/opencv/edge_detection) ### 👍 目标分类案例 目标分类(Object Classification)是深度学习中的一项核心任务,旨在为输入图像分配一个或多个类别标签。这是计算机视觉的基础问题之一,主要用于识别和区分图像中的主要物体类别,而不关心物体的位置或数量。一般来说,目标分类任务的标注过程比较轻松,适合不需要知道目标位置的场景。 @@ -89,6 +93,7 @@ Lockzhiner Vision Module 拥有丰富的 IO 接口,其接口图片如下图所 * [凌智视觉模块猫狗分类部署指南](example/special/cat_and_dog_classification) * [凌智视觉模块花卉分类部署指南](example/special/flower_classfication/) * [凌智视觉模块口罩佩戴分类部署指南](example/special/maskwear_classfication) + ### 👍 目标检测案例 目标检测(Object Detection)是深度学习中计算机视觉领域的重要任务之一,旨在识别图像或视频中所有感兴趣的物体,并准确地定位这些物体的边界框(Bounding Box)。与目标分类不同,目标检测不仅需要预测物体的类别,还需要标注它们在图像中的位置。一般来说,目标检测任务的标注过程比较复杂,适合既需要对目标进行分类,有需要对目标进行定位的场景。 @@ -109,6 +114,7 @@ Lockzhiner Vision Module 拥有丰富的 IO 接口,其接口图片如下图所 * [凌智视觉模块人脸检测部署指南](example/vision/face_detection) * [凌智视觉模块人脸识别部署指南](example/vision/face_recognition) * [凌智视觉模块人脸识别系统部署指南](example/special/face_system) + ## 🐛 Bug反馈 如果您遇到问题,您可以前往 [Lockzhiner Vision Module Issues](https://gitee.com/LockzhinerAI/LockzhinerVisionModule/issues) 并点击已完成按钮查看其他用户反馈且我们已经解决的 Bug。 diff --git a/example/opencv_example/OpenCV_API.md b/example/opencv_example/OpenCV_API.md new file mode 100644 index 0000000..2b2a060 --- /dev/null +++ b/example/opencv_example/OpenCV_API.md @@ -0,0 +1,129 @@ +**OPENCV_API 文档** + +``` markdown +def arcLength(curve, closed): + return cv2.arcLength(curve, closed) + + +def approxPolyDP(curve, epsilon, closed): + return cv2.approxPolyDP(curve, epsilon, closed) + + +def boundingRect(rect): + return cv2.boundingRect(rect) + + +def Canny(img, threshold1, threshold2, apertureSize=3, L2gradient=False): + return cv2.Canny(img, threshold1, threshold2, apertureSize, L2gradient) + + +def circle(img, center, radius, color, thickness=1, lineType=8, shift=0): + temp_center = convert2point(center) + temp_color = convert2scalar(color) + cv2.circle(img, temp_center, radius, temp_color, thickness, lineType, shift) + + +def cvtColor(src, code, dstCn=0): + return cv2.cvtColor(src, code, dstCn) + + +def findContours(image, mode, method, point=cv2.Point()): + contours, hierarchy = cv2.findContours(image, mode, method, point) + return contours, hierarchy + + +def GaussianBlur(src, ksize, sigmaX, sigmaY=0, borderType=cv2.BORDER_DEFAULT): + temp_ksize = convert2size(ksize) + return cv2.GaussianBlur(src, temp_ksize, sigmaX, sigmaY, borderType) + + +def HoughCircles(image, method, dp, minDist, param1, param2, minRadius, maxRadius): + return [cv2.HoughCircles( + image, method, dp, minDist, param1, param2, minRadius, maxRadius + )] + + +def HoughLines( + image, rho, theta, threshold, srn=0, stn=0, min_theta=0, max_theta=cv2.CV_PI +): + return [cv2.HoughLines(image, rho, theta, threshold, srn, stn, min_theta, max_theta)] + + +def HoughLinesP(image, rho, theta, threshold, minLineLength=0, maxLineGap=0): + return [cv2.HoughLinesP(image, rho, theta, threshold, minLineLength, maxLineGap)] + + +def line(img, pt1, pt2, color, thickness=1, lineType=8, shift=0): + temp_pt1 = convert2point(pt1) + temp_pt2 = convert2point(pt2) + temp_color = convert2scalar(color) + cv2.line(img, temp_pt1, temp_pt2, temp_color, thickness, lineType, shift) + + +def polylines(img, pts, isClosed, color, thickness=1, lineType=8, shift=0): + # 判读 pts 是否为 list + if not isinstance(pts, list): + raise TypeError("pts must be point list") + if len(pts) == 0: + return img + + if not isinstance(pts[0], list): + raise TypeError("pts[0] must be point list") + if len(pts[0]) == 0: + return img + + temp_pts = [convert2point(pt) for pt in pts[0]] + temp_color = convert2scalar(color) + cv2.polylines(img, temp_pts, isClosed, temp_color, thickness, lineType, shift) + + +def putText( + img, + text, + org, + fontFace, + fontScale, + color, + thickness=1, + lineType=8, + bottomLeftOrigin=False, +): + temp_org = convert2point(org) + temp_color = convert2scalar(color) + cv2.putText( + img, + text, + temp_org, + fontFace, + fontScale, + temp_color, + thickness, + lineType, + bottomLeftOrigin, + ) + + +def rectangle(img, pt1, pt2, color, thickness=1, lineType=8, shift=0): + temp_pt1 = convert2point(pt1) + temp_pt2 = convert2point(pt2) + temp_color = convert2scalar(color) + cv2.rectangle(img, temp_pt1, temp_pt2, temp_color, thickness, lineType, shift) + + +def threshold(src, thresh, maxval, type): + computed_threshold, dst = cv2.threshold(src, thresh, maxval, type) + return computed_threshold, dst +def convertScaleAbs(src, alpha=1, beta=0): + return cv2.convertScaleAbs(src, alpha, beta) + + +def inRange(src, lowerb, upperb): + return cv2.inRange(src, lowerb, upperb) +def imread(filename, flags=cv2.ImreadModes.IMREAD_COLOR): + return cv2.imread(filename, flags) + + +def imwrite(filename, mat): + return cv2.imwrite(filename, mat) + +``` \ No newline at end of file diff --git a/example/opencv_example/opencv_circle_detect/README.md b/example/opencv_example/opencv_circle_detect/README.md new file mode 100644 index 0000000..15d44b0 --- /dev/null +++ b/example/opencv_example/opencv_circle_detect/README.md @@ -0,0 +1,100 @@ +
qdC
ztuBSCCqe%JbYkwoG^m~zMu8I_a|wShow^pW8|VVcv~M!(1>|w+2sRp&g+e?oKR+K3
z2p!i5ATKRKQ($KDfg*fdlwlZ5;S3G!Q4jxqlP|4wgCW$$ciCg|>(pOpIOHU0dlp&L
zpR8#8yuvQ^xx8~mm?2REoG~_b*LsGskuV;ln+DSyEF2=FiQa4e?qJB`lCF4WOR+>{
zP3Bd(^1JEGAt1_LPglQq%vG%6tH$R8k&`ELZf+liO9!{gjQ~tvH%4|Z5jUs8KroOV
z;VDn?K7}Es{bCRnqKzGm8_zW@DKjf&ura!UAgQUKVWMCkUc!Zx*m`({k0BI^YZ)Vc
z6?S7mRR0aE!{>k9la&;K3Ja_`Y3i& ?o0VENSEuXiMB_Z}Jso2tKx`H}KzkBT
z*dKCQ@y0xTy&V|EA}UmCJF_k%JnxFBnQ2-;R6Bx!$zl^!C895e#E>f@%xZxZ5N6;C
zzG1X98?P<%oc^j8){rEPeoYY!WnBl}pDo_4g^|p5+uX>{56&~6@F!GM#NPTCNra{X
zG^Yq$4(u+tQ7Y^`1g-Dm2de-*8t>y8Z4&SB@qS+3Z57i=I~%OY#B0<$tJC+o`i_pD
zr4`wOPzQ1muSa5CK9gtb%xa0sIdpzB`qmVaR5jF>C`X@~qt8ckf(y7!^d#6ory#5D
za~4$Bh5Y@xFc-yU|iHIQmAmhx9lA`MD5MV&Fc#
zuzhia$zv}qXu;CLVy-7kXYFwOd%)32cx^z+>%1>QDkPPiY;wRIW`BJTzoWZbe!8r_
z;OE@pV#}1HsKjW=c5?-^$)c66IC@J+S#ea2%