When creating a CameraEffect using PREVIEW or VIDEO_CAPTURE, the filter effects implemented in OpenGL are rotated.

64 views
Skip to first unread message

Hong Wang (LazyIonEs)

unread,
Apr 27, 2026, 9:04:56 AMApr 27
to Android CameraX Discussion Group
When creating a CameraEffect using PREVIEW or VIDEO_CAPTURE, the filter effects implemented in OpenGL are rotated.When I change the targets to PREVIEW, it displays correctly again; currently, I am using surfaceOutput.updateTransformMatrix to correct the rotation, which works correctly in PREVIEW, but is rotated again when combined with VIDEO_CAPTURE. What should I do?

Leo Huang

unread,
Apr 27, 2026, 12:12:44 PMApr 27
to Android CameraX Discussion Group, lazy...@gmail.com

Hi,

If you are looking to apply post-processing effects to your output, you can find a sample implementation of tone mapping in the official CameraX test app repository. The sample demonstrate how to use the CameraEffect and SurfaceProcessor APIs for different use cases.

Here are the link to the sample implementations:

To help us better understand the specific issue you are facing, could you please provide a code snippet of how you are currently implementing the effect or configuring your pipeline?

Thanks!


lazy...@gmail.com 在 2026年4月27日 星期一晚上9:04:56 [UTC+8] 的信中寫道:

Hong Wang (LazyIonEs)

unread,
Apr 27, 2026, 9:18:27 PMApr 27
to Android CameraX Discussion Group, leoh...@google.com, Hong Wang
I'm currently using CopyingSurfaceProcessor to implement my filter effect. By applying updateTransformMatrix to different SurfaceOutputs, this problem doesn't occur.

Someone has already replied to my question, and thank you again for your reply.

The issue regarding the rotation of OpenGL filters when using both PREVIEW and VIDEO_CAPTURE occurs because these surfaces require distinct transformation adjustments. The surface transformation matrix corresponds to the specific requirements of each output target, which differ due to the way sensor orientation and display rotation are handled.

To resolve this, please ensure you apply the updateTransformMatrix method specifically to each SurfaceOutput instance individually, rather than applying a global correction. Verify the target type of each surface within your implementation and apply the transformation calculation specific to that individual surface.

Leo Huang

unread,
Apr 27, 2026, 10:34:05 PMApr 27
to Hong Wang (LazyIonEs), Android CameraX Discussion Group
Glad to hear that the issue is resolved. Thank you for sharing these details and your findings with the community. Please don't hesitate to reach out if you have any further questions.

Hong Wang (LazyIonEs) <lazy...@gmail.com> 於 2026年4月28日週二 上午9:18寫道:
Reply all
Reply to author
Forward
0 new messages