[Digital image processing] gradation image binarization

 

Grayscale image

Each pixel of each image in two-dimensional space corresponding to a specific location, and with a composition of one or more values ​​associated with that point samples.

Grayscale image, also known as gray-scale images, each pixel in the image may be represented by 0 (black) to 255 (white) luminance value (Intensity). Represent different gray levels between 0-255.

 

Gray image binarization

Binarization: to a value (threshold value) as a reference, is greater than (or equal to) the number of this value is changed to all 1 (or 0), less than or equal to the number of all of them to 0 (or 1).

Freescale binarization algorithm processing circuit ideas: Valve setting a threshold value, for each row of the image matrix, from left to right, compare the size of each pixel value and the threshold value, if the pixel value is greater than or equal to the threshold, it is determined that the the track corresponding to the pixels are white; otherwise, it is determined that the corresponding target black guidewire.

And the last note of the first time under the column number of the pixel when the pixel value is less than the threshold occurrence, calculating the average of the two, as the position of the target on the line of the guidewire.

Binary code camera:

 

Void image_binaryzation()

{

for(int i=0;i

{

    for(int j=0;j

    {

if(Image[i][j] >= Threshold)

       Image_new[i][j]=1;

else

    Image_new[i][j]=0;

    }

}

}

Row corresponding number of lines acquired, Col is the number of columns, Image [i] [j] is captured by the camera is not binarized array data storage, Img [i] [j] is the new stored binary array.

 

An appropriate threshold

Binarization threshold, the most important is to select suitable threshold values, which is the binarized difficulty lies. Common binarization threshold selection method bimodal method, a P parameter method, large law (Otsu method), maximum entropy threshold method, iterative method.

Guess you like

Origin www.cnblogs.com/-wenli/p/11486877.html