A multi-seed region growing algorithm. It can be used as a preprocess in object-recognition, segmentation, tracker and so on.
It's not easy to find multi-seed region growing algorithm written in C++ and opencv 2+, so I share this simple version.
- GCC
- CMake
- Opencv 2
- main.cpp: "main" file, implement "multi-seed region grow" algorithm in C++
- auto_threshold_demo.cpp: a demo show how to implement "auto-threshold"
- source image
- result
- use more powerful estimating algorithm, instead of "delta and threshold"
- optimize for rgb image (achieved now)
- optimize the efficiency
You need to change "OpenCV_DIR", "OpenCV_LIB_DIR", "OpenCV_INCLUDE_DIRS" in "CMakeList.txt".
A fixed threshold is not always effective.
"fixed-threshold" is not elegant :)
I have written an algorithm to show how to make program find the best threshold automatically.
It's an extension program. In order to run this program, you need add cpp file "auto_threshold_demo.cpp" to "CMakeLists.txt".
Remember the demo is just one of ways to "auto-threshold" and it does not guarantee for all image. You may find more perfect algorithm.
For more algorithm details, see: https://imlogm.github.io/%E5%9B%BE%E5%83%8F%E5%A4%84%E7%90%86/multi-seed-region-grow/
- source image
- result