Can OverlayEffect be used together with CameraEffect?

107 views
Skip to first unread message

Hong Wang (LazyIonEs)

unread,
Nov 6, 2024, 4:57:25 AM11/6/24
to Android CameraX Discussion Group
Can OverlayEffect be used together with CameraEffect?  They have common targets, for example,  Use PREVIEW or VIDEO_CAPTURE together. I used these two at the same time and the camera cannot be turned on. What should I do?
```
userCaseBuilder.addEffect(CameraEffect)
userCaseBuilder.addEffect(OverlayEffect)
```

Xi Zhang (张熹)

unread,
Nov 6, 2024, 12:42:30 PM11/6/24
to Hong Wang (LazyIonEs), Scott Nien, Android CameraX Discussion Group
The CameraEffect API, by design, is a hook for inserting code. So it doesn't support chaining by nature. 

However, it's not difficult to create a CameraEffect that composites multiple CameraEffect implementations. Pseudo code:

SurfaceProsessor {
   val wrappedProcessor1
   val wrappedProcessor2
   onInputSurface(surfaceRequest) {
      // 1. send surfaceRequest to wrapperProcessor1
      // 2. create a SurfaceOutput that mimic the surfaceRequest and send to wrapperProcessor1
      // 3. create a second surfaceRequest and send to wrappedProcessor2
   } 
    onOutpuSurface(surfaceOutput) {
       // send surfaceOutput to wrappedProcessor2
    }
}

The challenging part is calculating the transformation needed in step2.  This might be a useful feature for the CameraX team to build in camera-effects. Adding Scott to triage.

--
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 visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/c9a6ef70-92dc-436a-a518-e740f8383467n%40android.com.

Hong Wang (LazyIonEs)

unread,
Nov 10, 2024, 8:26:24 PM11/10/24
to Android CameraX Discussion Group, xi...@google.com, Android CameraX Discussion Group, Hong Wang, scot...@google.com
OK, I understand, I'll try it.
Reply all
Reply to author
Forward
0 new messages