Converting .Mat to CvArr format (JavaCV)
I wnat to use cvRectangle() in Javacv and the first parameter is the current frame of camera. But the problem is that format of the frames are .Mat and I need to convert them to CvArr format to use on this command for my android application (Template Matching android-OpenCv application).
How can I do the conversion?
Please help me with that.
Thanks
her is my code:
public void overlapFinder( String inputPath )//inputhpath is the template image path to load
//mRgba is the current frame ti in Mat format
{
// to find the best overlap in the current frame with template image
CvPoint minloc = new CvPoint(0,0) ;
CvPoint maxloc = new CvPoint(0,0);
double minval, maxval;
Mat mResult;
mTemplate = Highgui.imread(inputPath);
int resultWidth = mRgba.width() - mTemplate.width() + 1;
int resultHeight = mRgba.height() - mTemplate.height() + 1;
mResult = new Mat (resultHeight, resultWidth, CvType.CV_32F);
//cvMinMaxLoc( mResult, minval, maxval, minloc, maxloc, 0 );
IplImage destImage = mRgba;
cvRectangle(mRgba, cvPoint( minloc.x(), minloc.y()),
cvPoint( minloc.x() + mTemplate.width(), minloc.y() + mTemplate.height()),
cvScalar( 0, 0, 255, 0 ), 1, 0, 0 );
Imgproc.matchTemplate(mRgba, mTemplate , mResult , Imgproc.TM_CCOEFF) ;
Core.MinMaxLocResult result = Core.minMaxLoc(mResult);
@SuppressWarnings("unused")
double maxVal = result.maxVal;
}