lab_global_optimisation.py 文件源码

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

项目:Interactive-object-tracking 作者: abhishekarya286 项目源码 文件源码
def mask_bg(object_window,img) :
    ''' This function outputs the surrounding pixels
        Basically, image of background with masked target object'''
    global h_img,w_img
    x,y,w,h=object_window
    h_bg=h*2
    w_bg=2*w
    h_=0.5*h
    w_=0.5*w
    x_bg=int(max(x-(w_),0))
    y_bg=int(max(y-(h_),0))
    x_bg1=int(min(x_bg+w_bg,w_img-1))
    y_bg1=int(min(y_bg+h_bg,h_img-1))
    img[y:y+h,x:x+w]=0
    #print object_window
    #print x_bg,y_bg,x_bg1,y_bg1,img.shape
    bg_img=img[y_bg:y_bg1,x_bg:x_bg1]
    #cv2.imshow("masked_background",bg_img)
    #cv2.waitKey(0)
    #cv2.destroyAllWindows()
    return bg_img
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号