Methods Summary |
---|
public void | createProgram(android.filterfw.core.FilterContext context, android.filterfw.core.FrameFormat format)
mInputBPP = format.getBytesPerSample();
if (mLastFormat != null && mLastFormat.getBytesPerSample() == mInputBPP) return;
mLastFormat = format;
switch (mInputBPP) {
case 1:
mProgram = new NativeProgram("filterpack_imageproc", "gray_to_rgba");
break;
case 3:
mProgram = new NativeProgram("filterpack_imageproc", "rgb_to_rgba");
break;
default:
throw new RuntimeException("Unsupported BytesPerPixel: " + mInputBPP + "!");
}
|
public android.filterfw.core.FrameFormat | getConvertedFormat(android.filterfw.core.FrameFormat format)
MutableFrameFormat result = format.mutableCopy();
result.setMetaValue(ImageFormat.COLORSPACE_KEY, ImageFormat.COLORSPACE_RGBA);
result.setBytesPerSample(4);
return result;
|
public android.filterfw.core.FrameFormat | getOutputFormat(java.lang.String portName, android.filterfw.core.FrameFormat inputFormat)
return getConvertedFormat(inputFormat);
|
public void | process(android.filterfw.core.FilterContext context)
// Get input frame
Frame input = pullInput("image");
createProgram(context, input.getFormat());
// Create output frame
Frame output = context.getFrameManager().newFrame(getConvertedFormat(input.getFormat()));
// Process
mProgram.process(input, output);
// Push output
pushOutput("image", output);
// Release pushed frame
output.release();
|
public void | setupPorts()
MutableFrameFormat mask = new MutableFrameFormat(FrameFormat.TYPE_BYTE,
FrameFormat.TARGET_NATIVE);
mask.setDimensionCount(2);
addMaskedInputPort("image", mask);
addOutputBasedOnInput("image", "image");
|