我用Javacv在图片中找到米粒的图像。
我已经实现了这段代码:
String fileName = "image/rice.jpg";
IplImage image = cvLoadImage(fileName);
IplImage _image = cvCloneImage(image);
image = Guassian.apply(image, 3);
image = Grayscale.apply(image);
image = Threshold.apply(image, CV_THRESH_OTSU);
image = MORPH.apply(image, 7, 3, CV_MOP_ERODE);
image = MORPH.apply(image, 7, 3, CV_MOP_DILATE);
image = Canny.apply(image);
CvSeq cvSeq = new CvSeq();
CvMemStorage storage = CvMemStorage.create();
cvFindContours(image, storage, cvSeq, Loader.sizeof(CvContour.class), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE);
for (int i = 0; i < cvSeq.total(); i++) {
cvEllipse(cvSeq, CvPoint.ZERO, CvSize.ZERO, i, dp, dp, CvScalar.ONE, i, i, i);
}
在第cvEllipse(cvSeq, CvPoint.ZERO, CvSize.ZERO, i, dp, dp, CvScalar.ONE, i, i, i);
行中,如何设置参数?