This is a repository hosting algorithms and codes developed for a student project focusing on segmentation techniques used for titanium alloy microstructure images.
We make use of Python and OpenCV to conduct image analysis. Several algorithms have also been developed to conduct subsequent data extraction.
This script entails most of the pre-segmentation processing techniques, including blurring, thresholding and edge detection The display_image and save_images functions allow for batch saving and comparing of the processed images.
This script is dedicated for FFT and frequency domain operations. Testing of mask size and direction is important to the success of FFT.
This script includes the function that conducts watershed transform.
This script contains the algorithm developed for reducing oversegmentation. Labelled regions with an area below the threshold are merged to their surrounding ones.
This script contains the algorithm used for data extraction. It also uses the openpyxl package to export the data to a Microsoft Excel workbook.
This script saves all images generated, both individual ones and comparative ones.
This script generates a Microsoft Excel workbook that contains the microstructural data about the image.
This is the script for visualisation of different stages of the image processing and the final result.
The followings are the tested parameters for segmentation of the IHPC and MIPAR images.
FFT masks: rectangular_masks = [(-52, 60), (75, 45), (89.9, 30), (60, 25)]
Watershed segmentation (FFT): (thersh, kernel, thresh_pre, dia_iter) = (0.24, (3, 3), 25, 3)
Watershed segmentation (Otsu): (thersh, kernel, thresh_pre, dia_iter) = (0.20, (3, 3), 30, 3)
Merge threshold (FFT): merge_thresh = 6500
Merge threshold (FFT): merge_thresh = 6000
FFT masks: rectangular_masks = [(70, 30), (-35, 30)]
Watershed segmentation (FFT): (thersh, kernel, thresh_pre, dia_iter) = (0.24, (3, 3), 25, 3)
Watershed segmentation (Otsu): (thersh, kernel, thresh_pre, dia_iter) = (0.20, (3, 3), 30, 3)
Merge threshold (FFT): merge_thresh = 4000
Merge threshold (FFT): merge_thresh = 4000
FFT masks: rectangular_masks = [(-30, 50), (65, 45), (89.9, 40)]
Watershed segmentation (FFT): (thersh, kernel, thresh_pre, dia_iter) = (0.21, (5, 5), 65, 2)
Watershed segmentation (Otsu): (thersh, kernel, thresh_pre, dia_iter) = (0.22, (5, 5), 30, 2)
Merge threshold (FFT): merge_thresh = 800
Merge threshold (Otsu): merge_thresh = 1000
FFT masks: rectangular_masks = [(89.9, 30)]
Watershed segmentation (FFT): (thersh, kernel, thresh_pre, dia_iter) = (0.24, (3, 3), 25, 3)
Watershed segmentation (Otsu): (thersh, kernel, thresh_pre, dia_iter) = (0.20, (3, 3), 30, 3)
Merge threshold (FFT): merge_thresh = 400
Merge threshold (FFT): merge_thresh = 800
Our project idea was raised during a discussion with our supervising teacher, Dr Nathaniel Ng. We sincerely thank Dr Nathaniel for his guidance and advice. He provided many valuable suggestions on the image processing procedure and on the writing of this report. We thank Institute of Material Research and Engineering of A*STAR for providing us with the IMRE image. We are also grateful to MIPAR for allowing us to use the MIPAR image, one of the many microstructure images available on the website. Lastly, we would like to express our gratitude to Mrs Judy Tan and Mr Goh Kien Soon, both teachers from Nanyang Junior College, for providing us with the opportunity to conduct this research project with Dr Nathaniel.