python - 函数中的文档输入和返回值:python
问题描述
我具有以下文档的以下功能:
def plate_detect(img,cascade_classifier):
"""
:param img: src image
:param cascade_classifier: var under cv2.CascadeClassifier
:return: tuple[0] = img with rectangle over the features
:return: tuple[1] tuple[2]= top left, bottom right coordinate
:return: tuple[3] tuple[4]= width height
"""
img_copy = np.copy(img)
plate_cascade = cascade_classifier
parameters = plate_cascade.detectMultiScale(img_copy, scaleFactor=1.2, minNeighbors=5) #
# receive x,y ,width, high
for (x, y, width, height) in parameters:
cv2.rectangle(img_copy, (x, y), (x + width, y + height), (255), 5)
return img_copy, parameters[0,0], parameters[0,1],parameters[0,2],parameters[0,3]
希望输出文档比这个更好:
def plate_detect(img:any, cascade_classifier:any) -> tuple[any,any,any,any,any]
python是否允许更好地记录输入和返回值而不是“任何”?
解决方案
推荐阅读
- multithreading - Haskell:TMVar 与 MVar
- javascript - 从数组中分区数据并存储在变量中(Javascript / JSON)
- c# - 连接尝试失败,因为连接方在一段时间后没有正确响应 - 仅在 aws 服务器中存在问题
- node.js - 使用gql无法连接到数据库Nest js e2e测试
- ms-access - 表单有时会以选项卡式文档的形式打开,有时则不会
- sql-server-2012 - 将数据从 SQL Server 迁移到 dBASE
- javascript - JQuery 将多个子内容附加到父元素
- javascript - 是否可以在不先使用 PHP 将文件存储在我的服务器上的情况下将文件上传到 Dropbox?
- javascript - 如何使用 Javascript 添加 SVG 元素
- single-page-application - 在 aspnetboilerplate 中的状态代码 400 之后是否可以重定向到登录页面?