Android : How to Draw a Rotated boxe with exactly angle with opencv Android

on Tuesday, September 16, 2014


im developing an android application with opencv. this is i have when i used Core.rectangle it will draw rect but that is not which i need. here with my code. did i miss something? so then how to use core.line(). then if i use line it is possible to crop it?



MatOfPoint2f approxCurve = new MatOfPoint2f();
for (int i=0; i<contours.size(); i++){
MatOfPoint2f contour2f = new MatOfPoint2f( contours.get(i).toArray() );
double approxDistance = Imgproc.arcLength(contour2f, true)*0.02;
Imgproc.approxPolyDP(contour2f, approxCurve, approxDistance, true);
MatOfPoint points = new MatOfPoint( approxCurve.toArray() );
Rect rect = Imgproc.boundingRect(points);
Core.rectangle(ImageMatin, rect.tl(), rect.br(), new Scalar(255, 0, 0));

//Core.line(ImageMatin, new Scalar(255,0,0), 3);
}

0 comments:

Post a Comment