GithubHelp home page GithubHelp logo

Face texture. about faceswap HOT 5 OPEN

marekkowalski avatar marekkowalski commented on August 15, 2024
Face texture.

from faceswap.

Comments (5)

MarekKowalski avatar MarekKowalski commented on August 15, 2024

Hi,
In order to map a different texture you will need to provide the texture coordinates to textureCoords in line 41 in zad2.py file. Altenatively, if the texture you want to use resembles a face, but is too hard for the landamark detector to work you can modify the getTextureCoords function to work with manually specified facial landmarks.

Marek

from faceswap.

wangbo9426 avatar wangbo9426 commented on August 15, 2024

Hi,Can you explain the function getTextureCoords?

from faceswap.

MarekKowalski avatar MarekKowalski commented on August 15, 2024

Hi,
given an imagee, this function detects the face and its landmarks.
It then fits the 3D model to the landmarks and outputs the image coordinates to which the vertices of the 3D model project to.
Marek

from faceswap.

wangbo9426 avatar wangbo9426 commented on August 15, 2024

Hi ,Thanks for your response!Actually I don't know the code details.Could you note with english?hhhhh

 def fun(self,x,params):
    #skalowanie
    s = params [0]
    #rotacja
    r = params [1:4]
    #przesuniecie(translacja)
    t = params [4:6]
    w = params [6: ]
    mean3DShape = x[0]
    blendshapes = x[1]
    #macierz rotacji z wektora rotacji, wzor Rodriguesa
    R = cv2.Rodrigues(r)[0]
    P = R[:2]
    shape3D = mean3DShape + np.sum(w[:, np.newaxis, np.newaxis] * blendshapes, axis=0)

    projected = s * np.dot(P, shape3D) + t[:, np.newaxis]

    return projected

from faceswap.

MarekKowalski avatar MarekKowalski commented on August 15, 2024

Her eit is:

 def fun(self,x,params):
    #scale
    s = params [0]
    #rotation
    r = params [1:4]
    #translation
    t = params [4:6]
    w = params [6: ]
    mean3DShape = x[0]
    blendshapes = x[1]
    # going from rotation vector to rotation matrix, Rodrigues formula
    R = cv2.Rodrigues(r)[0]
    P = R[:2]
    # 3D shape is sum of mean shape and weighted sum of blendshapes
    shape3D = mean3DShape + np.sum(w[:, np.newaxis, np.newaxis] * blendshapes, axis=0)
    # Orthographic projection
    projected = s * np.dot(P, shape3D) + t[:, np.newaxis]

    return projected

from faceswap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.