Sunday, April 12, 2020

learning matlab image processing-1: imbinarize

Today I found a great function of matlab for image processing: imbinarize This function actually replaces the im2bw function. To get an idea of the difference, here is an example. If we just the old code and the new function in 'global'(default) model. There is not much difference: level = 0.57; Ithresh = im2bw(Igray,level); BW=imbinarize(Igray); imshowpair(Ithresh, BW, 'montage'); title('old (left) vs new (right,global mode)')
However, the really useful part is the 'adaptive' function for this binarizer: level = 0.57; Ithresh = im2bw(Igray,level); BW=imbinarize(Igray,'adaptive'); imshowpair(Ithresh, BW, 'montage'); title('old (left) vs new (right,global mode)')
This actually saves the effort to split the channels of RGB and segment them separately, as described here in the old version of matlab (https://www.youtube.com/watch?v=1-jURfDzP1s, a very nice presentation). Find out more details about this function in https://www.mathworks.com/help/images/ref/imbinarize.html Good thing is that it also works for 3D stacks. will give it try:)

No comments: