Flip the image horizontally

Hi, I’m testing the shoe try-on project for an installation in which the screen needs to appear as a mirror, so that when a user walks across the frame, the video tracks in the same direction.

How can I flip the camera horizontally to achieve this effect? - So far it doesn’t look like there’s an option for ‘flip’, ‘reverse’ or similar in the api refs, and setting a scale on the canvas context gives a build error.

Cheers!
Mike

Hey @Mike

There are a couple of tricks that may solve this issue for you.

Firstly, you can try setting the DeepAR camera facing mode differently (environment or user)

        const deepAR = await deepar.initialize({
          licenseKey: "your_license_key_here",
          canvas: document.getElementById("deepar-canvas"),
          effect: "https://demo.deepar.ai/assets/foot/airmax",
          // set camera to front-facing
          additionalOptions: {
            cameraConfig: {
              facingMode: "environment",
            },
          },
        });

You could also flip the canvas using CSS with transform: rotateY(180deg)

If neither of those work, feel free to post any relevant part of your code here or email it over at zak@deepar.ai and we can take a closer look.

Cheers!

Zak

1 Like

Yes! - Both of these methods works a treat!

Thanks!

1 Like