An algorithm to highlight the different regions in an image using an extended version of Otsu's statistical thresholding. The different regions in an image are grouped into a greyscale value, depending on how many regions were found, the output shows the number of regions and corresponding greyscale value of each region.
The underlying logic is to create a histogram of the greyscale values in the image and find threshold(s) in this histogram that splits the image into some groups and minimizes the weighted sum of within group variances.
- MATLAB Parallel Computing Toolbox, depeding on your systems bounds the default profile for the parallel pool can be 'Threads' or 'Processes'
- Image Processing Toolbox for 'imwrite' and 'imread'
- To run the program, add folder containing “Segmentation_code.m” and the image files into the MATLAB path.
- Run the program in MATLAB
- Enter the input image name in the MATLAB command line, no need to add the “.bmp”
- The command line will output number of regions, and thresholds found
- Wait for the script to display all the relevant graphs and image outputs in order
- If the name of the file was entered incorrectly, re-run the program
Original image:
Segmented image:
Original image:
Segmented image:
Original image:
Segmented image: