Raspberry Pi By Example by Ashwin Pajankar & Arush Kakkar

Raspberry Pi By Example by Ashwin Pajankar & Arush Kakkar

Author:Ashwin Pajankar & Arush Kakkar [Pajankar, Ashwin]
Language: eng
Format: azw3, pdf
Publisher: Packt Publishing
Published: 2016-04-22T04:00:00+00:00


The output of the preceding code will be as follows:

Otsu's method

Otsu's method for thresholding automatically determines the value of the threshold for images that have two peaks in their histogram (bimodal histograms). The following is a bimodal histogram:

This usually means that the image has background and foreground pixels and Otsu's method is the best way to separate these two sets of pixels automatically without specifying a threshold value.

Otsu's method is not the best way for those images that are not in the background and foreground model and may provide improper output if applied.

This method is applied in addition to other methods, and the threshold is passed as 0. Try out the following code:

ret,output=cv2.threshold(image,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.