Tip of the week - Otsu good practices

Tip of the week - Otsu good practices

Frequently, IPSDK Eplorer users contact us thinking that the Otsu algorithm for binarizing their images is not working properly. But to use this algorithm correctly, it is important to understand how it works.

Remember that if you use directly Otsu with an image like this below, you will obtain a non-clean segmentation result.

The reason of all the segmented noise is due to the image histogram : we can see 3 maxima peaks ?(outside of the sample, grains and matrix).

To avoid this problem, we recommend to process Otsu only from the mask of your object. To do that, we suggest to do this operation using two steps:

1) First, compute the histogram inside your object. To do that

1.a) With the simple Threshold function , generate the binary mask of your object

1.b) using Histogram 3D function , compute the histogram of your masked object (check the mask parameter and select the preview image)

Now, you can see the histogram with only 2 peaks:

2) In your Otsu threshold function, integrate as an input parameter, your previous histogram (point 1.C). To do that, you just need to check the histogram setting and select your previous computed histogram


Now, you can see your Otsu threshold is correct and doesn’t provide any false positive detection:

Based on the binary image, you can use the Adaptive Watershed offer by IPSDK Explorer to individualize your grains.



要查看或添加评论,请登录

社区洞察

其他会员也浏览了