资源简介


资源截图

代码片段和文件信息

import numpy as np
import cv2 pdb


def composite4(fg bg a):
fg = np.array(fg np.float32)
alpha= np.expand_dims(a / 255axis=2)
im = alpha * fg + (1 - alpha) * bg
im = im.astype(np.uint8)
return im

def get_bbox(maskRC):
    where = np.array(np.where(mask))
    x1 y1 = np.amin(where axis=1)
    x2 y2 = np.amax(where axis=1)

    bbox_init=[x1y1np.maximum(x2-x1y2-y1)np.maximum(x2-x1y2-y1)]


    bbox=create_bbox(bbox_init(RC))

    return bbox

def crop_images(crop_listresobbox):

    for i in range(0len(crop_list)):
        img=crop_list[i]
        if img.ndim==3:
            img_crop=img[bbox[0]:bbox[0]+bbox[2]bbox[1]:bbox[1]+bbox[3]...]; img_crop=cv2.resize(img_cropreso)
        else:
            img_crop=img[bbox[0]:bbox[0]+bbox[2]bbox[1]:bbox[1]+bbox[3]]; i

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-04-06 16:53  Background-Matting-master\
     文件        6411  2020-04-06 16:53  Background-Matting-master\README.md
     文件        1403  2020-04-06 16:53  Background-Matting-master\functions.py
     文件        8999  2020-04-06 16:53  Background-Matting-master\networks.py
     文件          59  2020-04-06 16:53  Background-Matting-master\requirements.txt
     目录           0  2020-04-06 16:53  Background-Matting-master\sample_data\
     目录           0  2020-04-06 16:53  Background-Matting-master\sample_data\background\
     文件     2094024  2020-04-06 16:53  Background-Matting-master\sample_data\background\0001.png
     文件     2409622  2020-04-06 16:53  Background-Matting-master\sample_data\background\0002.png
     目录           0  2020-04-06 16:53  Background-Matting-master\sample_data\input\
     文件     2170053  2020-04-06 16:53  Background-Matting-master\sample_data\input\0001_back.png
     文件     3047998  2020-04-06 16:53  Background-Matting-master\sample_data\input\0001_img.png
     文件     2170053  2020-04-06 16:53  Background-Matting-master\sample_data\input\0500_back.png
     文件     3341550  2020-04-06 16:53  Background-Matting-master\sample_data\input\0500_img.png
     文件     2170053  2020-04-06 16:53  Background-Matting-master\sample_data\input\1000_back.png
     文件     3474001  2020-04-06 16:53  Background-Matting-master\sample_data\input\1000_img.png
     文件     2170053  2020-04-06 16:53  Background-Matting-master\sample_data\input\1500_back.png
     文件     3044106  2020-04-06 16:53  Background-Matting-master\sample_data\input\1500_img.png
     文件        6045  2020-04-06 16:53  Background-Matting-master\test_background-matting_image.py
     文件        2766  2020-04-06 16:53  Background-Matting-master\test_pre_process.py
     文件        5006  2020-04-06 16:53  Background-Matting-master\test_segmentation_deeplab.py

评论

共有 条评论