1

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?

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
ManuelTS
  • 316
  • 4
  • 14

1 Answers1

2

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.

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
  • Thanks for your reply. I went on with other things in my project, but I put your post into my TODO list and when I hit this very topic again I will circle back here and try it. My feedback and maybe a mark as solution will come definitely. – ManuelTS Oct 30 '18 at 10:48
  • Ok, I'll be waiting for a result. – Andy Jazz Oct 30 '18 at 10:50
  • how yo you apply the transformation to the video stream from the phone camera? – amarkovits May 23 '19 at 12:46