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]
评论列表
文章目录