[转载] python 调用自己的方法报错,numpy.ndarray object has no attribute brighten

参考链接: Python中的numpy.eye

在使用python写美颜算法时,出现一个bug,AttributeError: 'numpy.ndarray' object has no attribute 'brighten',brighten方法是我自己写的,然后调用。 

    im = cv.imread(src_file, cv.IMREAD_COLOR)

    thin_face=thin_face.thin_face(im,face_point,70)

    big_eye=big_eye.enlarge_eyes(thin_face,face_point,radius=20, strength=10)

    big_eye=big_eye.astype(np.uint8)

    new_face_point=read_im_and_landmarks(big_eye)

    new_face_point=read_point(face_point)    

    mouth_mask=get_face_mask(big_eye,face_point[48:61])

    red_mouth=thin_face.brighten(big_eye,mouth_mask,rate=0.7) 

错误: 

如果我将big_eye换成原图,模型就能调用并跑通,但是不是我需要的效果,查找很久,还问了大神了,发现是自己命名不规范导致的,这里记录就给自己做个提醒吧,上面自己写的方法名是thin_face,后面的结果又是thin_face,导致,后面调用混乱,所以报错,后面需要规范化写。

猜你喜欢

转载自blog.csdn.net/u013946150/article/details/112976717