本文介绍了使用OpenCV的机器人Croping图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用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);
这篇关于使用OpenCV的机器人Croping图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!