CN113255684A - Background separation method based on grayscale image overflow - Google Patents
Background separation method based on grayscale image overflow Download PDFInfo
- Publication number
- CN113255684A CN113255684A CN202110715542.7A CN202110715542A CN113255684A CN 113255684 A CN113255684 A CN 113255684A CN 202110715542 A CN202110715542 A CN 202110715542A CN 113255684 A CN113255684 A CN 113255684A
- Authority
- CN
- China
- Prior art keywords
- value
- image
- overflow
- pixel
- separation threshold
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/28—Quantising the image, e.g. histogram thresholding for discrimination between background and foreground patterns
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/194—Segmentation; Edge detection involving foreground-background segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/50—Extraction of image or video features by performing operations within image blocks; by using histograms, e.g. histogram of oriented gradients [HoG]; by summing image-intensity values; Projection analysis
- G06V10/507—Summing image-intensity values; Histogram projection analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Multimedia (AREA)
- Image Processing (AREA)
- Image Analysis (AREA)
- Facsimile Image Signal Circuits (AREA)
Abstract
The invention discloses a background separation method based on grayscale image overflow, which comprises the following steps: step 1: performing overflow processing on the original image, and performing overflow calculation to obtain a mark 255 with a pixel value larger than 255 so as to obtain an overflow processed image; step 2: calculating a gray level histogram and a mean value of the overflow processed image, and calculating to obtain a separation threshold value which is a middle arbitrary value of the highest values of the gray level histogram on two sides of the mean value; and step 3: shrinking pixel points with pixel values smaller than the separation threshold value in the overflow processing image according to the same proportion, restoring the pixel points to the pixel value of the original image, and keeping pixel points with pixel values larger than or equal to the separation threshold value in the overflow processing image unchanged to obtain a restored image; and 4, step 4: calculating a gray level histogram and an average value of the restored image, calculating according to the method in the step 2 to obtain a new separation threshold value, and reducing the pixel value smaller than the new separation threshold value; and amplifying the pixel value larger than the new separation threshold value to obtain the final image with separated foreground and background.
Description
Technical Field
The invention belongs to the technical field of image recognition, and particularly relates to a background separation method based on gray-scale image overflow.
Background
In the process of conveying paper money in equipment, images are collected for multiple times to perform identification processing, in most cases, the whole image of the paper money is collected, then an interested area is extracted by adopting a physical coordinate positioning method, the interested area is used for identifying the denomination, currency and the like of the paper money, in the field of image processing, the interested area is an image area selected from the image, the area is a key point concerned by image analysis, and the area is defined so as to be further processed. And inaccurate cutting caused by background interference can be encountered in the process of segmenting the interested image of the paper currency. The foreground of the region of interest needs to be separated from the background. The influence on character extraction is small under the condition of a shallow background; in a deep background, characters are strongly merged into the background, so that the characters are difficult to separate from the background. Under the condition of high real-time requirement and an embedded system environment, a depth model cannot be adopted for recognition, so that the characters in the image need to be subjected to image segmentation processing, and the segmented result classification needs to be subjected to learning model training.
Backgrounds can be generally classified into several types: light background, monochromatic background, complex background. The background situation is well processed, a better effect can be obtained by adopting a binarization mode to separate the background from the characters, and the segmentation processing is very easy.
For a dual background image, it is intuitive to think of the way of using segmentation processing. However, in practice, the boundary of the segment is not very clear, and many times, the discontinuity is just on the same character, and the character cannot be recognized due to simple segmentation processing.
Disclosure of Invention
The invention aims to provide a background separation method based on gray-scale image overflow aiming at the technical defects in the prior art, and the method is used for extracting characters under the conditions of double backgrounds and difficult determination of segmentation boundaries.
The technical scheme adopted for realizing the purpose of the invention is as follows:
a background separation method based on gray scale image overflow is characterized by comprising the following steps:
step 1: performing overflow processing on the original image, and performing overflow calculation to obtain a mark 255 with a pixel value larger than 255 so as to obtain an overflow processed image;
step 2: calculating a gray level histogram and a mean value of the overflow processed image, and calculating to obtain a separation threshold value which is a middle arbitrary value of the highest values of the gray level histogram on two sides of the mean value;
and step 3: shrinking pixel points with pixel values smaller than the separation threshold value in the overflow processing image according to the same proportion, restoring the pixel points to the pixel value of the original image, and keeping pixel points with pixel values larger than or equal to the separation threshold value in the overflow processing image unchanged to obtain a restored image;
and 4, step 4: calculating a gray level histogram and an average value of the restored image, calculating according to the method in the step 2 to obtain a new separation threshold value, and reducing the pixel value smaller than the new separation threshold value; and amplifying the pixel value larger than the new separation threshold value to obtain the final image with separated foreground and background.
Preferably, the original image is a gray scale image.
Preferably, the overflow factor takes a value between 2 and 3.
Preferably, in step 4, the pixel value smaller than the new separation threshold is reduced, and the value of the reduction calculation coefficient is between 1.5 and 2; and amplifying the pixel value larger than the new separation threshold, wherein the value of the amplification calculation coefficient is between 1.5 and 2, and when the pixel value obtained by amplification calculation is larger than 255, the pixel value of the pixel point is marked as 255.
The invention has the beneficial effects that:
(1) this scheme addresses the case where the background is uniform (or limited noise) and close to the foreground, or double background. The linear transformation produces a gradient difference effect due to distance by using a gray scale multiplication method. I.e., linear differences close to a value of 0 are significantly smaller than linear differences far from a value of 0, so that the separation threshold is easily determined.
(2) The characteristics of gray distribution embodied by the gray histogram are used for determining two concentrated gray areas, so that the separation threshold value is easier to determine.
(3) And a great amount of background interference factors are removed by using the difference between the foreground and the background of the gray-scale image. And the method provides guarantee for the image to form two polarization distributions on the gray level histogram.
Drawings
FIG. 1 is a schematic flow diagram of the present invention.
Detailed Description
The invention is described in further detail below with reference to the figures and 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.
This scheme is applicable to two kinds of situations: 1, the background is very close to the foreground; foreground refers to a string of numbers (characters) and background is a gray area and a white area. 2, a strongly contrasting double background; the double background refers to a background (gray area and white area) in which two kinds of gray scales are clearly distinguished. Such background may have a distinct boundary at their boundary, and this boundary may have a great influence on the extraction of foreground numbers, for example, the position of this boundary may appear at different positions of characters, or cause some characters to be confused with other characters, resulting in recognition errors. By adopting the scheme, the gray area of the background can be overflowed, so that the background is close to the background on the other side and is separated from the foreground.
A background separation method based on grayscale map overflow, as shown in fig. 1, comprising the following steps:
step 1: performing overflow processing on the original image, and performing overflow calculation to obtain a mark 255 with a pixel value larger than 255 so as to obtain an overflow processed image; the original image is a gray scale image in a format of bmp.
In this step, the overflow coefficient of the overflow processing of the original image is between 2 and 3, and the overflow coefficient depends on the distribution situation of the gray values of the original image.
The whole image of the paper money is obtained by scanning, and because the positions of the serial numbers of different currencies of various countries are fixed, the interested region can be intercepted and obtained by utilizing the physical coordinate positioning, and the interested region is converted into a gray scale image, namely the most basic image processed by the method, namely the original image.
The overflow processing method is to multiply the pixel values of all the pixel points in the region of interest by the same overflow coefficient to obtain a new pixel value, and the calculation result is greater than 255 and is marked as 255, and it can be known from our experience that the pixel value of the region of interest is more than 70-100, so the overflow coefficient is selected as 2 in this embodiment, and an overflow processing image is obtained.
Because the content required by us is a region with a small gray value (in this embodiment, the foreground is a crown word number, that is, effective information, which is information that needs to be obtained by us), and the background is a region with a high gray value, noise points near the background can be filtered out together by an overflow mode.
Step 2: and calculating the gray level histogram and the mean value of the overflow processed image, and calculating to obtain a separation threshold value which is any value in the middle of the highest values of the gray level histogram on the two sides of the mean value.
The adjustment coefficient as the separation threshold is a section ratio determined according to the image gradation distribution, and the intermediate arbitrary value in this embodiment is a value calculated when the adjustment coefficient is 0.5. The foreground and background segmentation is not obvious, mainly the distribution of the gray level histogram is relatively concentrated, the overflow coefficient can stretch the relative distance between the foreground and the background, and the average value of the whole image is higher. Therefore, it is necessary to balance the adjustment coefficients, the separation threshold is taken as the middle arbitrary value of the highest values on both sides of the mean value, which is related to the image gray distribution, and is balanced by the adjustment coefficients, which is not necessarily the median, in this embodiment, the adjustment coefficient is set to 0.5, and the separation threshold is taken as the median, and in practical application, the value can be taken around the median.
The middle arbitrary value is not necessarily a half position, but represents only a certain value between two distribution areas. And determination of this value requires adjustment of the coefficients to set. The adjustment factor means the proportionality factor of the distance between the two distributions. The value of the adjusting coefficient is determined according to the distribution condition of the histogram, and can be set according to manual judgment, or can be automatically calculated, the automatic calculation is relatively complex, and the adjusting coefficient can be determined according to the weight ratio of the two-side distribution.
And step 3: shrinking pixel points with pixel values smaller than the separation threshold value in the overflow processing image according to the same proportion, restoring the pixel points to the pixel value of the original image, and keeping pixel points with pixel values larger than or equal to the separation threshold value in the overflow processing image unchanged to obtain a restored image;
and 4, step 4: calculating a gray level histogram and an average value of the restored image, calculating according to the method in the step 2 to obtain a new separation threshold value, and reducing the pixel value smaller than the new separation threshold value; and amplifying the pixel value larger than the new separation threshold value to obtain the final image with separated foreground and background.
Reducing the pixel value smaller than the new separation threshold value, wherein the reduction calculation coefficient is 1.5-2; and amplifying the pixel values larger than the new separation threshold value, wherein the amplification calculation coefficient is 1.5-2, and obtaining the pixel value larger than 255 and marking as 255.
The reduction of pixel values smaller than the new separation threshold in this step is to enhance the foreground (i.e., to maintain the sharpness of the character to be extracted) because it becomes lighter while enlarging. So the reduction is to keep it in its original state.
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 scale image overflow is characterized by comprising the following steps:
step 1: performing overflow processing on the original image, and performing overflow calculation to obtain a mark 255 with a pixel value larger than 255 so as to obtain an overflow processed image;
step 2: calculating a gray level histogram and a mean value of the overflow processed image, and calculating to obtain a separation threshold value which is a middle arbitrary value of the highest values of the gray level histogram on two sides of the mean value;
and step 3: shrinking pixel points with pixel values smaller than the separation threshold value in the overflow processing image according to the same proportion, restoring the pixel points to the pixel value of the original image, and keeping pixel points with pixel values larger than or equal to the separation threshold value in the overflow processing image unchanged to obtain a restored image;
and 4, step 4: calculating a gray level histogram and an average value of the restored image, calculating according to the method in the step 2 to obtain a new separation threshold value, and reducing the pixel value smaller than the new separation threshold value; and amplifying the pixel value larger than the new separation threshold value to obtain the final image with separated foreground and background.
2. The method as claimed in claim 1, wherein the original image is a gray-scale image.
3. The background separation method based on gray scale image overflow as claimed in claim 1, wherein the overflow factor is between 2-3.
4. The background separation method based on the gray scale image overflow as claimed in claim 1, wherein in step 4, the pixel values smaller than the new separation threshold are reduced, and the reduction calculation coefficient value is between 1.5 and 2; and amplifying the pixel value larger than the new separation threshold, wherein the value of the amplification calculation coefficient is between 1.5 and 2, and when the pixel value obtained by amplification calculation is larger than 255, the pixel value of the pixel point is marked as 255.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110715542.7A CN113255684B (en) | 2021-06-28 | 2021-06-28 | Background separation method based on grayscale image overflow |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110715542.7A CN113255684B (en) | 2021-06-28 | 2021-06-28 | Background separation method based on grayscale image overflow |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113255684A true CN113255684A (en) | 2021-08-13 |
CN113255684B CN113255684B (en) | 2021-10-26 |
Family
ID=77189777
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110715542.7A Active CN113255684B (en) | 2021-06-28 | 2021-06-28 | Background separation method based on grayscale image overflow |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113255684B (en) |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101739672A (en) * | 2009-12-02 | 2010-06-16 | 北京中星微电子有限公司 | Method and device for equalizing histogram based on sub-regional interpolation |
CN103440630A (en) * | 2013-09-02 | 2013-12-11 | 南京理工大学 | Large-dynamic-range infrared image display and detail enhancement method based on guiding filter |
CN104715445A (en) * | 2013-12-13 | 2015-06-17 | 腾讯科技(深圳)有限公司 | Image processing method and system |
CN106097287A (en) * | 2016-06-27 | 2016-11-09 | 湖北久之洋红外系统股份有限公司 | A kind of multichannel image bearing calibration |
CN107025652A (en) * | 2017-05-05 | 2017-08-08 | 太原理工大学 | A kind of flame detecting method based on kinetic characteristic and color space time information |
CN109241973A (en) * | 2018-08-21 | 2019-01-18 | 南京工程学院 | A kind of full-automatic soft dividing method of character under grain background |
CN110443806A (en) * | 2019-04-30 | 2019-11-12 | 浙江大学 | A kind of transparent floating harmful influence image partition method of the water surface based on targets improvement processing |
US20200082208A1 (en) * | 2018-09-06 | 2020-03-12 | International Business Machines Corporation | Image binarization using mean restrain |
CN111553926A (en) * | 2020-04-30 | 2020-08-18 | 中国航空无线电电子研究所 | Threshold segmentation method based on two-dimensional Tsallis gray scale entropy fast iteration |
CN112991378A (en) * | 2021-05-10 | 2021-06-18 | 恒银金融科技股份有限公司 | Background separation method based on gray level distribution polarization and homogenization |
-
2021
- 2021-06-28 CN CN202110715542.7A patent/CN113255684B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101739672A (en) * | 2009-12-02 | 2010-06-16 | 北京中星微电子有限公司 | Method and device for equalizing histogram based on sub-regional interpolation |
CN103440630A (en) * | 2013-09-02 | 2013-12-11 | 南京理工大学 | Large-dynamic-range infrared image display and detail enhancement method based on guiding filter |
CN104715445A (en) * | 2013-12-13 | 2015-06-17 | 腾讯科技(深圳)有限公司 | Image processing method and system |
CN106097287A (en) * | 2016-06-27 | 2016-11-09 | 湖北久之洋红外系统股份有限公司 | A kind of multichannel image bearing calibration |
CN107025652A (en) * | 2017-05-05 | 2017-08-08 | 太原理工大学 | A kind of flame detecting method based on kinetic characteristic and color space time information |
CN109241973A (en) * | 2018-08-21 | 2019-01-18 | 南京工程学院 | A kind of full-automatic soft dividing method of character under grain background |
US20200082208A1 (en) * | 2018-09-06 | 2020-03-12 | International Business Machines Corporation | Image binarization using mean restrain |
CN110443806A (en) * | 2019-04-30 | 2019-11-12 | 浙江大学 | A kind of transparent floating harmful influence image partition method of the water surface based on targets improvement processing |
CN111553926A (en) * | 2020-04-30 | 2020-08-18 | 中国航空无线电电子研究所 | Threshold segmentation method based on two-dimensional Tsallis gray scale entropy fast iteration |
CN112991378A (en) * | 2021-05-10 | 2021-06-18 | 恒银金融科技股份有限公司 | Background separation method based on gray level distribution polarization and homogenization |
Non-Patent Citations (2)
Title |
---|
TIANMING YU ET AL.: "Dynamic Background Subtraction Using Histograms Based on Fuzzy C-Means Clustering and Fuzzy Nearness Degree", 《DIGITAL OBJECT IDENTIFIER》 * |
熊志勇 等: "基于差值直方图平移的彩色图像可逆信息隐藏", 《四川大学学报(工程科技版)》 * |
Also Published As
Publication number | Publication date |
---|---|
CN113255684B (en) | 2021-10-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110349126B (en) | Convolutional neural network-based marked steel plate surface defect detection method | |
CN109377485B (en) | Machine vision detection method for instant noodle packaging defects | |
US20190019055A1 (en) | Word segmentation system, method and device | |
CN103049763B (en) | Context-constraint-based target identification method | |
CN108009529B (en) | Forest fire smoke video target detection method based on characteristic root and hydrodynamics | |
CN112734729B (en) | Water gauge water level line image detection method and device suitable for night light supplement condition and storage medium | |
CN105374015A (en) | Binary method for low-quality document image based on local contract and estimation of stroke width | |
CN107862667A (en) | A kind of city shadow Detection and minimizing technology based on high-resolution remote sensing image | |
CN109840483B (en) | Landslide crack detection and identification method and device | |
CN110175556B (en) | Remote sensing image cloud detection method based on Sobel operator | |
CN103729856B (en) | A kind of Fabric Defects Inspection detection method utilizing S-transformation signal extraction | |
CN109447111B (en) | Remote sensing supervision classification method based on subclass training samples | |
CN115797798A (en) | Ecological restoration effect evaluation method based on abandoned mine remote sensing image | |
CN110751606B (en) | Foam image processing method and system based on neural network algorithm | |
CN110309830B (en) | Carapace bone word automatic segmentation method based on mathematical morphology and regional connectivity | |
CN114332650A (en) | Remote sensing image road identification method and system | |
CN115063430A (en) | Electric pipeline crack detection method based on image processing | |
Mello et al. | Automatic image segmentation of old topographic maps and floor plans | |
CN116152674A (en) | Dam unmanned aerial vehicle image crack intelligent recognition method based on improved U-Net model | |
CN113255684B (en) | Background separation method based on grayscale image overflow | |
CN111860500B (en) | Shoe stamp wearing area detection and edge tracing method | |
CN110400320B (en) | Segmentation method of electrowetting defective pixels | |
CN109003255B (en) | Cell nucleus segmentation method and system of fluorescence in-situ hybridization image | |
CN110689538B (en) | Tunnel lining crack image detection method | |
CN114937167A (en) | Bridge pavement crack image crack detection method under complex background |
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 |