feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake
1.项目后端整体迁移至PaddleOCR-NCNN算法,已通过基本的兼容性测试 2.工程改为使用CMake组织,后续为了更好地兼容第三方库,不再提供QMake工程 3.重整权利声明文件,重整代码工程,确保最小化侵权风险 Log: 切换后端至PaddleOCR-NCNN,切换工程为CMake Change-Id: I4d5d2c5d37505a4a24b389b1a4c5d12f17bfa38c
This commit is contained in:
54
3rdparty/opencv-4.5.4/samples/python/tutorial_code/imgProc/threshold/threshold.py
vendored
Normal file
54
3rdparty/opencv-4.5.4/samples/python/tutorial_code/imgProc/threshold/threshold.py
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
from __future__ import print_function
|
||||
import cv2 as cv
|
||||
import argparse
|
||||
|
||||
max_value = 255
|
||||
max_type = 4
|
||||
max_binary_value = 255
|
||||
trackbar_type = 'Type: \n 0: Binary \n 1: Binary Inverted \n 2: Truncate \n 3: To Zero \n 4: To Zero Inverted'
|
||||
trackbar_value = 'Value'
|
||||
window_name = 'Threshold Demo'
|
||||
|
||||
## [Threshold_Demo]
|
||||
def Threshold_Demo(val):
|
||||
#0: Binary
|
||||
#1: Binary Inverted
|
||||
#2: Threshold Truncated
|
||||
#3: Threshold to Zero
|
||||
#4: Threshold to Zero Inverted
|
||||
threshold_type = cv.getTrackbarPos(trackbar_type, window_name)
|
||||
threshold_value = cv.getTrackbarPos(trackbar_value, window_name)
|
||||
_, dst = cv.threshold(src_gray, threshold_value, max_binary_value, threshold_type )
|
||||
cv.imshow(window_name, dst)
|
||||
## [Threshold_Demo]
|
||||
|
||||
parser = argparse.ArgumentParser(description='Code for Basic Thresholding Operations tutorial.')
|
||||
parser.add_argument('--input', help='Path to input image.', default='stuff.jpg')
|
||||
args = parser.parse_args()
|
||||
|
||||
## [load]
|
||||
# Load an image
|
||||
src = cv.imread(cv.samples.findFile(args.input))
|
||||
if src is None:
|
||||
print('Could not open or find the image: ', args.input)
|
||||
exit(0)
|
||||
# Convert the image to Gray
|
||||
src_gray = cv.cvtColor(src, cv.COLOR_BGR2GRAY)
|
||||
## [load]
|
||||
|
||||
## [window]
|
||||
# Create a window to display results
|
||||
cv.namedWindow(window_name)
|
||||
## [window]
|
||||
|
||||
## [trackbar]
|
||||
# Create Trackbar to choose type of Threshold
|
||||
cv.createTrackbar(trackbar_type, window_name , 3, max_type, Threshold_Demo)
|
||||
# Create Trackbar to choose Threshold value
|
||||
cv.createTrackbar(trackbar_value, window_name , 0, max_value, Threshold_Demo)
|
||||
## [trackbar]
|
||||
|
||||
# Call the function to initialize
|
||||
Threshold_Demo(0)
|
||||
# Wait until user finishes program
|
||||
cv.waitKey()
|
Reference in New Issue
Block a user