feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake
1.项目后端整体迁移至PaddleOCR-NCNN算法,已通过基本的兼容性测试 2.工程改为使用CMake组织,后续为了更好地兼容第三方库,不再提供QMake工程 3.重整权利声明文件,重整代码工程,确保最小化侵权风险 Log: 切换后端至PaddleOCR-NCNN,切换工程为CMake Change-Id: I4d5d2c5d37505a4a24b389b1a4c5d12f17bfa38c
This commit is contained in:
59
3rdparty/opencv-4.5.4/samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py
vendored
Normal file
59
3rdparty/opencv-4.5.4/samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
import sys
|
||||
import cv2 as cv
|
||||
import numpy as np
|
||||
|
||||
|
||||
def main(argv):
|
||||
## [load]
|
||||
default_file = 'smarties.png'
|
||||
filename = argv[0] if len(argv) > 0 else default_file
|
||||
|
||||
# Loads an image
|
||||
src = cv.imread(cv.samples.findFile(filename), cv.IMREAD_COLOR)
|
||||
|
||||
# Check if image is loaded fine
|
||||
if src is None:
|
||||
print ('Error opening image!')
|
||||
print ('Usage: hough_circle.py [image_name -- default ' + default_file + '] \n')
|
||||
return -1
|
||||
## [load]
|
||||
|
||||
## [convert_to_gray]
|
||||
# Convert it to gray
|
||||
gray = cv.cvtColor(src, cv.COLOR_BGR2GRAY)
|
||||
## [convert_to_gray]
|
||||
|
||||
## [reduce_noise]
|
||||
# Reduce the noise to avoid false circle detection
|
||||
gray = cv.medianBlur(gray, 5)
|
||||
## [reduce_noise]
|
||||
|
||||
## [houghcircles]
|
||||
rows = gray.shape[0]
|
||||
circles = cv.HoughCircles(gray, cv.HOUGH_GRADIENT, 1, rows / 8,
|
||||
param1=100, param2=30,
|
||||
minRadius=1, maxRadius=30)
|
||||
## [houghcircles]
|
||||
|
||||
## [draw]
|
||||
if circles is not None:
|
||||
circles = np.uint16(np.around(circles))
|
||||
for i in circles[0, :]:
|
||||
center = (i[0], i[1])
|
||||
# circle center
|
||||
cv.circle(src, center, 1, (0, 100, 100), 3)
|
||||
# circle outline
|
||||
radius = i[2]
|
||||
cv.circle(src, center, radius, (255, 0, 255), 3)
|
||||
## [draw]
|
||||
|
||||
## [display]
|
||||
cv.imshow("detected circles", src)
|
||||
cv.waitKey(0)
|
||||
## [display]
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
Reference in New Issue
Block a user