我使用OpenCV的2.3.1的机器人。我需要裁剪图像成半。 什么我做的是
I am using OpenCV 2.3.1 in android. I need to crop the image into half. What I am doing is
Mat mIntermediateMat2 = new Mat(frame_height,frame_width,rgba.type);
mIntermediateMat2 = rgba.clone();
mIntermediateMat2 = mIntermediateMat2.rowRange(0,frame_height/2);
请问第三步做的工作或我一定要添加更多的东西? 只见垫::运算符()在OpenCV中2.3文档,但遗憾的是没有能够找到OpenCV的Android包。
Will the third step do the job or I have to add something more? I saw Mat::operator() in opencv 2.3 documentation but unfortunately not able to find in the opencv android package.
有几个构造器垫类,其中一个需要垫和ROI(感兴趣区域)。
There are a few constructors for the Mat class, one of which takes a Mat and an ROI (region of interest).
下面是如何做到这一点在Android的/ Java的:
Here's how to do it in Android/Java:
Mat uncropped = getUncroppedImage();
Rect roi = new Rect(x, y, width, height);
Mat cropped = new Mat(uncropped, roi);