Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use a portrait resolution? #1294

Open
emoto-yasushi opened this issue Jan 6, 2025 · 1 comment
Open

How to use a portrait resolution? #1294

emoto-yasushi opened this issue Jan 6, 2025 · 1 comment
Labels
type:support Support issue

Comments

@emoto-yasushi
Copy link

Plugin Version or Commit ID

v0.15.0

Unity Version

2022.3.6f1

Your Host OS

Windows11 Home

Target Platform

UnityEditor, Windows Standalone, Android

Description

I want to use a portrait resolution for the camera on Android and iOS.
By default, it looks like only landscape resolutions are included in the list.
image

Therefore, I added new resolutions to AppSettings.asset and AppSettings.cs.

However, this doesn’t seem to work internally.
Is there a way to support portrait resolutions?

Code to Reproduce the issue

  1. I’m trying to use a vertical (portrait) resolution, but it’s not working properly. Here’s what I’ve tried:

  2. Created a new Unity project and imported MediaPipeUnity.0.15.0.unitypackage.

  3. Opened Assets/MediaPipeUnity/Samples/Scenes/Face Landmark Detection/Face Landmark Detection.unity.

  4. In AppSettings.asset (/Assets/MediaPipeUnity/Samples/Scenes/AppSettings.asset), I added the 720x1280 resolution.
    image

  5. In AppSettings.cs (/Assets/MediaPipeUnity/Samples/Common/Scripts/AppSettings.cs), I added:
    new ImageSource.ResolutionStruct(720, 1280, 30),
    image

  6. In the Unity Editor’s Game view, I clicked the camera icon, selected 720x1280 under Image Source Settings > Resolution, and pressed Exit to apply the changes.
    image

  7. I selected Main Canvas/Container Panel/Body/Annotatable Screen, double-clicked on the Raw Image/Texture field, and checked the camera resolution in the Default UI Material.
    image

  8. Even though the chosen resolution is 720x1280, the internal resolution shown in the Default UI Material ends up being something random like 800x600.
    image

Additional Context

No response

@emoto-yasushi emoto-yasushi added the type:support Support issue label Jan 6, 2025
@homuler
Copy link
Owner

homuler commented Jan 6, 2025

Does the camera you are using support the specified resolution?
If you simply want to place a horizontally-oriented camera vertically, you may want to specify (hardcode) the RotationAngle (e.g. RotationAngle.Rotation90).

public override RotationAngle rotation => !isPrepared ? RotationAngle.Rotation0 : (RotationAngle)webCamTexture.videoRotationAngle;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:support Support issue
Projects
None yet
Development

No branches or pull requests

2 participants