在JavaCV中传递给cvFindContours()的参数是什么? [英] What are the parameters passed to cvFindContours() in JavaCV?

查看:578
本文介绍了在JavaCV中传递给cvFindContours()的参数是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请解释一下 cvFindContours 方法,它需要什么参数?

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

例如,以下是使用OpenCV的代码:

For example, here's code using OpenCV:

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

请说明一下这使用JavaCV?

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

推荐答案

正如Mohammad所提到的意见,这三个参数是 header_size >和方法。您可以使用此方法如下

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.

这篇关于在JavaCV中传递给cvFindContours()的参数是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆