Hi there,
I'm trying to implement motion processing using opencv java api.
I used and applied opencv camera preview android sample application. The motion processing is working now, but processed preview is super slow, Is there any way I can improve preview speed? The motion processing part is just like below.
@Override public Mat onCameraFrame(CvCameraViewFrame inputFrame) { minputMat = inputFrame.rgba(); // TODO Auto-generated method stub Imgproc.blur(m_inputMat, mdstMat, m_kSize); ... Imgproc.accumulateWeighted(mdstMat, mmotionAvgMat, .03); Core.convertScaleAbs(m_motionAvgMat, mscaleMat); Core.absdiff(mdstMat, m_scaleMat, m_diffMat); Imgproc.cvtColor(m_diffMat, mgrayMat, Imgproc.COLOR_BGR2GRAY); Imgproc.threshold(mgrayMat, mgrayMat, 25, 255, Imgproc.THRESH_BINARY); m_motionPercent = 100.0 * Core.countNonZero(mgrayMat) / m_totalPixels; ....
return m_inputMat;
}
Thank you!