The forum on this site is closed for new comments and posts. Continue the conversation in the new forum, and learn more here.

Updating face texture doesn't update preview

  • Hi Marco,

    FaceTextureProvider is meant for cropping faces from the live camera feed at runtime. The cropped area will always be relative to faces found on the device camera texture, not the "inputTexture" being passed in.

    Usually the reason to set inputTexture is to control which Render Target or Device Camera Texture is being used for rendering, to choose which effects should be rendered over the face. For example, you could use Device Camera Texture as input to render the face with no effects, or you could use your main Render Target as input to render the face with whatever effects have already been applied to it that frame.

    So unfortunately, there's no way to detect a face on an arbitrary input texture, except maybe by using MLComponent and training a model to do this. Or, if you are using the image picker specifically, you can use a Face Image Picker texture.

    I'm not sure what your use case is, but maybe you could crop the faces out ahead of time, if they aren't dynamic? If you want, I can try pointing you in the right direction if you give a little more context

    Thanks,
    Jacob

    Comment actions Permalink
  • Thanks but in my case the user will be uploading pictures that have a face on the camera roll and I need to extract the face and run through my snapML model. I don't want to add another face detection model since it's heavy and snap already has one builtin.

    Comment actions Permalink
  • It sounds like you could use a Face Image Picker texture, then call copyFrame() on it every time a selection is made. Store these copies in your array and you can use them directly as textures. As long as "Crop to Face" is enabled on the Face Image Picker texture asset, they'll already be cropped to the user's face.

    // @input Asset.Texture faceImagePickerTexture

    var faceTextures = [];

    // Set a callback for when the user picks a different image from the image picker
    script.faceImagePickerTexture.control.setImageChangedCallback(function(){
    // Copy the texture
    var newTexture = script.faceImagePickerTexture.copyFrame();

    // Store the new texture
    faceTextures.push(newTexture);
    });

    Then later you can just use the stored textures directly like:

    script.image.mainPass.baseTex = faceTextures[0]; // Use whatever index you need

    Hope this works for you. Let me know if you need any more help!

    Jacob

    Comment actions Permalink

We're here to help! We just need a little bit of information...

What system are you using?

Have you downloaded the latest version of Lens Studio?

Please download the latest version of Lens Studio. If you still run into this issue, please come back and report it!

Is this issue causing Lens Studio to crash?

What system do you run Lens Studio on?

Version

Graphics

Follow the next steps to help us solve your issue:

  • Copy and paste this text into your TerminalCommand Window
    open ~/Library/Preferences/Snap/Lens\ Studio/ %LOCALAPPDATA%\Snap\Lens Studio Copy Text
  • Press ReturnEnter to run the command. The Lens Studio folder will automatically open
  • Prepare to upload your files: zip the "Log" Folder by right-clicking and choosing "compress."
    Locate the Log.txt file right above it.

    Attach a screenshot of the issue:

Name:

Email:

What is this most relevant to?

Please enter a brief description of your issue:

Thanks for submitting this issue.

Unfortunately, it's likely due to the operating system or hardware you're using – since they don't meet the system requirements for Lens Studio.

Still, we hear you loud and clear, and are logging the issue in case there's ever a workaround we can provide!

Minimum Requirements

Operating System: Windows 10 (64 bit); MacOS 10.11+

Hardware: Minimum of Intel Core i3 2.5Ghz or AMD Phenom II 2.6Ghz with 4 GB RAM; Intel HD Graphics 4000 / Nvidia GeForce 710 / AMD Radeon HD 6450 or better; screen resolution of 1280x768 or higher

We'll try to resolve this issue as soon as possible. Thanks for letting us know about it!

Keep an eye out for a followup email from us. We may have a couple more questions for you, or we might already have a solution to offer.

Happy creating!