首页 > 解决方案 > 函数中的文档输入和返回值: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是否允许更好地记录输入和返回值而不是“任何”?

标签: python

解决方案


推荐阅读