Difference between adaptive thresholding and normal thresholding in opencv

I have this gray video stream:

The histogram of this image:

The thresholded image by :

  threshold( image, image, 150, 255, CV_THRESH_BINARY );

i get :

Which i expect.

When i do adaptive thresholding with :

adaptiveThreshold(image, image,255,ADAPTIVE_THRESH_GAUSSIAN_C, CV_THRESH_BINARY,15,-5);

i get :

Which looks like edge detection and not thresholding. What i expected was black and white areas . So my question is, why does this look like edge detection and not thresholding.

thx in advance


Adaptive Threshold works like this:

The function transforms a grayscale image to a binary image according to the formulas:



where T(x,y) is a threshold calculated individually for each pixel.

Threshold works differently:

The function applies fixed-level thresholding to a single-channel array.

So it sounds like adaptiveThreshold calculates a threshold pixel-by-pixel, whereas threshold calculates it for the whole image -- it measures the whole image by one ruler, whereas the other makes a new "ruler" for each pixel.

Need Your Help

String-to-byte sequence translation using a fixed encoding, preferably UTF-8

c++ windows unicode utf-8 codepages

In a windows c++ console application I would like to read a password from command-line input. The password is used for encryption (and later decryption, maybe elsewhere in the world on a windows pc...

jquery animation repeat, what is wrong with my syntax?


Can someone please evaluate my code and let me know if it is correct.

Adding CSS to iframe with no body

javascript jquery css iframe fonts

I have an iframe tag, where I wish to change the font-family. But the iframe I am linking to does not have a body, it's just text and pictures. So most javascript ways of accessing it don't work. Is