0

我使用 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);中,如何设置参数?

4

0 回答 0