Applying real time filters

321 views
Skip to first unread message

Harshit Jain

unread,
Aug 6, 2020, 7:05:08 AM8/6/20
to Android CameraX Discussion Group
how can we apply real time filters like Black and white view or cartoon view, while using camerax api.

Vinit Modi

unread,
Aug 6, 2020, 10:58:03 AM8/6/20
to Harshit Jain, Android CameraX Discussion Group
One option is to use the ImageAnalysis use case, input those frames into your algorithm and then based on the output display the effects on the preview stream. This will likely require you to sync preview and analysis frames.

Another option is to run your algorithms on the preview use case itself. Thanks,

Vinit 

On Thu, Aug 6, 2020, 4:05 AM Harshit Jain <jainhar...@gmail.com> wrote:
how can we apply real time filters like Black and white view or cartoon view, while using camerax api.

--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/53154a9c-1ee2-49dd-a5ef-d3f40e8f1095n%40android.com.

Harshit Jain

unread,
Aug 6, 2020, 12:01:08 PM8/6/20
to Android CameraX Discussion Group, Vinit Modi, Android CameraX Discussion Group, Harshit Jain
Thnx, I will go through this

Waqar Mumtaz

unread,
Oct 20, 2020, 1:57:21 AM10/20/20
to Android CameraX Discussion Group, jainhar...@gmail.com, Vinit Modi, Android CameraX Discussion Group
Have any of you tried to apply any kind of image processing before previewing the image on screen; So that one can apply real time filters?
Moreover, is there any demo app or sample code which shows how to extract frame before even previewing that; so that it can be pre-processed.

Scott Nien

unread,
Oct 22, 2020, 4:19:23 AM10/22/20
to Waqar Mumtaz, Android CameraX Discussion Group, jainhar...@gmail.com, Vinit Modi
Preview use case actually allows apps to provide their own Surface via Preview#setSurfaceProvider().  This means you can provide the surface from a SurfaceTexture and this SurfaceTexture can be a Texture in an openGL pipeline where you can apply your filter.   

See our OpenGL sample.  It might help. 
https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-master-dev/camera/integration-tests/coretestapp/src/main/java/androidx/camera/integration/core/OpenGLActivity.java


Astha Garg

unread,
Jan 3, 2023, 3:26:47 AM1/3/23
to Android CameraX Discussion Group, Vinit Modi, Android CameraX Discussion Group, jainhar...@gmail.com
Hi Vinit,

I also used ImageAnalysis use case to show the real-time filter on an ImageView on top of PreviewView but it does not allow capturing the image with filter.
Also, the save is handled by CameraX internally so how can we support capturing the filter applied previewview?

On Thursday, August 6, 2020 at 8:28:03 PM UTC+5:30 Vinit Modi wrote:
Reply all
Reply to author
Forward
0 new messages