Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the parameters passed to cvFindContours() in JavaCV?

Please can some one explain about cvFindContours method and what are the parameters that it required?

For example, here's code using OpenCV:

hierarchy = cv2.findContours(thresh, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)

Please can some one explain how to write this using JavaCV?

like image 328
Jade_ Avatar asked Jul 07 '12 10:07

Jade_


1 Answers

As comments mentioned by Mohammad those three parameters are header_size, mode and method. You can use this method as follows

    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);

Hope this might help you to understand this method.

like image 126
SL_User Avatar answered Nov 08 '22 18:11

SL_User