Superpixel is a group of connected pixels with similar colors or gray levels. Instead of just working with one pixel, we'll use superpixels for image segmentation.
The dataset that I have used is a kaggle dataset for identification and segmentation of nuclei in cells. The dataset consists of 670 images and each of the image is an RGB image with dimension 512×512. Below is the figue of the type of data that we have for segmentation.
(Source:Kaggle)
In my approach , i have devided the image in 4 different types namely colored, white background, Black images with big cells and black images with small cells. The reason of doing this was thresholding and the other things that we are doing in segmentation.
There are basically three steps that i did with the segmentation:
- Used SLIC- Simple Linear Iterative Clustering
- Used Canny Edge Detection to remove connected nuclei
- Used Thresholding for segmentation
SLIC performs a local clustering of pixels in 5-D spacedefines by L,a,b values of CILEB and x,y cordinates of the pixels. The distance measure used for clustering is different in case of SLIC, which enables compactness and regularity in the superpixels shape.
Fig:The figure consists of image with superpixels followed by original image
The Canny edge detection algorithm is composed of 5 steps:
- Noise reduction- reduces noise.
- Gradient calculation- detects edge intensity and direction by calculating the gradient of the image using edge detection operators.
- Non-maximum suppression- As the final image should have thin edges. non-maximum suppression is performed to thin out the edges.
- Double threshold- The double threshold step aims at identifying 3 kinds of pixels: strong, weak, and non-relevant.
- Edge Tracking by Hysteresis- Based on the threshold results, the hysteresis consists of transforming weak pixels into strong ones, if and only if at least one of the pixels around the one being processed is a strong one.
After detecting the edges, the last task is the segment the nuclei out of the images. I have done the segmentation using OTSU thresholding as it tries to maximize the inclass variability.
Fig: The figure consists image with superpixels followed by image of the detected edges followed by processed images
The figure below shows the result that we have got from the other methods of segmentation that I have used in the other repositories: