artoolkitx / artoolkitx

artoolkitX, providing high-performance video acquisition, marker and texture tracking for augmented reality, in native code for iOS, Android, macOS, Windows, and Linux variants.
https://www.artoolkitx.org/
Other
460 stars 126 forks source link

ARActivity portrait orientation with rotated camera #129

Open kanoe92 opened 3 years ago

kanoe92 commented 3 years ago

Is it possible to use ARActivity in portrait mode? I've tried to manually setRequestedOrientation in my Activity:

this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

This changes orientation from landscape to portrait but camera view isn't rotated. Is there a way to rotate camera view and use it in fullscreen? I've seen method drawVideoSettings(int videoSourceIndex, int width, int height, boolean rotate90, boolean flipH, boolean flipV, int hAlign, int vAlign, int scalingMode, int[] viewport) in ARController. Is it something that might help?

Any help will be appreciated, thanks.

shb3014 commented 1 year ago

I run into the same issue. If I set the orientation to portrait and use drawVideoSettings with rotate90 as true, I'll get the right camera preview but wrong tracking. The tracking still seems to be based on a landscape camera feed. Should I rotate the image acquired by ImageReader in order to get the right tracking? or is there a better way to do this?