Problem showing HSV image with user-defined color range

asked 2013-05-27 02:50:39 -0500

Hello, I'm a newbie in programming in OpenCV4Android. I can't show the result image when the user modify the parameter for the hsv image.

My Code

@Override
public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
    final int viewMode = mViewMode;

    switch (viewMode) { 
      case VIEW_MODE_HSV:
          mRGBMat = inputFrame.rgba();
          Imgproc.cvtColor(mRGBMat, mShowMat, Imgproc.COLOR_RGB2HSV, 4);
          //Imgproc.cvtColor(mRGBMat, mHSVMat, Imgproc.COLOR_RGB2HSV, 3);
          //Core.inRange(mHSVMat, new Scalar(h_min,s_min,v_min), new Scalar(h_max,s_max,v_max), mShowMat);
          //Imgproc.cvtColor(mHSVMat, mTempMat, Imgproc.COLOR_GRAY2BGR, 0);
          //Imgproc.cvtColor(mTempMat, mTempMat2, Imgproc.COLOR_BGR2RGBA, 0);
          //mFilteredFrame.setTo(new Scalar(0, 0, 0));
          //mShowMat.copyTo(mFilteredFrame, mTempMat);
          break;
      case VIEW_MODE_RGBA: 
          mShowMat = inputFrame.rgba();
          break;
    }
    return mShowMat;
}

when I choose HSV the application hang-up. I hope somebody can help me.

Best regards, Allen Walker

edit retag flag offensive close merge delete