I need to implement a locally adaptive threshold algorithm on a grayscale image in matlab. I use a sliding window over the image and calculate the threshold for the block using Otsu's method, which works well for blocks with non-uniform intensities.

However, when I apply this method to blocks with uniform intensities, I get very busy (junk) blocks. I want to set these blocks to either black or white in the result. I can decide whether to use black and white by comparing the global threshold value to the mean of the block (is this a good approach?).

My main question is: how to decide whether a block is uniform or not, or rather, how do I know which blocks to threshold and which to completely set to black or white?


1 Answer 1


If you calculate the standard deviation of the blocks (from the average) it could serve as a good measure to the smoothness of a block (assuming there is no an extraordinary value and the specific use of the "system")


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.