I have an image to which I want to apply segmentation using local thresholding. This requires the following steps:
-
first segment the image into many sub-images
-
implement local thresholding by computing the average within each sub image
-
convert the image matrix to binary, by comparing each pixel value with the value of the sub-image local average:
-
if the pixel value is above or equal to the local average, then pixel value = 1
-
if the pixel value is below the local average, then pixel value = 0
-
My image is unit 8 with 240*320 pixels. How can I implement local thresholding to it using MATLAB? I want to compute the average over each 31*31 sub-image.
1 Answer