基于图的图像分割-OpenCV源码
OpenCV
在模块opencv_contrib
中实现了基于图的图像分割算法,其实现和作者提供的工程源码略有差别
下面首先解析源码,然后通过示例验证分割效果
- 官网参考文档:cv::ximgproc::segmentation::GraphSegmentation Class Reference
- 头文件
segmentation.hpp - /path/to/include/opencv4/opencv2/ximgproc/segmentation.hpp
- 源文件
graphsegmentation.cpp - /path/to/opencv_contrib/modules/ximgproc/src/graphsegmentation.cpp
- 实现示例
graphsegmentation_demo.cpp - /path/to/opencv_contrib/modules/ximgproc/samples/graphsegmentation_demo.cpp
OpenCV
源码比较复杂,抽取相应实现到GraphLib/cplusplus/samples/graphsegmentation