Java API: changing CvVectorXxx to MatOfXxx

This commit is contained in:
Andrey Pavlenko 2012-04-06 09:32:00 +00:00
parent 6c0ab28d8b
commit 2291faedd8
2 changed files with 5 additions and 5 deletions

View File

@ -7,8 +7,8 @@ import java.io.InputStream;
import org.opencv.android.Utils;
import org.opencv.core.Core;
import org.opencv.core.CvVectorRect;
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
@ -80,11 +80,11 @@ class FdView extends SampleCvViewBase {
if (mCascade != null) {
int height = mGray.rows();
int faceSize = Math.round(height * FdActivity.minFaceSize);
CvVectorRect faces = new CvVectorRect();
MatOfRect faces = new MatOfRect();
mCascade.detectMultiScale(mGray, faces, 1.1, 2, 2 // TODO: objdetect.CV_HAAR_SCALE_IMAGE
, new Size(faceSize, faceSize), new Size());
for (Rect r : faces.toArray(null))
for (Rect r : faces.toArray())
Core.rectangle(mRgba, r.tl(), r.br(), new Scalar(0, 255, 0, 255), 3);
}

View File

@ -5,8 +5,8 @@ import java.util.List;
import org.opencv.android.Utils;
import org.opencv.core.Core;
import org.opencv.core.CvVectorPoint;
import org.opencv.core.Mat;
import org.opencv.core.MatOfPoint;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.highgui.Highgui;
@ -71,7 +71,7 @@ class Sample2View extends SampleCvViewBase {
Core.inRange(mIntermediateMat, lo, hi, mIntermediateMat2); // green
Imgproc.dilate(mIntermediateMat2, mIntermediateMat2, mEmpty);
//
List<CvVectorPoint> contours = new ArrayList<CvVectorPoint>();
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Mat hierarchy = new Mat();
Imgproc.findContours(mIntermediateMat2, contours, hierarchy,Imgproc.RETR_LIST, Imgproc.CHAIN_APPROX_SIMPLE);
Log.d("processFrame", "contours.size()" + contours.size());