예제 #1
0
def minmax_scale(pose):
    from ufunclab import minmax

    bbox = minmax(pose, axes=[(0, ), (1, )])[:2]
    bbox = numpy.transpose(bbox).reshape(-1)
    xywh_bbox = x1y1x2y2_to_cxywh(bbox)
    return (pose - xywh_bbox[:2]) / xywh_bbox[2:]
예제 #2
0
    def norm_mat(self, mat):
        from ufunclab import minmax

        bbox = minmax(mat, axes=[(0, ), (1, )])[:2]
        bbox = np.transpose(bbox).reshape(-1)
        xywh_bbox = x1y1x2y2_to_xywh(bbox)
        origin = np.hstack([xywh_bbox[:2], [0]])
        return xywh_bbox[2:], mat - origin
예제 #3
0
파일: pipe.py 프로젝트: frankier/skelshop
def fod_from_body_25_all_face68(skel, conf_thresh):
    face_kps = get_face_kps(skel.all())
    if not conf_thresh(face_kps[:, 2]):
        return None
    kps_existing = face_kps[:, :2][face_kps[:, 2] > 0]
    if not len(kps_existing):
        return None
    bbox = minmax(kps_existing, axes=[(0,), (1,)])
    rect = lazyimp.dlib.rectangle(
        rnd(bbox[0, 0]), rnd(bbox[1, 0]), rnd(bbox[0, 1]), rnd(bbox[1, 1])
    )
    return lazyimp.dlib.full_object_detection(
        rect, [lazyimp.dlib.point(rnd(x), rnd(y)) for x, y in face_kps[:, :2]]
    )
예제 #4
0
def test_minmax_basic(x, expected):
    mm = minmax(x)
    assert_equal(mm, expected)
예제 #5
0
파일: bbox.py 프로젝트: frankier/skelshop
def points_bbox_x1y1x2y2(points: np.ndarray):
    bbox = minmax(points, axes=[(0, ), (1, )])
    return np.transpose(bbox).reshape(-1)