title: Negative image filter to Black & White mode
body: <p>I am using <a href="https://github.com/natario1/CameraView" rel="nofollow noreferrer">https://github.com/natario1/CameraView</a> this library for capturing a negative image to positive and it is using the openGl shaders. I need a filter in which I can capture a negative image to positive in Black &amp; White mode not in the normal color mode (which is currently available in the library). I tried to mix the two filters i.e first capture the negative image to positive in color mode and then apply the Black &amp; White mode filter but as I am new to openGl, I was unable to do this. Please help me in this regard. It would be highly appreciated. The shaders which I am using are as follows :</p>
  
  <pre><code>This shader is used to convert the negative to positive in color mode.
  
  private final static String FRAGMENT_SHADER = "#extension GL_OES_EGL_image_external : require\n"
              + "precision mediump float;\n"
              + "varying vec2 "+DEFAULT_FRAGMENT_TEXTURE_COORDINATE_NAME+";\n"
              + "uniform samplerExternalOES sTexture;\n"
              + "void main() {\n"
              + "  vec4 color = texture2D(sTexture, "+DEFAULT_FRAGMENT_TEXTURE_COORDINATE_NAME+");\n"
              + "  float colorR = (1.0 - color.r) / 1.0;\n"
              + "  float colorG = (1.0 - color.g) / 1.0;\n"
              + "  float colorB = (1.0 - color.b) / 1.0;\n"
              + "  gl_FragColor = vec4(colorR, colorG, colorB, color.a);\n"
              + "}\n";
  
  This shader is used to change the normal positive image in Black &amp; White mode.
  
  private final static String FRAGMENT_SHADER = "#extension GL_OES_EGL_image_external : require\n"
              + "precision mediump float;\n"
              + "varying vec2 "+DEFAULT_FRAGMENT_TEXTURE_COORDINATE_NAME+";\n"
              + "uniform samplerExternalOES sTexture;\n" + "void main() {\n"
              + "  vec4 color = texture2D(sTexture, "+DEFAULT_FRAGMENT_TEXTURE_COORDINATE_NAME+");\n"
              + "  float colorR = (color.r + color.g + color.b) / 3.0;\n"
              + "  float colorG = (color.r + color.g + color.b) / 3.0;\n"
              + "  float colorB = (color.r + color.g + color.b) / 3.0;\n"
              + "  gl_FragColor = vec4(colorR, colorG, colorB, color.a);\n"
              + "}\n";
  
  Please help in making a filter which can direct capture the negative image to positive in Black &amp; White mode.
  
  Thanks.
  </code></pre>