7
請問可以解釋一下關於cvFindContours
的方法,它需要什麼參數?在JavaCV中傳遞給cvFindContours()的參數是什麼?
例如,下面的代碼中使用的OpenCV:
hierarchy = cv2.findContours(thresh, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
可以請一些解釋一個怎樣寫這個使用JavaCV?通過穆罕默德提到
請問可以解釋一下關於cvFindContours
的方法,它需要什麼參數?在JavaCV中傳遞給cvFindContours()的參數是什麼?
例如,下面的代碼中使用的OpenCV:
hierarchy = cv2.findContours(thresh, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
可以請一些解釋一個怎樣寫這個使用JavaCV?通過穆罕默德提到
作爲評論那些三個參數是header_size,模式和方法。您可以按照以下方法使用此方法
IplImage src = cvLoadImage(path);//hear path is actual path to image
IplImage grayImage = IplImage.create(src.width(), src.height(), IPL_DEPTH_8U, 1);
cvCvtColor(src, grayImage, CV_RGB2GRAY);
cvThreshold(grayImage, grayImage, 127, 255, CV_THRESH_BINARY);
CvSeq cvSeq=new CvSeq();
CvMemStorage memory=CvMemStorage.create();
cvFindContours(grayImage, memory, cvSeq, Loader.sizeof(CvContour.class), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE);
希望這可能有助於您理解此方法。
我不知道javacv,但參數看看[這個](http://docs.opencv.org/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=#cv2.findContours) – Mohammad 2012-07-07 11:18:30
在JavaCV中,它包含以下格式的方法cvFindContours(opencv_core.CvArr cvarr,opencv_core.CvMemStorage cms,opencv_core.CvSeq cvseq,int i,int i1,int i2)。那麼這3個整數是什麼意思? – 2012-07-07 11:22:24
這似乎與opencv 1.x接口類似:int cvFindContours(CvArr * image,CvMemStorage * storage,CvSeq ** first_contour,int header_size = sizeof(CvContour),int mode = CV_RETR_LIST,int method = CV_CHAIN_APPROX_SIMPLE,CvPoint offset = cvPoint(0,0))' – Mohammad 2012-07-07 11:25:22