Advertisement

Java中如何获取对象的x,y坐标

阅读量:

以下代码可尝试用于解决您的问题,其将输出对应的结果。

IplImage img = cvLoadImage("pathtosourceimage");

CvSize cvSize = cvSize(img.width(), img.height());

IplImage gry = cvCreateImage(cvSize, img.depth(), 1);

cvCvtColor(img, gry, CV_BGR2GRAY);

cvThreshold(gry, gry, 200, 255, CV_THRESH_BINARY);

cvAdaptiveThreshold(gry, gry, 255, CV_ADAPTIVE_THRESH_MEAN_C, CV_THRESH_BINARY_INV, 11, 5);

CvMemStorage storage = CvMemStorage.create();

CvSeq contours = new CvContour(null);

int noOfContors = cvFindContours(gry, storage, contours, Loader.sizeof(CvContour.class), CV_RETR_CCOMP, CV_CHAIN_APPROX_NONE, new CvPoint(0,0));

Cv

全部评论 (0)

还没有任何评论哟~