问题
I'm working on AR Android app and when I get close to a renderable I want to make the colors of the AR video stream black-and-white, except the renderables of course. I searched the docs but it seams I cannot access the video stream to do it as shown in Exploring AR interaction (Google I/O '18).
Does anyone know how to accomplish this?
回答1:
To get a video stream from ARCore requires drawing the texture into a OpenGL 3.1 Context what is being captured. You can find here how to do it.
After you've captured a video stream, the simplest way to convert colour video
/image
into grayscale one (the average of red, green, and blue) is to use a Colour Matrix
with zero saturation.
Here is an excerpt of Java code how to do it programmatically:
ColorMatrix BW_matrix = new ColorMatrix();
BW_matrix.setSaturation(0);
ColorMatrixColorFilter BW_filter = new ColorMatrixColorFilter(BW_matrix);
imageview.setColorFilter(BW_filter);
You need to apply it only to video stream from phone's camera, not to the rendered result after adding Sceneform's 3D models to the scene.
Hope this helps.
来源:https://stackoverflow.com/questions/52868954/black-and-white-video-stream-background-in-arcore-app