我正在尝试通过 opencv 在 android 中创建卡通或素描效果,因为我正在使用 Website 中解释的逻辑
由此我尝试在 android 中创建。这是我的代码
public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
Imgproc.bilateralFilter(inputFrame.gray(),co,9, 9, 7);
Imgproc.medianBlur(inputFrame.gray(),gray, 7);
Imgproc.adaptiveThreshold(gray,gray, 255, Imgproc.ADAPTIVE_THRESH_MEAN_C,Imgproc.THRESH_BINARY,9,2);
Core.bitwise_and(co,gray,mOutputFrame);//ADDS THE BOTH IMAGES
return mOutputFrame;
}
这有效,但输出为灰色。 如何获得彩色?
最佳答案
来自documentation CameraBridgeViewBase.CvCameraViewFrame
方法 gray()
从帧中返回灰度图像。因此,将其更改为 rgba()
将返回要传递给您正在使用的过滤器的 RGB 彩色图像。
关于java - android OpenCV中的卡通效果(需要从灰色转换为彩色),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38300361/