Пример #1
0
def mainTurnAnimationHR():
    num = 6
    # originLandmark2DHR, leftTurnLandmark2DHR, rightTurnLandmark2DHR, _ = mainTurnHR()
    originLandmark2DHR, leftTurnLandmark2DHR, rightTurnLandmark2DHR, _ = mainTurnHRHairOnEllipsoid(
    )
    imgHRPath = '../../github/vrn-07231340/examples/trump_12.png'
    imgHR = cv2.imread(imgHRPath)
    triTxtPath = './turnTri.txt'
    leftFrameList = changeExpression(originLandmark2DHR, leftTurnLandmark2DHR,
                                     triTxtPath, imgHR)
    reversedLeftFrameList = [frame for frame in reversed(leftFrameList)]
    rightFrameList = changeExpression(originLandmark2DHR,
                                      rightTurnLandmark2DHR, triTxtPath, imgHR)
    reversedRightFrameList = [frame for frame in reversed(rightFrameList)]
    finalFrameList = leftFrameList+reversedLeftFrameList + \
        rightFrameList+reversedRightFrameList
    videoPath = '../../output/{}/turn/turnHR_{}.mp4'.format(
        str(time.strftime('%m%d', time.localtime())),
        str(time.strftime('%H%M', time.localtime())))
    if not os.path.exists(os.path.dirname(videoPath)):
        os.makedirs(os.path.dirname(videoPath))
    saveAnimation(finalFrameList,
                  25,
                  videoPath,
                  imgHR,
                  time=num,
                  reverse=False)
Пример #2
0
def mainNodAnimationHR():
    time = 6
    originLandmark2DHR, nodLandmark2DHR, _ = main2D_3D_2D_HR_NodHair()
    imgHRPath = '../../github/vrn-07231340/examples/trump-12.jpg'
    imgHR = cv2.imread(imgHRPath)
    triTxtPath = './nodTri.txt'
    frameList = changeExpression(originLandmark2DHR,
                                 nodLandmark2DHR, triTxtPath, imgHR)
    saveAnimation(frameList, 25, './nodHR.mp4', imgHR, time=time, reverse=True)
Пример #3
0
def mainTurnAnimationHR():
    time = 6
    originLandmark2DHR, leftTurnLandmark2DHR, rightTurnLandmark2DHR, _ = mainTurnHR()
    imgHRPath = '../../github/vrn-07231340/examples/trump_12.png'
    imgHR = cv2.imread(imgHRPath)
    triTxtPath = './turnTri.txt'
    leftFrameList = changeExpression(originLandmark2DHR,
                                     leftTurnLandmark2DHR, triTxtPath, imgHR)
    reversedLeftFrameList = [frame for frame in reversed(leftFrameList)]
    rightFrameList = changeExpression(originLandmark2DHR,
                                      rightTurnLandmark2DHR, triTxtPath, imgHR)
    reversedRightFrameList = [frame for frame in reversed(rightFrameList)]
    finalFrameList = leftFrameList+reversedLeftFrameList + \
        rightFrameList+reversedRightFrameList
    saveAnimation(finalFrameList, 25, './turnHR.mp4',
                  imgHR, time=time, reverse=False)
Пример #4
0
def mainTurnAnimationHR():
    num = 6
    originLandmark2DHR, leftTurnLandmark2DHR, rightTurnLandmark2DHR, _ = mainTurnHR(
    )
    imgHRPath = '../../github/vrn-07231340/examples/trump_12.png'
    imgHR = cv2.imread(imgHRPath)
    triTxtPath = './turnTri.txt'
    leftFrameList = changeExpression(originLandmark2DHR, leftTurnLandmark2DHR,
                                     triTxtPath, imgHR)
    reversedLeftFrameList = [frame for frame in reversed(leftFrameList)]
    rightFrameList = changeExpression(originLandmark2DHR,
                                      rightTurnLandmark2DHR, triTxtPath, imgHR)
    reversedRightFrameList = [frame for frame in reversed(rightFrameList)]
    finalFrameList = leftFrameList+reversedLeftFrameList + \
        rightFrameList+reversedRightFrameList
    saveAnimation(finalFrameList,
                  25,
                  './turnHR_{}.mp4'.format(
                      str(time.strftime('%m%d%H%M', time.localtime()))),
                  imgHR,
                  time=num,
                  reverse=False)
Пример #5
0
def mainNodAnimation():
    HR = True
    if HR == True:
        originLandmark2DHR, nodLandmark2DHR, _ = main2D_3D_2D_LR_Hair()
        # imgPath = '../../github/vrn-07231340/examples/scaled/trump-12.jpg'
        # img = cv2.imread(imgPath)
        imgHRPath = '../../github/vrn-07231340/examples/trump-12.jpg'
        imgHR = cv2.imread(imgHRPath)

        triTxtPath = './nodTri.txt'
        frameList = changeExpression(originLandmark2DHR, nodLandmark2DHR,
                                     triTxtPath, imgHR)
        saveAnimation(frameList, 25, './nodHR.mp4', imgHR, reverse=True)
    else:
        originLandmark2D, nodLandmark2D, _ = main2D_3D_2D_LR_Hair()
        imgPath = '../../github/vrn-07231340/examples/scaled/trump-12.jpg'
        img = cv2.imread(imgPath)
        # imgHRPath = '../../github/vrn-07231340/examples/trump-12.jpg'
        # imgHR = cv2.imread(imgHRPath)

        triTxtPath = './nodTri.txt'
        frameList = changeExpression(originLandmark2D, nodLandmark2D,
                                     triTxtPath, img)
        saveAnimation(frameList, 25, './nod.mp4', img, reverse=True)
Пример #6
0
import sys
sys.path.insert(0, '../../../face_affine/exp04')
from face_affine import changeExpression, readPoints, saveAnimation
import cv2

imgPath = '../../github/vrn-07231340/examples/scaled/trump-12.jpg'
img = cv2.imread(imgPath)
originLandmark2DTxtPath = './originLandmark2D.txt'
originLandmark2DTxt = readPoints(originLandmark2DTxtPath)
nodLandmark2DTxtPath = './nodLandmark2D.txt'
nodLandmark2DTxt = readPoints(nodLandmark2DTxtPath)
triTxtPath = './nodTri.txt'
frameList = changeExpression(imgPath, originLandmark2DTxt,
                             nodLandmark2DTxt, triTxtPath, img)
saveAnimation(frameList, 25, './nod.mp4', img, reverse=True)