本文共 523 字,大约阅读时间需要 1 分钟。
import cv2def toGray(img): """将图像转换为灰度模式""" return cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)def testAlgo(img): """测试算法函数""" return imgdef detDetect(img): """检测算法入口""" return "xx,xxx,xx,xx"if __name__ == '__main__': # 函数列表存储 functionList = [toGray, testAlgo, detDetect] # 算法配置 algoConfig = { '1': functionList } # 读取图像 img = cv2.imread(r"D:\LSR\20620160408\1.bmp", cv2.IMREAD_COLOR) # 调用函数并输出结果 for fun in algoConfig['1']: print(fun(img)) 转载地址:http://rsofk.baihongyu.com/