# what is 2D otsu algorithm and how to implement it

조회 수: 25(최근 30일)
hend 20 Aug 2014
I'm a little confusing about what does 2D-Otsu mean? and how to implement it? I didn't find enough information about it in the site. and I hope anyone can help me

댓글을 달려면 로그인하십시오.

### 채택된 답변

Image Analyst 20 Aug 2014
It's a thresholding method. It's implemented in the Image Processing Toolbox function graythresh(). In most cases I find it to be sub-optimal. It's best for images with a nice bimodal histogram, like you'd get with a light part/object/region on a uniform background. For anything complicated it's not so great and you'd need to write a custom thresholding algorithm.

#### 댓글 수: 5

표시 이전 댓글 수: 2
hend 22 Aug 2014
thanks a lot , but I meant the 2D otsu which takes into count the local average gray level, where the max value between the classes variance beside the minimum value within the class are calculated.
Image Analyst 22 Aug 2014
Did I say something contrary to that? graythresh() works on any size image, 2D or 3D. If you want to scan the image and take small local windows, you can do that, like in my attached demo that uses edge detection and thresholding to segment out handwriting.
Aaron Greenbaum 6 Sep 2017
I believe that the Otsu method used in Graythresh is the 1d Ostsu method which only accounts for graylevels over the whole image. the 2d Ostsu method looks at the graylevels over the whole image and also the spatial relationship between pixels. I'm not sure if you did say that.
Do you have any advice for creating custom Thresholding algorithms? Maybe you know some good references or examples? I will check out your demos later but I've been having a lot of trouble automatically thresholding an image with a gaussian looking grayscale histogram.

댓글을 달려면 로그인하십시오.

### 추가 답변(3개)

William Frane 20 Aug 2014
편집: William Frane 20 Aug 2014
Otsu's method (as it's more commonly known) is an image thresholding method used to convert a grayscale image to a binary one. MATLAB's graythresh() function (see this page) is an implementation of Otsu's method. If you're curious about the actual algorithm, it's described in the appropriate Wikipedia article.
Also, just a side note: the MATLAB documentation page for graythresh() that I linked to above was the first result for a Google search of the string matlab otsu algorithm, so don't hesitate to check Google for queries such as this; there's often useful information already available.

#### 댓글 수: 0

댓글을 달려면 로그인하십시오.

Meshooo 21 Aug 2014
Otsu method is a well-known thresholding method. In other words, it can find the threshold value to convert your image to two levels (bilevels) 0 and 1.
http://www.mathworks.com/help/images/ref/graythresh.html
This work was published lone time ago in 1979.
[1] Otsu, N., "A Threshold Selection Method from Gray-Level Histograms," IEEE Transactions on Systems, Man, and Cybernetics, Vol. 9, No. 1, 1979, pp. 62-66.

#### 댓글 수: 0

댓글을 달려면 로그인하십시오.

Madhava Teja Munagala 23 Feb 2018
Respected sir/mam actually im doing project on otsu 2d i hav clarity on theoretical,how to implement program, can any one help,eventhough code is available,im not understand how to analyze plz help me anyone

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by