- Calibration Factor: Your calibration factor (calibration_length / calibration_pixels) might not be accurate for your specific image. Ensure that this factor correctly represents the real-world length of a pixel in your image. This is a common source of error in measurements from images.
- Image Preprocessing: The quality of the original image and the preprocessing steps can affect the outcome. Ensure that the contrast stretching and thresholding effectively highlight the cracks without introducing noise or omitting parts of the cracks.
- Thresholding Level: you might adjust the threshold level (level = 0.08) for binarization based on the histogram of your grayscale image to better segment the cracks.
- Noise Removal: The "bwareaopen" function is used to remove small objects from the binary image. The parameter "50" might not be optimal for your case, adjusting this value can help in removing noise or preserving important features.
- Measurement Method: using the "MajorAxisLength" property to estimate crack length can be effective, however, it might not always provide an accurate representation of the actual crack length, especially if the crack is not straight. Consider using a more sophisticated method to trace and measure the crack length, such as skeletonization followed by measuring the skeleton's length.
- https://in.mathworks.com/matlabcentral/answers/329846-matlab-code-for-wall-crack-detection#answer_545173
- https://in.mathworks.com/support/search.html/answers/593341-how-to-detect-the-crack-and-calculate-its-length.html
- https://in.mathworks.com/support/search.html/answers/196886-image-processing-for-crack-detection-and-length-estimation.html