My question is - can someone suggest a method to convert a grayscale image to binary so that I can perfrom the calculation below to determine a better estimation of the damaged area?
I am trying to calculate the area of a sample which has been been damaged. I have started by converting my .JPG to grayscale then I have applied a threshold to focus on the desired area. My final step is to calcualte the area damaged compared to the undamaged sample. I've tried to calculate the area by dividing greyscale intenisty of the thresholded image by the intensity of an all white image with the same dimensions. Due to the deminished grayscale intensity (45/255) compared to a white image (255/255) this calculation underestimates the total area covered by the damage. To overcome this I want to convert my grayscale image to a binary image. Does anyone have any suggestions?
Code and Damaged sample attached - thanks in advance for any help. Max.
Hi altenbach - the damage is the stripe down the middle of the sample. Each counter surface I test on produces a different colour of damage, therefore, I decided to use greyscale threholding to help with batch processing. The code I have attached converts the colour image to greyscale to be process. I am happy with the code I have created just need the final step of converting grayscale to binary.
Do you have any suggestions that could help me?