Implementation of Connected Component Labelling Algorithm explained in http://aishack.in/tutorials/connected-component-labelling/ using OpenCV
- git
- CMake >= 2.8
- OpenCV >= 2.4
- C++ 11 support
- Visual Studio 2015 (for Windows users)
For windows user, please use CMakeLists_Windows.txt before running CMake to compile it. Steps
-
Rename
CMakeLists_windows.txt
toCMakeLists.txt
-
Ensure that you have already installed OpenCV on your Windows operating system. And also you have already linked to system path the
bin
directory of OpenCV. -
Change variable
OpenCV_dir
insideCMakeLists.txt
to conform with your OpenCV build directory -
Ensure you have already included cmake executable in system path, so you are able to use it in PowerShell or CMD. (I suggest PowerShell)
-
Open your power shell, clone this repository by issuing
git clone https://github.com/kennykarnama/connected_component_labelling.git
-
Once you done cloning it, just issue command inside the repository directory
cmake .
- If it has finished compiling then open
connected_components.sln
using your visual studio editor. - Head to Build --> Rebuild ccl.
- After completing, head to
debug
directory, you will findccl.exe
- Done :D
For Linux user, please use CMakeLists_Linux.txt before running CMake to compile it.
- Rename
CMakeLists_Linux.txt
toCMakeLists.txt
- Ensure you have already installed OpenCV correctly.
- Just run
cmake .
- After CMake compiled successfully, build the executable using
make
- You are all set now
For executing this program, below are the pattern to run it :
./ccl [image path file] [dummy args]
- [image path file] --> path to your picture files (ensure it is in binary or black-white picture)
- [dummy args] --> just past whatever string to this second argument (initially it was meant to support optional arguments, but not finished yet)
Any contributions will be appreciated because this program is still not ideal in design pattern, algorithm efficiency and code structuring. It also lacks of tests !
MIT