https://github.com/kumaarbalbir/reg-grow-bfs
C++ implementations of a region-growing algorithm using OpenCV
https://github.com/kumaarbalbir/reg-grow-bfs
cpp region-growing-segmentation
Last synced: 7 months ago
JSON representation
C++ implementations of a region-growing algorithm using OpenCV
- Host: GitHub
- URL: https://github.com/kumaarbalbir/reg-grow-bfs
- Owner: KumaarBalbir
- Created: 2024-08-27T15:40:01.000Z (about 1 year ago)
- Default Branch: local
- Last Pushed: 2024-08-27T15:56:10.000Z (about 1 year ago)
- Last Synced: 2024-08-27T17:31:57.268Z (about 1 year ago)
- Topics: cpp, region-growing-segmentation
- Language: C++
- Homepage:
- Size: 108 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Region Growing Using Opencv, BFS search and Euclid distance
This repository contains two C++ implementations of a region-growing algorithm using OpenCV. The algorithm segments an image into regions based on the similarity of pixel colors, utilizing Breadth-First Search (BFS) and Euclidean distance for region expansion.
#### Prerequisites
- OpenCV 4.x installed on your system.
- A C++ compiler (e.g., g++).
- CMake (if you prefer building with it instead of the Makefile).#### Installing Opencv on Ubuntu
`sudo apt update
sudo apt install libopencv-dev
`#### Compilation
##### Using make
- Navigate to the src/ directory: `cd src`
- Run the following command to compile both implementations: `make`. This will generate two executables: `reg_grow` and `reg_grow_dir`.
- To clean up the compiled files, use: `make clean`#### Running the Program
To run the program, use the following command (inside src directory): `./region_grow ` replace the placeholder with the desired value.
Example: `./region_grow ../images/test-image-rg.jpg 12`
This will execute the region-growing algorithm on the sample image with a threshold value of 12.
#### Result
Here is the original image used for segmentation:
Here is the result after applying the region-growing algorithm:
