preface

Pixel gray value only reflects the magnitude of pixel gray level, but does not reflect the spatial information of pixel and neighborhood.

The concept of two-dimensional gray histogram

Two-dimensional gray histogram: the value N(I,j) of the two-dimensional histogram composed of the gray value distribution of pixels and the average gray value distribution of the neighborhood. Where, I =f(x,y) image (x,y) gray value. J =g(x,y) image (x,y) location neighborhood average gray value. For a gray image of MxN size, the image can be represented by a binary group (I, J) composed of the gray value of the pixel point and the average gray value of its neighborhood. Suppose that the frequency of occurrence of binary group (I j) is ω; Then the corresponding joint probability density p(I,j) is: P (I,j)= ω /(M xN). With I and j as independent variables and P (I,j) as dependent variables, a two-dimensional gray histogram can be drawn.

Features:

1. P(I,j) is concentrated around the diagonal from (0,0) to (l-1, l-1).

2. In the case that there are no obvious peaks and troughs in the one-dimensional gray histogram, there are also two obvious peaks



3. The threshold value is two-dimensional vector (S,t), and the two-dimensional histogram is divided into four regions



Where, C0 and C1 are one kind of background and object respectively. A and B are one type of edge and noise respectively.

Several threshold segmentation methods

Two-dimensional Otsu threshold segmentation

The following is an excerpt from the paper, which feels very clear and I won’t say much about it.









The clearer formula seen from an article should be right, after all, the original formula is too vague





Image segmentation algorithm based on two-dimensional histogram research two-dimensional maximum entropy threshold segmentation principle and OpencV implementation (and no code) two-dimensional gray histogram optimal segmentation method (download address, the document is free) gray image two-dimensional Otsu automatic threshold segmentation method (download address, A fast two-dimensional threshold segmentation method based on inter-class and intra-class variances