我这段时间也在进行轮廓提取相关的工作,轮廓线条的点坐标在contours里面的contour的point,我用的是java语言调用opencv的,所以对应的是: for(int i=0;i<contours.size();i++){ System.out.println(contours.get(i).size()+" rows: "+contours.get(i).rows()+" cols: "+contours.get(i).cols()); //查看每个轮廓的信息 //Imgproc.RETR_LIST:从最内层到最外层遍历 //Imgproc.RETR_TREE:从最外层到最内层遍历 //Imgproc.RETR_CCOMP:从最内层,然后是最外层,然后说中间层 //Imgproc.RETR_EXTERNAL:只显示最外层轮廓 //Imgproc.CHAIN_APPROX_SIMPLE:最外层轮廓数据只得到顶点的坐标 for(int j=0;j<contours.get(i).total();j++){ System.out.println("轮廓 "+(i+1)+"的坐标信息:"+contours.get(i).toList().get(j)); } System.out.println("------------------------------"); }
4,448
社区成员
15,336
社区内容
加载中
试试用AI创作助手写篇文章吧