我正在使用this library for GPUImage processing。MultiInputFilter不適用於AndroidFastImageProcessing中的3個輸入
我試圖並行運行的過濾器就像我們在iOS GPUImage庫做的,但我有問題,同時加入3個輸入延伸MultiInputFilter
一個過濾器。 我想結合
BasicCameraInputFilter
CannyEdgeDetectionFilter
SobelEdgeDetectionFilter
其中BasicCameraInputFilter
是直接的攝像機輸入。
BasicCameraInputFilter cameraInput = new BasicCameraInputFilter();
CannyEdgeDetectionFilter cannyEdgeDetectionFilter = new CannyEdgeDetectionFilter(1.0f,0.3f,0.6f);
SobelEdgeDetectionFilter sobelEdgeDetectionFilter = new SobelEdgeDetectionFilter();
CombinationFilter combinationFilter = new CombinationFilter();
cameraInput.addTarget(combinationFilter);
cannyEdgeDetectionFilter.addTarget(combinationFilter);
sobelEdgeDetectionFilter.addTarget(combinationFilter);
combinationFilter.registerFilterLocation(cameraInput,0);
combinationFilter.registerFilterLocation(cannyEdgeDetectionFilter,1);
combinationFilter.registerFilterLocation(sobelEdgeDetectionFilter,2);
combinationFilter.addTarget(this);
registerInitialFilter(cameraInput);
registerFilter(cannyEdgeDetectionFilter);
registerFilter(sobelEdgeDetectionFilter);
registerTerminalFilter(combinationFilter);
這裏是我的片段着色器爲我CombinationFilter
"precision mediump float;\n"
+"uniform sampler2D " + UNIFORM_TEXTURE0 + ";\n"
+"uniform sampler2D " + UNIFORM_TEXTUREBASE + 1 + ";\n"
+"uniform sampler2D " + UNIFORM_TEXTUREBASE + 2 + ";\n"
+"varying vec2 " + VARYING_TEXCOORD + ";\n"
+"void main(){\n"
+" vec4 color1 = texture2D(" + UNIFORM_TEXTURE0 + ", " + VARYING_TEXCOORD + ");\n"
+" vec4 color2 = texture2D(" + UNIFORM_TEXTUREBASE + 1 + ", " + VARYING_TEXCOORD + ");\n"
+" vec4 color3 = texture2D(" + UNIFORM_TEXTUREBASE + 2 + ", " + VARYING_TEXCOORD + ");\n"
+" vec4 whiteColor = vec4(1.0);\n"
+" whiteColor.r = color1.r * color2.r * color3.r;\n"
+" whiteColor.g = color1.g * color2.g * color3.g;\n"
+" whiteColor.b = color1.b * color2.b * color3.b;\n"
+" gl_FragColor = whiteColor;\n"
+"}\n";
你有什麼問題? – Brian
您已經發布了一個明確定義的示例。但問題是什麼?你能向我們展示錯誤信息或意外結果的截圖嗎? – Rabbid76
有沒有錯誤,它只是不工作,我們不能調試着色器正確.. – Thesoham24