这是我的代码,它使用矩形标记检测到的面部。我怎样才能在脸部周围做椭圆?是cvEllipse
班而不是cvRectangle
?我试着这样写,但看起来cvEllipse
不存在或名称不同。
CvHaarClassifierCascade cascade = new CvHaarClassifierCascade(cvLoad(XML_FILE));
CvMemStorage storage = CvMemStorage.create();
CvSeq sign = cvHaarDetectObjects(
img,
cascade,
storage,
1.5,
3,
CV_HAAR_DO_CANNY_PRUNING
);
cvClearMemStorage(storage);
total_Faces = sign.total();
for(int i = 0; i < total_Faces; i++){
CvRect r = new CvRect(cvGetSeqElem(sign, i));
cvRectangle(
img,
cvPoint(r.x(), r.y()),
cvPoint(r.width() + r.x(), r.height() + r.y()),
CvScalar.RED,
2,
CV_AA,
0
);
x=r.x();
y=r.y();
h=r.height();
w=r.width();
}
答案 0 :(得分:0)
import static org.bytedeco.javacpp.opencv_core.cvPoint;
import static org.bytedeco.javacpp.opencv_core.cvScalar;
import static org.bytedeco.javacpp.opencv_core.cvSize;
import static org.bytedeco.javacpp.opencv_imgproc.cvEllipse;
----
cvEllipse(img, cvPoint(), cvSize(), 2d, CV_AA, 0d, CvScalar.RED);