title: Imgproc.getRectSubPix OpenCV function give an error in Java
body: <p>I have a rotatedRect that I find on my image, and I want to retrieve the subMatrice of all pixel in this rotatedRect. I find this C++ code on this topic : <a href="http://answers.opencv.org/question/497/extract-a-rotatedrect-area/" rel="nofollow">http://answers.opencv.org/question/497/extract-a-rotatedrect-area/</a> and here my Java code: </p>
  
  <pre><code>   Mat M = new Mat(), rotated = new Mat(), cropped = new Mat();
  
      // get angle and size from the bounding box
      double angle = mTable.angle;
      Size rect_size = mTable.size;
  
      if (mTable.angle &lt; -45.0) {
          angle += 90.0;
          double w = rect_size.width;
          rect_size.width = rect_size.height;
          rect_size.height = w;
      }
  
      // get the rotation matrix
      M = Imgproc.getRotationMatrix2D(mTable.center, angle, 1.0);
  
      // perform the affine transformation
      Imgproc.warpAffine(mRgba, rotated, M, mRgba.size(), Imgproc.INTER_CUBIC);
  
      // crop the resulting image
      Imgproc.getRectSubPix(rotated, rect_size, mTable.center, cropped); //THIS LINE DOESN'T WORK
  </code></pre>
  
  <p>And here my error in the logCat</p>
  
  <pre><code>02-17 17:02:34.791: E/cv::error()(3588): OpenCV Error: Unsupported format or combination of formats () in void cvGetRectSubPix(void const*, void*, CvPoint2D32f), file /home/reports/ci/slave_desktop/50-SDK/opencv/modules/imgproc/src/samplers.cpp, line 556
  02-17 17:02:34.791: E/org.opencv.imgproc(3588): imgproc::getRectSubPix_11() caught cv::Exception: /home/reports/ci/slave_desktop/50-SDK/opencv/modules/imgproc/src/samplers.cpp:556: error: (-210)  in function void cvGetRectSubPix(void const*, void*, CvPoint2D32f)
  02-17 17:02:34.791: W/dalvikvm(3588): threadid=11: thread exiting with uncaught exception (group=0x418ccda0)
  02-17 17:02:34.791: E/AndroidRuntime(3588): FATAL EXCEPTION: Thread-29491
  02-17 17:02:34.791: E/AndroidRuntime(3588): Process: com.example.testopencv, PID: 3588
  02-17 17:02:34.791: E/AndroidRuntime(3588): CvException [org.opencv.core.CvException: cv::Exception: /home/reports/ci/slave_desktop/50-SDK/opencv/modules/imgproc/src/samplers.cpp:556: error: (-210)  in function void cvGetRectSubPix(void const*, void*, CvPoint2D32f)
  02-17 17:02:34.791: E/AndroidRuntime(3588): ]
  02-17 17:02:34.791: E/AndroidRuntime(3588):     at org.opencv.imgproc.Imgproc.getRectSubPix_1(Native Method)
  02-17 17:02:34.791: E/AndroidRuntime(3588):     at org.opencv.imgproc.Imgproc.getRectSubPix(Imgproc.java:6618)
  02-17 17:02:34.791: E/AndroidRuntime(3588):     at com.example.testopencv.MainActivity.continueTrackingRedBall(MainActivity.java:336)
  02-17 17:02:34.791: E/AndroidRuntime(3588):     at com.example.testopencv.MainActivity.onCameraFrame(MainActivity.java:155)
  02-17 17:02:34.791: E/AndroidRuntime(3588):     at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:387)
  02-17 17:02:34.791: E/AndroidRuntime(3588):     at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:328)
  02-17 17:02:34.791: E/AndroidRuntime(3588):     at java.lang.Thread.run(Thread.java:841)
  </code></pre>
  
  <p>It seems that getRectSubPix function doesn't work in Java, someone found a solution?</p>