예제 #1
0
def pwa_demo(datadir='data/CK'):
    images, shapes, mean_shape = get_random_faces(datadir)
    transformed = [
        pwa.warp(im, shape, mean_shape) for im, shape in zip(images, shapes)
    ]
    # implot(zip(images, transformed)) # interlieve, not zip!
    implot(images + transformed)
예제 #2
0
 def test_facedet(self):
     im_file_path = glob(join(self.data_dir, 'images/*'))[0]
     im = imread(im_file_path)
     rects = facedet(im)
     for i, j, h, w in rects:
         cv2.rectangle(im, (j, i), (j + w, i + h),
                       color=(0, 255, 0),
                       thickness=3)
     implot(im)
예제 #3
0
 def test_basic_pwa(self):
     data_tuples = read_images_and_landmarks(self.data_dir)
     im0, lms0 = data_tuples[0]
     tri0 = delaunay(lms0)
     im0 = draw_tri(im0, lms0, tri0)
     im1, lms1 = data_tuples[1]
     tri1 = delaunay(lms1)
     im1 = draw_tri(im1, lms1, tri1)
     im1to0 = pwa.warpTriangle(im1, lms1[:, [1, 0]], lms0[:, [1, 0]], tri1,
                               im0.shape)
     implot([im0, im1, im1to0])
예제 #4
0
파일: pwa_test.py 프로젝트: dfdx/masque
 def test_basic_pwa(self):
     data_tuples = read_images_and_landmarks(self.data_dir)
     im0, lms0 = data_tuples[0]        
     tri0 = delaunay(lms0)
     im0 = draw_tri(im0, lms0, tri0)        
     im1, lms1 = data_tuples[1]        
     tri1 = delaunay(lms1)
     im1 = draw_tri(im1, lms1, tri1)
     im1to0 = pwa.warpTriangle(im1, 
                               lms1[:, [1, 0]], lms0[:, [1, 0]],
                               tri1, im0.shape)
     implot([im0, im1, im1to0])
예제 #5
0
 def test_delaunay(self):
     im, lms = read_images_and_landmarks(self.data_dir)[0]
     tri = delaunay(lms)
     implot(draw_tri(im, lms, tri))
예제 #6
0
 def test_draw_landmarks(self):
     images_and_landmarks = read_images_and_landmarks(self.data_dir)[:4]
     marked_images = [
         draw_landmarks(im, lm) for im, lm in images_and_landmarks
     ]
     implot(marked_images)
예제 #7
0
파일: pwa.py 프로젝트: dfdx/masque
def pwa_demo(datadir='data/CK'):
    images, shapes, mean_shape = get_random_faces(datadir)
    transformed = [pwa.warp(im, shape, mean_shape) 
                   for im, shape in zip(images, shapes)]
    # implot(zip(images, transformed)) # interlieve, not zip!
    implot(images + transformed)