RGB based 2nd order Image Segmentation.
- Segmenting image in top 'n' colors present ['n' is given by user].
- Using RGB image format and KMeans clustering algo.
- Sub-labelling dissconnected pixel sections belonging to same Cluster.
Note: Run the following codes in command terminal.
git clone https://github.com/moksh-401-511/RGB2oSeg.git
Paste image into 'Image' directory present in RGB2oSeg dir
In command terminal, move to RGB2oSeg directory.
# -i : (test_image.png) input image name
# -c : (2/3/4..) number of clusters to segment image
# -s : (1/0) whether to perform sub-segmentation
python RGB-sub-segmentation.py -i test_image.png -c 3 -s 1
Segmented images will be stored in 'Segmented_images' directory and corresponding labeled matrices (for both segmentation and sub-segmentation) are stored as numpy-binary file in 'labeled_img_matrix' directory. More info about how to read these numpy-binary files, refer code snippet.
Some example outputs of Images are given in Segmented_images directory.