CN112991378A - Background separation method based on gray level distribution polarization and homogenization - Google Patents

Background separation method based on gray level distribution polarization and homogenization Download PDF

Info

Publication number
CN112991378A
CN112991378A CN202110502806.0A CN202110502806A CN112991378A CN 112991378 A CN112991378 A CN 112991378A CN 202110502806 A CN202110502806 A CN 202110502806A CN 112991378 A CN112991378 A CN 112991378A
Authority
CN
China
Prior art keywords
gray
value
proportion
preset threshold
new
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110502806.0A
Other languages
Chinese (zh)
Other versions
CN112991378B (en
Inventor
谢富华
刘贯伟
郝晨
张云峰
滕飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Cashway Technology Co Ltd
Original Assignee
Cashway Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Cashway Technology Co Ltd filed Critical Cashway Technology Co Ltd
Priority to CN202110502806.0A priority Critical patent/CN112991378B/en
Publication of CN112991378A publication Critical patent/CN112991378A/en
Application granted granted Critical
Publication of CN112991378B publication Critical patent/CN112991378B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/40Image enhancement or restoration by the use of histogram techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Abstract

The invention discloses a background separation method based on gray scale distribution polarization and homogenization, which comprises the following steps: the method comprises the following steps of firstly, counting the number of different gray values in the whole character string region, and solving the proportion of each gray value in the gray value of a pixel point in the whole region; secondly, keeping the proportion of the pixels with the gray values equal to and lower than a preset threshold unchanged, and sequentially carrying out backward accumulation on the proportion of the pixels with the gray values larger than the preset threshold to finish step homogenization; thirdly, performing inverse mapping on the obtained pixel points with the new gray values to form a new image, wherein compared with the original image, the gray values of the pixel points below a preset threshold are kept unchanged, and the gray values of the pixel points above the preset threshold are increased; fourthly, drawing a gray level histogram of a new image according to the new gray level value, and completing the selection of a dynamic threshold value by using a double-peak method; and fifthly, separating the background of the image through a dynamic threshold value.

Description

Background separation method based on gray level distribution polarization and homogenization
Technical Field
The invention belongs to the technical field of financial bill image processing, and particularly relates to a background separation method based on gray scale distribution polarization and homogenization.
Background
The image segmentation is a basic problem to be solved by character string extraction, and the difficulty of the segmentation method based on the threshold is threshold determination. The adequacy of the threshold selection is decisive for the effectiveness of the segmentation.
For a general pure color background, time and hardware conditions are considered, the average value of image value points of a character string to be segmented is counted and used as a threshold value to segment the image, so that the segmentation requirement can be met, for the segmentation of a double-background character string, the influence of a dark background and a light background on characters needs to be considered, the double-threshold value and even a plurality of threshold values have a good segmentation effect, and the time calculation cost is increased.
Disclosure of Invention
The invention aims to provide a background separation method based on gray level distribution polarization and homogenization aiming at the technical defects in the prior art, which adopts a histogram accumulation method, comprehensively considers the influence of double background pixels on characters, completes dynamic acquisition of a threshold value and well solves the difficult problem of segmentation of double background character strings.
The technical scheme adopted for realizing the purpose of the invention is as follows:
a background separation method based on gray distribution polarization and homogenization comprises the following steps:
the method comprises the following steps of firstly, counting the number of different gray values in the whole character string region, and solving the proportion of each gray value in the gray value of a pixel point in the whole region;
secondly, keeping the proportion of the pixels with the gray values equal to and lower than a preset threshold unchanged, and sequentially carrying out backward accumulation on the proportion of the pixels with the gray values larger than the preset threshold to finish step homogenization;
thirdly, performing inverse mapping on the obtained pixel points with the new gray values to form a new image, wherein compared with the original image, the gray values of the pixel points below a preset threshold are kept unchanged, and the gray values of the pixel points above the preset threshold are increased;
fourthly, drawing a gray level histogram of a new image according to the new gray level value, and completing the selection of a dynamic threshold value by using a double-peak method;
and fifthly, separating the background of the image through a dynamic threshold value.
Preferably, in the second step, the preset threshold depends on the ratio of different gray scale values, and the preset threshold is equal to one of the different gray scale values.
Preferably, in the second step, the specific operations of sequentially performing backward accumulation on the proportion of the pixels with the gray values larger than the preset threshold value are as follows:
001, arranging the gray values of the pixel points which are larger than the preset threshold value from small to large, recording each gray value as one class, and counting a plurality of classes, wherein the gray value which is equal to the preset threshold value is recorded as class 0;
002, increase calculation is performed on the gradation value from class 1, and first the increase ratio: the new proportion of the calculated 1 st gray value is equal to the proportion of the 1 st gray value plus the original proportion of the 1 st gray value, wherein the new proportion of the gray value is the increasing proportion;
003, sequentially calculating the increasing proportion of all the gray values according to the calculation method of the type 1, wherein the new proportion of each gray value is equal to the proportion of the previous gray value plus the original proportion of the current gray value;
004, the new gray value calculation formula of the pixel point larger than the preset threshold value is as follows:
Figure 297573DEST_PATH_IMAGE002
wherein:
Figure 355659DEST_PATH_IMAGE004
is the new gray-scale value of the image,
Figure 338659DEST_PATH_IMAGE006
is the new proportion of the gray-scale value,
Figure 999447DEST_PATH_IMAGE008
is the original gray scale value.
Preferably, if the calculated new gray scale value is greater than 255, the gray scale value of the pixel point is recorded as 255.
The invention has the beneficial effects that:
in situations where the contrast between the crown word number background and the crown word number is not obvious (situations include overall brightness, overall darkness, double backgrounds, etc.), it is difficult to determine an appropriate segmentation threshold. In this case, regardless of the gradation information of a specific position, the character information is made more conspicuous by background separation of the crown word number region map using the gradation distribution. Meanwhile, in order to not distort character information, only the pixel position (namely background information) larger than the threshold value is processed, so that the background is lightened integrally, and the crown word number information of the foreground is highlighted.
Drawings
FIG. 1 is a comparison of the extraction effect of the same sample in the conventional threshold extraction method and the threshold extraction method of the present invention.
FIG. 2 is a graph showing the comparison between the conventional threshold extraction method and the threshold extraction method of the present invention.
Detailed Description
The present invention will be described in further detail with reference to specific examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
A background separation method based on gray distribution polarization and homogenization comprises the following steps:
the method comprises the following steps of firstly, counting the number of different gray values in the whole character string region, and solving the proportion of each gray value in the gray value of a pixel point in the whole region; the calculation formula is as follows:
Figure 718879DEST_PATH_IMAGE010
(1.1)
in the formula (1.1), the first and second groups,
Figure 72500DEST_PATH_IMAGE012
is a gray value of
Figure 542796DEST_PATH_IMAGE014
The number of the pixel points of (a) is,
Figure 148221DEST_PATH_IMAGE016
the number of all the pixel points of the whole image,
Figure 82678DEST_PATH_IMAGE018
i.e. the gray value is
Figure DEST_PATH_IMAGE019
The ratio of the pixel points in the original image.
And secondly, keeping the proportion of the pixels with the gray values equal to or lower than a preset threshold unchanged, sequentially carrying out backward accumulation on the proportion of the pixels with the gray values larger than the preset threshold to finish step homogenization, wherein the preset threshold depends on the proportion of different gray values, and is equal to one of the different gray values.
In this embodiment, the preset threshold is 25.
The specific operation of sequentially performing backward accumulation on the proportion of the pixels with the gray values larger than the preset threshold value is as follows:
001, arranging the gray values of the pixel points which are larger than the preset threshold value from small to large, recording each gray value as one class, and counting a plurality of classes, wherein the gray value which is equal to the preset threshold value is recorded as class 0;
002, increase calculation is performed on the gradation value from class 1, and first the increase ratio: the new proportion of the calculated 1 st gray value is equal to the proportion of the 1 st gray value plus the original proportion of the 1 st gray value, wherein the new proportion of the gray value is the increasing proportion;
003, sequentially calculating the increasing proportion of all the gray values according to the calculation method of the type 1, wherein the new proportion of each gray value is equal to the proportion of the previous gray value plus the original proportion of the current gray value;
in 002 and 003, the specific calculation formula of the new ratio is as follows:
Figure DEST_PATH_IMAGE021
(1.2)
in the formula (1.2), the proportion of each pixel point is solved again,
Figure DEST_PATH_IMAGE023
i.e. the new occupation ratio, and the occupation ratio is the increase ratio of the gray value.
004, the new gray value calculation formula of the pixel point larger than the preset threshold value is as follows:
Figure 856468DEST_PATH_IMAGE002
wherein:
Figure 814060DEST_PATH_IMAGE004
is the new gray-scale value of the image,
Figure 488755DEST_PATH_IMAGE006
is the new proportion of the gray-scale value,
Figure 277719DEST_PATH_IMAGE008
is the original gray scale value.
And if the new gray value obtained by calculation is larger than 255, recording the gray value of the pixel point as 255.
Thirdly, performing inverse mapping on the obtained pixel points with the new gray values to form a new image, wherein compared with the original image, the gray values of the pixel points below a preset threshold are kept unchanged, and the gray values of the pixel points above the preset threshold are increased; the gray value of the background is increased, the difference value of the gray values of the background and the characters is enlarged, and the contrast between the characters and the background is more obvious.
It should be noted that this method is suitable for the situation where the background and the foreground are relatively close, but the foreground and the background are definitely demarcated, that is, the determination of the preset threshold value. The preset threshold value is not excluded from the cross gray value interval of the foreground and the background (the interval is not large), namely the preset threshold value exists above the preset threshold value, some foreground information exists, and the gray values of the position points are increased in the operation process; below the preset threshold, there is some background information, and the gray values of these location points are not changed during operation. However, as the values are close to the preset threshold value, the gray value is not increased in a large proportion, and therefore the foreground information is not lost too much; the background information does not cause much interference.
And fourthly, drawing a gray level histogram of the new image according to the new gray level value, and finishing the selection of the dynamic threshold value by using a double-peak method.
The bimodal method is one of the existing threshold extraction methods, provided that a bimodal map is obtained, and the demarcation point is the lowest point between the two peaks. In the embodiment, a histogram of a new image is drawn according to the gray scale value from small to large, a double-peak image is obtained, the lowest position between two peaks can be selected by the demarcation point, and the gray scale area can be better distinguished.
And fifthly, separating the background of the image through a dynamic threshold, wherein the two peak demarcation points are 128 and 144 (determined by the actual pixels of the sample), and the effect pair is shown in fig. 1 and fig. 2.
As can be seen from the tables in the two figures, the modified algorithm is more complete in the segmentation when the segmentation prefix number is extracted. The ninth digit 5 can be seen completely extracted in the first comparative example, and the first character S can be seen completely extracted in the second comparative example.
According to the technical scheme, under the condition that the contrast between the background and the foreground is not large (such as the whole is bright, the whole is dark, double backgrounds and the like), the gray scale proportion between the foreground and the background is adjusted through gray scale distribution polarization and homogenization, the original gray scale value is corrected by utilizing the proportion, and the contrast between the background and the foreground is increased, so that a good foundation is laid for the next background segmentation.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (4)

1. A background separation method based on gray distribution polarization and homogenization is characterized by comprising the following steps:
the method comprises the following steps of firstly, counting the number of different gray values in the whole character string region, and solving the proportion of each gray value in the gray value of a pixel point in the whole region;
secondly, keeping the proportion of the pixels with the gray values equal to and lower than a preset threshold unchanged, and sequentially carrying out backward accumulation on the proportion of the pixels with the gray values larger than the preset threshold to finish step homogenization;
thirdly, performing inverse mapping on the obtained pixel points with the new gray values to form a new image, wherein compared with the original image, the gray values of the pixel points below a preset threshold are kept unchanged, and the gray values of the pixel points above the preset threshold are increased;
fourthly, drawing a gray level histogram of a new image according to the new gray level value, and completing the selection of a dynamic threshold value by using a double-peak method;
and fifthly, separating the background of the image through a dynamic threshold value.
2. The background separation method based on gray scale distribution polarization and homogenization of claim 1, wherein in the second step, the preset threshold depends on the ratio of different gray scale values, and the preset threshold is equal to one of the different gray scale values.
3. The background separation method based on gray scale distribution polarization and homogenization according to claim 1, wherein in the second step, the specific operations of sequentially performing backward accumulation on the proportion of the pixels with the gray scale value larger than the preset threshold value are as follows:
001, arranging the gray values of the pixel points which are larger than the preset threshold value from small to large, recording each gray value as one class, and counting a plurality of classes, wherein the gray value which is equal to the preset threshold value is recorded as class 0;
002, increase calculation is performed on the gradation value from class 1, and first the increase ratio: the new proportion of the calculated 1 st gray value is equal to the proportion of the 1 st gray value plus the original proportion of the 1 st gray value, wherein the new proportion of the gray value is the increasing proportion;
003, sequentially calculating the increasing proportion of all the gray values according to the calculation method of the type 1, wherein the new proportion of each gray value is equal to the proportion of the previous gray value plus the original proportion of the current gray value;
004, the new gray value calculation formula of the pixel point larger than the preset threshold value is as follows:
Figure 732144DEST_PATH_IMAGE002
wherein:
Figure 259071DEST_PATH_IMAGE004
is the new gray-scale value of the image,
Figure 179754DEST_PATH_IMAGE006
is the new proportion of the gray-scale value,
Figure 450329DEST_PATH_IMAGE008
is the original gray scale value.
4. The background separation method based on gray scale distribution polarization and homogenization of claim 3, wherein if the new gray scale value obtained by calculation is greater than 255, the gray scale value of the pixel point is recorded as 255.
CN202110502806.0A 2021-05-10 2021-05-10 Background separation method based on gray level distribution polarization and homogenization Active CN112991378B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110502806.0A CN112991378B (en) 2021-05-10 2021-05-10 Background separation method based on gray level distribution polarization and homogenization

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110502806.0A CN112991378B (en) 2021-05-10 2021-05-10 Background separation method based on gray level distribution polarization and homogenization

Publications (2)

Publication Number Publication Date
CN112991378A true CN112991378A (en) 2021-06-18
CN112991378B CN112991378B (en) 2021-09-14

Family

ID=76337333

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110502806.0A Active CN112991378B (en) 2021-05-10 2021-05-10 Background separation method based on gray level distribution polarization and homogenization

Country Status (1)

Country Link
CN (1) CN112991378B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113256674A (en) * 2021-06-28 2021-08-13 恒银金融科技股份有限公司 Complex background separation method based on difference value
CN113255684A (en) * 2021-06-28 2021-08-13 恒银金融科技股份有限公司 Background separation method based on grayscale image overflow
CN113870233A (en) * 2021-09-30 2021-12-31 常州市宏发纵横新材料科技股份有限公司 Binding yarn detection method, computer equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101162504A (en) * 2007-11-27 2008-04-16 重庆工学院 Vena characteristic extracting method of finger vena identification system
CN101901477A (en) * 2010-07-27 2010-12-01 中国农业大学 Method and system for extracting field image edges of plant leaves
CN104021574A (en) * 2014-07-04 2014-09-03 武汉武大卓越科技有限责任公司 Method for automatically identifying pavement diseases
CN104268859A (en) * 2014-09-16 2015-01-07 奇瑞汽车股份有限公司 Image preprocessing method for night lane line detection
CN107895151A (en) * 2017-11-23 2018-04-10 长安大学 Method for detecting lane lines based on machine vision under a kind of high light conditions
CN110443166A (en) * 2019-07-23 2019-11-12 淮阴工学院 A kind of licence plate recognition method of haze weather
CN111783744A (en) * 2020-07-31 2020-10-16 上海仁童电子科技有限公司 Operation site safety protection detection method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101162504A (en) * 2007-11-27 2008-04-16 重庆工学院 Vena characteristic extracting method of finger vena identification system
CN101901477A (en) * 2010-07-27 2010-12-01 中国农业大学 Method and system for extracting field image edges of plant leaves
CN104021574A (en) * 2014-07-04 2014-09-03 武汉武大卓越科技有限责任公司 Method for automatically identifying pavement diseases
CN104268859A (en) * 2014-09-16 2015-01-07 奇瑞汽车股份有限公司 Image preprocessing method for night lane line detection
CN107895151A (en) * 2017-11-23 2018-04-10 长安大学 Method for detecting lane lines based on machine vision under a kind of high light conditions
CN110443166A (en) * 2019-07-23 2019-11-12 淮阴工学院 A kind of licence plate recognition method of haze weather
CN111783744A (en) * 2020-07-31 2020-10-16 上海仁童电子科技有限公司 Operation site safety protection detection method and device

Non-Patent Citations (7)

* Cited by examiner, † Cited by third party
Title
LUIS ENRIQUE TOLEDO等: "Binary threshold algorithm for license plate character segmentation", 《SPIE》 *
NILIMA KULKARNI: "Color Thresholding Method for Image Segmentation of Natural Images", 《I.J. IMAGE, GRAPHICS AND SIGNAL PROCESSING》 *
WEIXIN_30736301: "opencv-阈值处理", 《CSDN》 *
WEIXIN_39553272: "图像像素点赋值_OpenCV学习笔记(二)之图像阈值化", 《CSDN》 *
WEIXIN_39851008: "将特定像素点在图像上连接起来_Python图像阈值化处理及算法比对实例解析", 《CSDN》 *
朱磊等: "光照不均匀图像的灰度波动局部阈值分割", 《计算机工程与应用》 *
舒红平等: "基于灰度最优阈值的图像分割方法及应用", 《重庆工商大学学报(自然科学版)》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113256674A (en) * 2021-06-28 2021-08-13 恒银金融科技股份有限公司 Complex background separation method based on difference value
CN113255684A (en) * 2021-06-28 2021-08-13 恒银金融科技股份有限公司 Background separation method based on grayscale image overflow
CN113870233A (en) * 2021-09-30 2021-12-31 常州市宏发纵横新材料科技股份有限公司 Binding yarn detection method, computer equipment and storage medium

Also Published As

Publication number Publication date
CN112991378B (en) 2021-09-14

Similar Documents

Publication Publication Date Title
CN112991378B (en) Background separation method based on gray level distribution polarization and homogenization
Yoon et al. Image contrast enhancement based sub-histogram equalization technique without over-equalization noise
CN107038416B (en) Pedestrian detection method based on binary image improved HOG characteristics
CN109087254B (en) Unmanned aerial vehicle aerial image haze sky and white area self-adaptive processing method
CN107609558A (en) Character image processing method and processing device
CN102024144A (en) Container number identification method
JP2011030191A (en) Image processing apparatus and control method therefor
CN112200800A (en) Electrowetting display defect detection method based on gray level histogram gradient weighted target variance
CN102509095B (en) Number plate image preprocessing method
CN115131351B (en) Engine oil radiator detection method based on infrared image
CN111145105A (en) Image rapid defogging method and device, terminal and storage medium
CN115909353A (en) Image binarization processing method and device
CN111539980A (en) Multi-target tracking method based on visible light
JP5089797B2 (en) Image processing apparatus and control method thereof
CN113592750A (en) Infrared enhancement method based on gradient histogram
CN116823756A (en) Pile leg weld defect detection method
CN111223050A (en) Real-time image edge detection algorithm
CN110930423A (en) Object edge feature recognition and extraction method
CN105374021B (en) It is a kind of based on lines butt to pictograph image partition method and system
CN110751150A (en) FPGA-based binary neural network license plate recognition method and system
US8811741B2 (en) Differentiated processing method of image zones
CN114998186A (en) Image processing-based method and system for detecting surface scab defect of copper starting sheet
CN111695557B (en) Image processing method and device
CN109948543B (en) Method for extracting leading line of field close-range image
CN112528895A (en) Computing method for alteration detection of financial bill image ticket number

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant