generate_defect.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:Seg 作者: gxd1994 项目源码 文件源码
def generate_blur(img,label_img,num,ratio_h,ratio_w):
    rect_list = random_rect(num,img.shape,ratio_h,ratio_w)
    ksize = 20
    handle_img = np.copy(img)
    rect = rect_list[0]
    x,y,h,w = rect
    roi = handle_img[y:y+h,x:x+w]
    handle_img[y:y+h,x:x+w] = cv2.blur(roi,(ksize,ksize))

    pixelpoints,_ = convex_hull_generate(img,rect,10)

    label_img[pixelpoints] = 255

    # print pixelpoints
    img[pixelpoints] = handle_img[pixelpoints]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号