36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
|
|
import cv2
|
||
|
|
from .builder import ITEMS
|
||
|
|
from .pipelines import Compose
|
||
|
|
|
||
|
|
|
||
|
|
@ITEMS.register_module()
|
||
|
|
class Body(object):
|
||
|
|
def __init__(self, **kwargs):
|
||
|
|
pipeline = [
|
||
|
|
dict(type='LoadBodyImageFromFile', body_path=kwargs['body_path']),
|
||
|
|
# dict(type='ImageShow', key=['body_image', "body_mask"])
|
||
|
|
]
|
||
|
|
self.pipeline = Compose(pipeline)
|
||
|
|
self.result = dict()
|
||
|
|
|
||
|
|
def process(self):
|
||
|
|
self.pipeline(self.result)
|
||
|
|
pass
|
||
|
|
|
||
|
|
def organize(self, layer):
|
||
|
|
body_layer = dict(priority=0,
|
||
|
|
name=type(self).__name__.lower(),
|
||
|
|
image=self.result['body_image'],
|
||
|
|
image_url=self.result['image_url'],
|
||
|
|
mask_image=None,
|
||
|
|
mask_url=None,
|
||
|
|
sacle=1,
|
||
|
|
# mask=self.result['body_mask'],
|
||
|
|
position=(0, 0))
|
||
|
|
layer.insert(body_layer)
|
||
|
|
|
||
|
|
@staticmethod
|
||
|
|
def show(img):
|
||
|
|
cv2.imshow('', img)
|
||
|
|
cv2.waitKey(0)
|