CN106251358B - A kind of image processing method and device - Google Patents

A kind of image processing method and device Download PDF

Info

Publication number
CN106251358B
CN106251358B CN201610643274.1A CN201610643274A CN106251358B CN 106251358 B CN106251358 B CN 106251358B CN 201610643274 A CN201610643274 A CN 201610643274A CN 106251358 B CN106251358 B CN 106251358B
Authority
CN
China
Prior art keywords
data block
background removal
pixel
data
background
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.)
Active
Application number
CN201610643274.1A
Other languages
Chinese (zh)
Other versions
CN106251358A (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.)
Zhuhai Pantum Electronics Co Ltd
Original Assignee
Zhuhai Seine 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 Zhuhai Seine Technology Co Ltd filed Critical Zhuhai Seine Technology Co Ltd
Priority to CN201610643274.1A priority Critical patent/CN106251358B/en
Publication of CN106251358A publication Critical patent/CN106251358A/en
Priority to PCT/CN2017/080898 priority patent/WO2018028234A1/en
Application granted granted Critical
Publication of CN106251358B publication Critical patent/CN106251358B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

The embodiment of the invention provides a kind of image processing method and devices.On the one hand, the embodiment of the present invention is by being divided at least two data blocks for image to be processed, then, each data block is identified, to obtain the recognition result of each data block, it is content-data block or the data block is block of background data that the recognition result of each data block, which includes the data block, to, according to the recognition result of each data block, obtain the background removal threshold value of each data block, to carry out background removal processing to each data block according to the background removal threshold value of each data block.Therefore, technical solution provided in an embodiment of the present invention, which is able to solve, handles caused excess processes problem due to carrying out unified background removal to whole image in the prior art, and in turn in caused image the problem of content partial loss.

Description

Image processing method and device
[ technical field ] A method for producing a semiconductor device
The present invention relates to the field of image processing technologies, and in particular, to an image processing method and apparatus.
[ background of the invention ]
Nowadays, users often need to perform processes such as printing, faxing, scanning, copying and the like on various certificates, documents, photos and the like, and the obtained images such as printed matters, fax matters, scanned matters, copied matters and the like often have higher image quality requirements.
Since most images contain content parts and background parts, the background parts in the images are unnecessary, and the existence of the background parts can interfere the identification of the content parts in the printing, faxing, scanning and copying processes, so that the quality of the obtained images of printed matters, fax matters, scanned matters, copied matters and the like is poor.
In order to solve the above problem, in the prior art, a uniform background removal process is performed on the entire image. That is, a fixed background removal threshold is set for the entire image, and the entire image is subjected to uniform background removal processing by the fixed background removal threshold.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
in the prior art, background removal processing is performed on a background part and a content part of a whole image through a fixed background removal threshold, so that excessive processing on the image is caused, the content part in the image is lost, and the background removal processing effect is poor.
[ summary of the invention ]
In view of this, embodiments of the present invention provide an image processing method and apparatus, so as to solve the problem of over-processing caused by performing uniform background removal processing on an entire image and the problem of content loss in the image in the prior art.
In one aspect, an embodiment of the present invention provides an image processing method, including:
dividing an image to be processed into at least two data blocks;
identifying each data block to obtain an identification result of each data block, wherein the identification result of each data block comprises that the data block is a content data block or a background data block;
obtaining a background removal threshold value of each data block according to the identification result of each data block;
and performing background removal processing on each data block according to the background removal threshold value of each data block.
The above-mentioned aspect and any possible implementation manner further provide an implementation manner, where identifying each of the data blocks to obtain an identification result of each of the data blocks, including:
acquiring an average value of pixel values of pixel points in each data block;
obtaining the number of target pixel points in each data block according to the pixel value of the pixel point in each data block and the average value of the pixel values of the pixel points in each data block, wherein the target pixel points are pixel points of which the difference degree between the pixel values in the data block and the average value of the pixel values of the pixel points in the data block is greater than or equal to a preset difference threshold value;
comparing the number of target pixel points in each data block with a preset number threshold value respectively;
identifying data blocks with the number of target pixel points being less than or equal to the number threshold as background data blocks, or identifying data blocks with the number of target pixel points being greater than the number threshold as content data blocks.
The above-mentioned aspect and any possible implementation manner further provide an implementation manner, where identifying each of the data blocks to obtain an identification result of each of the data blocks, including:
acquiring an average value of pixel values of pixel points in each data block;
obtaining the variance of the pixel value of each data block according to the pixel value of the pixel point in each data block and the average value of the pixel values of the pixel points in each data block;
comparing the variance of the pixel value of each data block with a preset variance threshold value;
and identifying a data block of which the variance of the pixel values is greater than or equal to the variance threshold as a content data block, or identifying a data block of which the variance of the pixel values is less than the variance threshold as a background data block.
The above-described aspect and any possible implementation manner further provide an implementation manner, where obtaining the background removal threshold of each data block according to the identification result of each data block includes:
if the data block is a background data block, obtaining the background removal threshold value through a formula as follows:
wherein, CNA background removal threshold value of the data block is obtained, N is the processing sequence number of the data block in the at least two data blocks, M is the processing sequence number of the data block in the background data block, CM-1A background removal threshold, A, for a background data block preceding said data blockNThe average value of the pixel values of the pixel points in the data block is obtained;
if the data block is a content data block, obtaining the background removal threshold value through a formula as follows:
CN=CN-1+O
wherein, CNRemoving a threshold value for the background of the data block, N being the processing order number of the data block in the at least two data blocks, CN-1A background removal threshold for a previous one of the data blocks, and O is a compensation coefficient.
The above-described aspect and any possible implementation manner further provide an implementation manner, where obtaining the background removal threshold of each data block according to the identification result of each data block includes:
for each data block, selecting a pixel point from the data block as a candidate pixel point;
obtaining an absolute value of a difference between the number of pixel points in a first specified range of the candidate pixel points and the number of pixel points in a second specified range of the candidate pixel points in the data block, wherein the first specified range and the second specified range are not overlapped completely;
comparing the absolute value with a preset absolute value threshold;
and if the absolute value is smaller than or equal to the absolute value threshold, determining the pixel value of the candidate pixel point as a background removal threshold of the data block.
The above-described aspect and any possible implementation manner further provide an implementation manner, where obtaining the background removal threshold of each data block according to the identification result of each data block includes:
presetting a first background removal threshold, wherein the first background removal threshold is a background removal threshold of a background data block; if the data block is a background data block, taking the first background removal threshold as a background removal threshold of the data block; and/or the presence of a gas in the gas,
presetting a second background removal threshold, wherein the second background removal threshold is a background removal threshold of the content data block; and if the data block is a content data block, taking the second background removal threshold as the background removal threshold of the data block.
The above-described aspect and any possible implementation manner further provide an implementation manner, where obtaining the background removal threshold of each data block according to the identification result of each data block includes:
determining a target data block according to the identification result of each data block, wherein all data blocks before the target data block are background data blocks, and all data blocks after the target data block are content data blocks;
acquiring an average value of pixel values of pixel points in each data block before the target data block, wherein the average value is used as a background removal threshold value of each data block in all data blocks before the target data block; and acquiring an average value of the sum of background removal thresholds of all background data blocks before the target data block, wherein the average value is used as the background removal threshold of each data block in all data blocks after the target data block.
The above-described aspect and any possible implementation manner further provide an implementation manner, where performing background removal processing on each data block according to a background removal threshold of each data block includes:
determining a pixel point of which the pixel value in the data block is greater than the background removal threshold of the data block according to the pixel value of the pixel point in each data block and the background removal threshold of each data block, and using the pixel point as a first designated pixel point in each data block; adjusting the pixel value of a first designated pixel point in each data block to be a maximum pixel value; or,
determining pixel points of which the pixel values are smaller than or equal to the background removal threshold value of each data block in the data blocks according to the pixel values of the pixel points in each data block and the background removal threshold value of each data block, and using the pixel points as second designated pixel points in each data block; the pixel values of the second designated pixel points in each of said data blocks are kept unchanged.
One of the above technical solutions has the following beneficial effects:
in the embodiment of the invention, an image to be processed is divided into at least two data blocks, and then each data block is identified to obtain an identification result of each data block, wherein the identification result of each data block comprises that the data block is a content data block or a background data block, so that a background removal threshold value of each data block is obtained according to the identification result of each data block, and further, each data block is subjected to background removal processing according to the background removal threshold value of each data block. In the embodiment of the present invention, an image to be processed is divided into at least two smaller data blocks, and then a background removal threshold corresponding to each data block is obtained according to an identification result of each divided data block for performing background removal processing, which is different from the prior art in which a fixed background removal threshold is used to perform background removal processing on an entire image to be processed Problems and, in turn, problems with the loss of portions of content in the image.
In another aspect, an embodiment of the present invention provides an image processing apparatus, including:
the dividing unit is used for dividing the image to be processed into at least two data blocks;
the identification unit is used for identifying each data block to obtain an identification result of each data block, wherein the identification result of each data block comprises that the data block is a content data block or a background data block;
the acquisition unit is used for acquiring a background removal threshold of each data block according to the identification result of each data block;
and the processing unit is used for carrying out background removal processing on each data block according to the background removal threshold value of each data block.
The above-mentioned aspect and any possible implementation manner further provide an implementation manner, where the identifying unit is specifically configured to:
acquiring an average value of pixel values of pixel points in each data block;
obtaining the number of target pixel points in each data block according to the pixel value of the pixel point in each data block and the average value of the pixel values of the pixel points in each data block, wherein the target pixel points are pixel points of which the difference degree between the pixel values in the data block and the average value of the pixel values of the pixel points in the data block is greater than or equal to a preset difference threshold value;
comparing the number of target pixel points in each data block with a preset number threshold value respectively;
identifying data blocks with the number of target pixel points being less than or equal to the number threshold as background data blocks, or identifying data blocks with the number of target pixel points being greater than the number threshold as content data blocks.
The above-mentioned aspect and any possible implementation manner further provide an implementation manner, where the identifying unit is specifically configured to:
acquiring an average value of pixel values of pixel points in each data block;
obtaining the variance of the pixel value of each data block according to the pixel value of the pixel point in each data block and the average value of the pixel values of the pixel points in each data block;
comparing the variance of the pixel value of each data block with a preset variance threshold value;
and identifying a data block of which the variance of the pixel values is greater than or equal to the variance threshold as a content data block, or identifying a data block of which the variance of the pixel values is less than the variance threshold as a background data block.
The above-described aspect and any possible implementation manner further provide an implementation manner, where the obtaining unit is specifically configured to:
if the data block is a background data block, obtaining the background removal threshold value through a formula as follows:
wherein, CNA background removal threshold value of the data block is obtained, N is the processing sequence number of the data block in the at least two data blocks, M is the processing sequence number of the data block in the background data block, CM-1A background removal threshold, A, for a background data block preceding said data blockNThe average value of the pixel values of the pixel points in the data block is obtained;
if the data block is a content data block, obtaining the background removal threshold value through a formula as follows:
CN=CN-1+O
wherein, CNRemoving a threshold value for the background of the data block, N being the processing order number of the data block in the at least two data blocks, CN-1A background removal threshold for a previous one of the data blocks, and O is a compensation coefficient.
The above-described aspect and any possible implementation manner further provide an implementation manner, where the obtaining unit is specifically configured to:
for each data block, selecting a pixel point from the data block as a candidate pixel point;
obtaining an absolute value of a difference between the number of pixel points in a first specified range of the candidate pixel points and the number of pixel points in a second specified range of the candidate pixel points in the data block, wherein the first specified range and the second specified range are not overlapped completely;
comparing the absolute value with a preset absolute value threshold;
and if the absolute value is smaller than or equal to the absolute value threshold, determining the pixel value of the candidate pixel point as a background removal threshold of the data block.
The above-described aspect and any possible implementation manner further provide an implementation manner, where the obtaining unit is specifically configured to:
presetting a first background removal threshold, wherein the first background removal threshold is a background removal threshold of a background data block; if the data block is a background data block, taking the first background removal threshold as a background removal threshold of the data block; and/or the presence of a gas in the gas,
presetting a second background removal threshold, wherein the second background removal threshold is a background removal threshold of the content data block; and if the data block is a content data block, taking the second background removal threshold as the background removal threshold of the data block.
The above-described aspect and any possible implementation manner further provide an implementation manner, where the obtaining unit is specifically configured to:
determining a target data block according to the identification result of each data block, wherein all data blocks before the target data block are background data blocks, and all data blocks after the target data block are content data blocks;
acquiring an average value of pixel values of pixel points in each data block before the target data block, wherein the average value is used as a background removal threshold value of each data block in all data blocks before the target data block; and acquiring an average value of the sum of background removal thresholds of all background data blocks before the target data block, wherein the average value is used as the background removal threshold of each data block in all data blocks after the target data block.
The above-described aspect and any possible implementation further provide an implementation, where the processing unit is configured to:
determining a pixel point of which the pixel value in the data block is greater than the background removal threshold of the data block according to the pixel value of the pixel point in each data block and the background removal threshold of each data block, and using the pixel point as a first designated pixel point in each data block; adjusting the pixel value of a first designated pixel point in each data block to be a maximum pixel value; or,
determining pixel points of which the pixel values are smaller than or equal to the background removal threshold value of each data block in the data blocks according to the pixel values of the pixel points in each data block and the background removal threshold value of each data block, and using the pixel points as second designated pixel points in each data block; the pixel values of the second designated pixel points in each of said data blocks are kept unchanged.
One of the above technical solutions has the following beneficial effects:
in the embodiment of the present invention, an image to be processed is divided into at least two data blocks by a dividing unit in an image processing apparatus, and then an identification unit in the image processing apparatus identifies each data block to obtain an identification result of each data block, where the identification result of each data block includes that the data block is a content data block or that the data block is a background data block, so that an obtaining unit in the image processing apparatus obtains a background removal threshold of each data block according to the identification result of each data block, and further, a processing unit in the image processing apparatus performs background removal processing on each data block according to the background removal threshold of each data block. In the embodiment of the present invention, an image to be processed is divided into at least two smaller data blocks, and then a background removal threshold corresponding to each data block is obtained according to an identification result of each divided data block for performing background removal processing, which is different from the prior art in which a fixed background removal threshold is used to perform background removal processing on an entire image to be processed Problems and, in turn, problems with the loss of portions of content in the image.
[ description of the drawings ]
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
Fig. 1 is a schematic flowchart of a first embodiment of an image processing method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a first process for identifying each data block according to an embodiment of the present invention;
FIG. 3 is a second flow chart illustrating the identification of each data block according to an embodiment of the present invention;
FIG. 4 is a flow chart illustrating obtaining a background removal threshold for each data block in an embodiment of the present invention;
FIG. 5 is a diagram illustrating the recognition result of a page of an image to be processed;
FIG. 6 is a diagram illustrating the recognition result of another page of the to-be-processed image;
FIG. 7 is a diagram illustrating a background removal process for each data block according to an embodiment of the present invention;
FIG. 8 is a flowchart illustrating a second embodiment of an image processing method according to the present invention;
fig. 9 is a functional block diagram of an image processing apparatus according to an embodiment of the present invention.
[ detailed description ] embodiments
For better understanding of the technical solutions of the present invention, the following detailed descriptions of the embodiments of the present invention are provided with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be understood that the term "and/or" as used herein is merely one type of association that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
It should be understood that although the terms first, second, etc. may be used to describe designated pixels in the embodiments of the present invention, these designated pixels should not be limited to these terms. These terms are only used to distinguish designated pixels from each other. For example, without departing from the scope of the embodiments of the present invention, the first designated pixel point may also be referred to as a second designated pixel point, and similarly, the second designated pixel point may also be referred to as a first designated pixel point.
The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
Example one
An embodiment of the present invention provides an image processing method, please refer to fig. 1, which is a flowchart illustrating a first embodiment of the image processing method according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
s101, dividing an image to be processed into at least two data blocks.
In the embodiment of the present invention, the image to be processed is an image that needs to be processed by printing, faxing, scanning, copying, and the like, and may include, but is not limited to, various certificates, documents, photos, tickets, and the like, and this is not particularly limited in the embodiment of the present invention.
Specifically, the whole image to be processed is divided into at least two data blocks, so as to perform background removal processing on each data block.
In a specific implementation process, a specific implementation manner of dividing the image to be processed is not particularly limited in the embodiment of the present invention. For example, the image to be processed may be divided into regular patterns to obtain data blocks in the shape of the regular patterns; alternatively, the image to be processed may be divided irregularly, so as to obtain irregular data blocks.
S102, identifying each data block to obtain the identification result of each data block.
Specifically, the identification result of each data block includes that the data block is a content data block or that the data block is a background data block.
It should be noted that, in the embodiment of the present invention, the content data block is a data block including content data, and it should be noted that the content data block may include partial background data; and the background data block is a data block containing only background data.
For example, when a user performs print processing on a page of image to be processed, a content portion of the image to be processed often includes a blank background with a certain area, that is, includes partial background data, and an obtained data block at this time is a content data block; blank areas with a certain area may exist around the content portion in one page of the image to be processed, for example, blank areas of a page of a document, where the blank areas do not contain other data, and only contain background data, and at this time, the data blocks obtained after the blank areas are divided are the background data blocks.
S103, obtaining a background removal threshold value of each data block according to the identification result of each data block.
Specifically, after the identification result of each data block is obtained, the background removal threshold of each data block needs to be obtained according to the identification result of each data block, so as to perform background removal processing on each data block in the whole image to be processed.
And S104, performing background removal processing on each data block according to the background removal threshold value of each data block.
Note that the execution main body of S101 to S104 may be an image processing apparatus, which may be located in an image processing apparatus such as a printer, a facsimile, a scanner, and a copying machine.
At present, there is also a prior art for performing background removal processing on an image to be processed, in which a whole image to be processed is divided into at least two data blocks, then a background removal threshold is obtained according to a first data block, and then the obtained background removal threshold is used to perform uniform background removal processing on all data blocks in the whole image to be processed. Therefore, only when the image to be processed is placed on the specific area of the scanning platen, a more reasonable background removal threshold value can be obtained according to the first data block in the image to be processed for background removal processing, so that if the placement position of the image to be processed exceeds the specific area of the scanning platen, because the image processing device scans the white board, at this time, the background removal threshold value obtained according to the first data block in the image to be processed has a larger deviation, and the effective background removal processing of the image to be processed is difficult to perform. In addition, the scheme only carries out background removal processing on the whole image to be processed through a fixed background removal threshold, and also has the problem of over-processing and further the problem of content part loss in the image.
In contrast, the image processing method provided in the embodiment of the present invention divides the entire image to be processed, identifies all the divided data blocks, and obtains the background removal threshold of each data block, and further performs the background removal processing on each data block by using the background removal threshold of each data block. Therefore, in the embodiment of the present invention, the background removal processing is performed on all the divided data blocks by using their respective background removal thresholds, so that the influence of the scanning whiteboard in the image processing apparatus on the background removal processing is greatly reduced. Therefore, in the embodiment of the invention, the image to be processed can be placed at any position of the scanning platen, and effective background removal processing can be carried out without influencing the background removal effect of the image to be processed.
One technical scheme in the embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, the image to be processed is divided into at least two data blocks, and then each data block is identified to obtain the identification result of each data block, wherein the identification result of each data block comprises that the data block is a content data block or a background data block, so that the background removal threshold value of each data block is obtained according to the identification result of each data block, and further, the background removal processing is carried out on each data block according to the background removal threshold value of each data block. In the embodiment of the present invention, an image to be processed is divided into at least two smaller data blocks, and then a background removal threshold corresponding to each data block is obtained according to an identification result of each divided data block for performing background removal processing, which is different from the prior art in which a fixed background removal threshold is used to perform background removal processing on an entire image to be processed Problems and, in turn, problems with the loss of portions of content in the image.
Example two
Based on the image processing method provided in the first embodiment, the embodiment of the present invention specifically describes an implementation manner of "identifying each data block to obtain an identification result of each data block" in S102.
Specifically, in the embodiment of the present invention, identifying each data block to obtain an identification result of each data block may include, but is not limited to, the following two implementation manners:
mode 1: acquiring an average value of pixel values of pixel points in each data block, then acquiring the number of target pixel points in each data block according to the pixel values of the pixel points in each data block and the average value of the pixel values of the pixel points in each data block, then comparing the number of the target pixel points in each data block with a preset number threshold respectively, and further identifying the data blocks of which the number of the target pixel points is less than or equal to the number threshold as background data blocks or identifying the data blocks of which the number of the target pixel points is greater than the number threshold as content data blocks.
Specifically, the target pixel point is a pixel point of which the difference degree between the pixel value in the data block and the average value of the pixel values of the pixel points in the data block is greater than or equal to a preset difference threshold value.
In a specific implementation process, the difference between the pixel value of the pixel in the data block and the average value of the pixel values of the pixels in the data block is obtained, the absolute value of the difference between the pixel value of each pixel in the data block and the average value of the pixel values of the pixels in the data block can be calculated, and the absolute value is used as the difference between the pixel value of the pixel in the data block and the average value of the pixel values of the pixels in the data block.
Specifically, the difference threshold and the number threshold may be preset according to actual needs, and this is not particularly limited in the embodiment of the present invention. For example, the difference threshold may be a value in the range of [16, 64 ].
Mode 2: the method comprises the steps of obtaining the average value of pixel values of pixel points in each data block, obtaining the variance of the pixel values of each data block according to the pixel values of the pixel points in each data block and the average value of the pixel values of the pixel points in each data block, comparing the variance of the pixel values of each data block with a preset variance threshold value, and identifying the data block with the variance of the pixel values larger than or equal to the variance threshold value as a content data block or identifying the data block with the variance of the pixel values smaller than the variance threshold value as a background data block.
It can be understood that, in the embodiment of the present invention, each data block may include, but is not limited to, at least two pixel points, each pixel point has its own pixel value, and the average value of the pixel values of the pixel points in each data block is obtained.
Specifically, in the embodiment of the present invention, if a data block in the image to be processed has a processing sequence number N, a of the data block in at least two data blocksNThe average value of the pixel values of the pixels in the data block is obtained, the data block comprises n pixels, n is an integer greater than 1, and the respective pixel values of the n pixels are respectively: p1、P2……PnThen, the average value a of the pixel values of the pixels in the data block can be obtained through the following formula (1)N
One technical scheme in the embodiment of the invention has the following beneficial effects:
in the embodiment of the present invention, an image to be processed is divided into at least two smaller data blocks, and then a background removal threshold corresponding to each data block is obtained according to an identification result of each divided data block for performing background removal processing, which is different from the prior art in which a fixed background removal threshold is used to perform background removal processing on an entire image to be processed Problems and, in turn, problems with the loss of portions of content in the image.
EXAMPLE III
Based on the image processing method provided in the first embodiment, the embodiment of the present invention specifically describes an implementation manner of "obtaining the background removal threshold of each data block according to the recognition result of each data block" in S103.
Specifically, in the embodiment of the present invention, the obtaining of the background removal threshold of each data block according to the identification result of each data block may include, but is not limited to, the following four implementation manners:
mode A: if the data block is a background data block, the background removal threshold of the background data block can be obtained by formula (2):
wherein, CNA background removal threshold value of the data block is set, N is the processing sequence number of the data block in at least two data blocks, M is the processing sequence number of the data block in the background data block, CN-1Background removal threshold for a previous block of data, ANThe average value of the pixel values of the pixel points in the data block. (ii) a
If the data block is a content data block, the background removal threshold of the content data block can be obtained by formula (3):
CN=CN-1+O
wherein, CNA background removal threshold for the data block, N a processing order number of the data block in at least two data blocks, CN-1The background removal threshold is the background removal threshold for the previous block of data, and O is the compensation factor.
It should be noted that the compensation coefficient O is an additional value when each content data block is obtained, and if the next data block is a content data block, the additional value is not accumulated when the background removal threshold of the next content data block is obtained, that is, when the background removal threshold of one data block is obtained, only one compensation coefficient O needs to be added, that is, if in the implementation process, C is usedN-1Having included a compensation factor O, the compensation factor O is not increased. Or, if the next data block is the background data block, the compensation coefficient O is not considered when the background removal threshold of the next background data block is obtained.
Specifically, the value of the compensation coefficient O may be preset according to the actually required background removal degree, which is not particularly limited in the embodiment of the present invention. For example, the compensation coefficient O may be a value in the range of [32, 80 ].
Mode B: for each data block, selecting a pixel point from the data block as a candidate pixel point, then obtaining the absolute value of the difference value between the number of pixel points in a first specified range of the candidate pixel point and the number of pixel points in a second specified range of the candidate pixel point in the data block, wherein the first specified range and the second specified range are not overlapped completely, then comparing the obtained absolute value with a preset absolute value threshold, and if the obtained absolute value is less than or equal to the absolute value threshold, determining the pixel value of the candidate pixel point as the background removal threshold of the data block.
It can be understood that, if the obtained absolute value is greater than the absolute value threshold, other pixel points in the data block are reselected as candidate pixel points until a candidate pixel point satisfying the absolute value less than or equal to the absolute value threshold is found, and the pixel value of the candidate pixel point satisfying the condition is used as the background removal threshold of the data block.
In a specific implementation process, the selection of the candidate pixel point may be determined according to actual needs, which is not particularly limited in the embodiment of the present invention.
For example, all pixel points in the data block may be numbered, and the pixel point with the smallest number may be selected as a candidate pixel point; or, the pixel point with the largest number can be selected as a candidate pixel point; alternatively, random selection may be performed among all the pixel points.
Or, for another example, the selection may be performed according to the positions of the pixel points in the data block, and a leftmost pixel point in the data block may be selected as a candidate pixel point; or, the rightmost pixel point in the data block can be selected as a candidate pixel point; alternatively, random selection may be performed among all the pixel points.
Specifically, when other pixel points in the data block are reselected as candidate pixel points, the selection may be performed according to a preset rule, or may be performed randomly. For example, if all the pixels in the data block are numbered, and the number of the selected pixel at this time is X, when the pixel is reselected, a pixel with the number X + Y may be selected as a new candidate pixel, or a pixel with the number X-Y may also be selected as a candidate pixel, where Y is an integer greater than 0.
Mode C: presetting a first background removal threshold, wherein the first background removal threshold is a background removal threshold of a background data block; if the data block is a background data block, taking the first background removal threshold as the background removal threshold of the data block; and/or presetting a second background removal threshold, wherein the second background removal threshold is the background removal threshold of the content data block; and if the data block is a content data block, taking the second background removal threshold as the background removal threshold of the data block.
For example, a fixed background removal threshold a may be preset for a background data block, a background removal threshold b may be preset for a content data block, and then, according to the identification result of the data block, if the data block is the background data block, the background removal threshold of the data block is a; if the data block is a content data block, the background removal threshold of the data block is b.
Mode D: determining a target data block according to the identification result of each data block, wherein all data blocks before the target data block are background data blocks, all data blocks after the target data block are content data blocks, and then obtaining the average value of pixel values of pixel points in each data block before the target data block to be used as the background removal threshold value of each data block in all data blocks before the target data block; and acquiring the average value of the sum of the background removal thresholds of all the background data blocks before the target data block as the background removal threshold of each data block in all the data blocks after the target data block.
For example, if the acquired image to be processed determines that the data block 6 is the target data block according to the recognition result, that is, the data blocks 1 to 5 are all background data blocks, and all data blocks after the data block 6 are content data blocks. The background removal thresholds of the data chunks 1 to 5 are a1, a2, A3, a4 and a5, respectively, and the background removal thresholds of all the data chunks after the data chunk 6 are a
One technical scheme in the embodiment of the invention has the following beneficial effects:
in the embodiment of the present invention, an image to be processed is divided into at least two smaller data blocks, and then a background removal threshold corresponding to each data block is obtained according to an identification result of each divided data block for performing background removal processing, which is different from the prior art in which a fixed background removal threshold is used to perform background removal processing on an entire image to be processed Problems and, in turn, problems with the loss of portions of content in the image.
Example four
Based on the way of identifying each data block provided by the way 1 in the second embodiment of the present invention, the second embodiment of the present invention provides a specific implementation way of identifying each data block according to the way 1 to obtain the identification result of each data block.
Please refer to fig. 2, which is a first flowchart illustrating a process of identifying each data block according to an embodiment of the present invention. As shown in fig. 2, an implementation of identifying each data block to obtain an identification result of each data block may include the following steps:
s201, obtaining an average value of pixel values of pixel points in each data block.
S202, calculating the difference between the pixel value of the pixel point in the data block and the average value of the pixel values of the pixel points in the data block.
S203, judging whether the difference degree is greater than or equal to a preset difference threshold value; if yes, executing S204; if not, go to S205.
S204, adding one to the number of the target pixel points.
S205, the number of target pixel points is not changed.
S206, judging whether the current pixel point is the last pixel point in the data block; if yes, go to S207; if not, go to S202.
And S207, obtaining the number of the target pixel points.
S208, judging whether the number of the target pixel points is less than or equal to a preset difference threshold value; if yes, go to S209; if not, go to S210.
S209, the data block is identified as a background data block.
S210, identifying the data block as a content data block.
Specifically, the above example is only used to illustrate one specific implementation manner of identifying each data block to obtain the identification result of each data block, and is not used to limit the present invention.
One technical scheme in the embodiment of the invention has the following beneficial effects:
in the embodiment of the present invention, an image to be processed is divided into at least two smaller data blocks, and then a background removal threshold corresponding to each data block is obtained according to an identification result of each divided data block for performing background removal processing, which is different from the prior art in which a fixed background removal threshold is used to perform background removal processing on an entire image to be processed Problems and, in turn, problems with the loss of portions of content in the image.
EXAMPLE five
Based on the way of identifying each data block provided by the way 2 in the second embodiment of the present invention, the second embodiment of the present invention provides a specific implementation way of identifying each data block according to the way 2 to obtain the identification result of each data block.
Please refer to fig. 3, which is a second flowchart illustrating the identification of each data block according to an embodiment of the present invention. As shown in fig. 3, an implementation of identifying each data block to obtain an identification result of each data block may include the following steps:
s301, obtaining the average value of the pixel values of the pixel points in each data block.
S302, calculating the variance of the pixel values of the data block according to the pixel values of the pixels in the data block and the average value of the pixel values of the pixels in the data block.
In a specific implementation, a data block in an image to be processed is taken as an example for illustration, and the processing sequence number of the data block in at least two data blocks is N, QNIs the variance of the pixel values of the pixels of the data block, ANThe average value of the pixel values of the pixels in the data block is obtained, the data block comprises n pixels, n is an integer greater than 1, and the respective pixel values of the n pixels are respectively: p1、P2……PnThen the variance of the pixel values of the data block can be calculated by equation (4):
s303, judging whether the variance of the pixel value is greater than or equal to a preset variance threshold value; if yes, go to step S304; if not, go to S305.
S304, the data block is identified as the content data block.
S305, the data block is identified as a background data block.
Specifically, the above example is only used to illustrate one specific implementation manner of identifying each data block to obtain the identification result of each data block, and is not used to limit the present invention.
One technical scheme in the embodiment of the invention has the following beneficial effects:
in the embodiment of the present invention, an image to be processed is divided into at least two smaller data blocks, and then a background removal threshold corresponding to each data block is obtained according to an identification result of each divided data block for performing background removal processing, which is different from the prior art in which a fixed background removal threshold is used to perform background removal processing on an entire image to be processed Problems and, in turn, problems with the loss of portions of content in the image.
EXAMPLE six
Based on the method for obtaining the background removal threshold of each data block provided by the method B in the third embodiment of the present invention, the embodiment of the present invention provides a specific implementation manner for obtaining the background removal threshold of each data block according to the method B.
Please refer to fig. 4, which is a flowchart illustrating a process of obtaining a background removal threshold for each data block according to an embodiment of the present invention. As shown in fig. 4, an implementation of obtaining the background removal threshold for each data block may include:
s401, selecting a non-repeated pixel point from each data block as a candidate pixel point.
S402, obtaining the absolute value of the difference value between the number of the pixel points in the first specified range of the candidate pixel points and the number of the pixel points in the second specified range of the candidate pixel points in each data block.
Specifically, in the embodiment of the present invention, the first designated range and the second designated range are not overlapped completely.
S403, judging whether the obtained absolute value is less than or equal to a preset absolute value threshold; if yes, go to S404; if not, S401 is executed.
S404, determining the pixel value of the candidate pixel point as the background removal threshold value of the data block.
One technical scheme in the embodiment of the invention has the following beneficial effects:
in the embodiment of the present invention, an image to be processed is divided into at least two smaller data blocks, and then a background removal threshold corresponding to each data block is obtained according to an identification result of each divided data block for performing background removal processing, which is different from the prior art in which a fixed background removal threshold is used to perform background removal processing on an entire image to be processed Problems and, in turn, problems with the loss of portions of content in the image.
EXAMPLE seven
Based on the manner of obtaining the background removal threshold of each data block provided by the manner a in the third embodiment of the present invention, the embodiment of the present invention provides a specific implementation manner of obtaining the background removal threshold of each data block according to the manner a.
Please refer to fig. 5, which is a diagram illustrating the recognition result of a page of image to be processed. The background removal threshold value for each data block is determined in the manner a.
As shown in fig. 5, the image to be processed is divided into a plurality of data blocks, and the direction of the arrow in fig. 5 indicates the processing order of the data blocks, so that the processing order number of each data block in at least two data blocks can be determined in the direction indicated by the arrow.
The following specifically describes a process of obtaining the background removal threshold for each data block in the manner a, taking the recognition result of the image to be processed shown in fig. 5 as an example. For convenience of description, the image to be processed is numbered according to the processing sequence from top to bottom, the top data block is data block 1, then data block 2, and then data block 3 … …
As shown in fig. 5, the data block 1 is a background data block, and the background removal threshold for obtaining the data block 1 can be calculated according to formula (2), where N is 1, M is 1, and the background removal threshold for the data block 1 is C1,C1=A1Wherein A is1Is the average of the pixel values of the pixels in block 1.
As shown in fig. 5, the data block 2 is a background data block, and the background removal threshold for obtaining the data block 2 can be calculated according to formula (2), where N is 2, M is 2, and the background removal threshold for the data block 2 is C2A1Is the average value of pixel values of the pixels in the data block 1, A2Is the average of the pixel values of the pixels in the data block 2.
As shown in fig. 5, the data block 3 is a background data block, and the background removal threshold for obtaining the data block 3 can be calculated according to formula (2), where N is 3, M is 3, and the background removal threshold for the data block 3 is C3Wherein A is1Is the average value of pixel values of the pixels in the data block 1, A2Is the average value of the pixel values of the pixels in the data block 2, A3Is the average of the pixel values of the pixels in the data block 3.
As shown in fig. 5, the data block 4 is a content data block, and the background removal threshold for obtaining the data block 4 can be calculated according to formula (3), where N is 4, and the background removal threshold for the data block 4 is C4Wherein A is1Is the average value of pixel values of the pixels in the data block 1, A2Is the average value of the pixel values of the pixels in the data block 2, A3Is the average value of the pixel values of the pixel points in the data block 3, and O is the compensation coefficient.
As shown in fig. 5, the data block 5 is a content data block, and the background removal threshold for obtaining the data block 5 can be calculated according to formula (3), where N is 5, and C is5=C4+ O, then, C4Already contains a compensation coefficient O, so that at this time, a compensation coefficient O is not added any more, and thereforeObtained byWherein A is1Is the average value of pixel values of the pixels in the data block 1, A2Is the average value of the pixel values of the pixels in the data block 2, A3Is the average value of the pixel values of the pixel points in the data block 3, and O is the compensation coefficient.
As shown in fig. 5, the data block 6 is a background data block, and the background removal threshold for obtaining the data block 6 can be calculated according to formula (2), where N is 6, M is 4, and the background removal threshold for the data block 6 is C6Wherein A is1Is the average value of pixel values of the pixels in the data block 1, A2Is the average value of the pixel values of the pixels in the data block 2, A3Is the average value, A, of the pixel values of the pixels in the data block 36Is the average of the pixel values of the pixels in the data block 6.
As shown in fig. 5, in the to-be-processed image, the manner of obtaining the background removal threshold of the other unprocessed data blocks is consistent with the implementation manner of obtaining the background removal thresholds of the data blocks 1 to 6, which is not described in detail in the embodiment of the present invention.
It is to be understood that the above example is only used to illustrate how to perform the obtaining process of the background removal threshold value of each data block according to the manner a provided by S103 in the first embodiment, and is not used to limit the present invention.
One technical scheme in the embodiment of the invention has the following beneficial effects:
in the embodiment of the present invention, an image to be processed is divided into at least two smaller data blocks, and then a background removal threshold corresponding to each data block is obtained according to an identification result of each divided data block for performing background removal processing, which is different from the prior art in which a fixed background removal threshold is used to perform background removal processing on an entire image to be processed Problems and, in turn, problems with the loss of portions of content in the image.
Example eight
Based on the manner of obtaining the background removal threshold of each data block provided by the manner D in the third embodiment of the present invention, the embodiment of the present invention provides a specific implementation manner of obtaining the background removal threshold of each data block according to the manner D.
Please refer to fig. 6, which is a diagram illustrating the recognition result of another page of the to-be-processed image. The arrow direction in fig. 6 indicates the processing order of the data blocks, and thus, the processing order number of each data block in at least two data blocks can be determined in the direction indicated by the arrow. For convenience of description, the image to be processed is numbered according to the processing sequence from top to bottom, the top data block is data block 1, then data block 2, and then data block 3 … …
As shown in fig. 6, according to the identification result of each data block, it can be determined that the data block 4 is the target data block, that is, the data block 1, the data block 2, and the data block 3 before the data block 4 are all background data blocks, and all the data blocks after the data block 4 are content data blocks.
As shown in fig. 6, if data block 1, data block 2, and data block 3 are background data blocks, the background removal threshold C of data block 1 is set1Is the image of a pixel point in a data block 1Average of the elemental values A1I.e. C1=A1Background removal threshold C for block 22Is the average value A of pixel values of pixel points in the data block 22I.e. C2=A2Background removal threshold C for block 33Is the average value A of the pixel values of the pixels in the data block 33I.e. C3=A3
As shown in fig. 6, all data blocks from data block 4 onward are content data blocks. The background removal threshold of data block 4 is the average of the sum of the background removal thresholds of all background data blocks before data block 4, i.e. the background removal threshold of data block 4 is the average of the sum of the background removal threshold of data block 1, the background removal threshold of data block 2 and the background removal threshold of data block 3, i.e.,
specifically, the background removal threshold of the data block 5 is an average of the sum of background removal thresholds of all background data blocks before the data block 5, that is, the background removal threshold of the data block 5 is an average of the sum of the background removal threshold of the data block 1, the background removal threshold of the data block 2, and the background removal threshold of the data block 3, that is,
that is, the background removal threshold of all data blocks after the data block 4 is an average of the sum of the background removal threshold of the data block 1, the background removal threshold of the data block 2, and the background removal threshold of the data block 3, that is, the background removal threshold of each data block in all data blocks after the target data block is an average of the sum of the background removal thresholds of all background data blocks before the target data block.
One technical scheme in the embodiment of the invention has the following beneficial effects:
in the embodiment of the present invention, an image to be processed is divided into at least two smaller data blocks, and then a background removal threshold corresponding to each data block is obtained according to an identification result of each divided data block for performing background removal processing, which is different from the prior art in which a fixed background removal threshold is used to perform background removal processing on an entire image to be processed Problems and, in turn, problems with the loss of portions of content in the image.
Example nine
Based on the image processing method provided in the first embodiment, the embodiment of the present invention specifically describes an implementation manner of "performing background removal processing on each data block according to the background removal threshold of each data block" in S104.
Specifically, in the implementation of the present invention, after the background removal threshold of each data block is obtained, the background removal processing is performed on the data block by using the respective background removal threshold of each data block, so as to implement the background removal processing on the entire image to be processed.
It should be noted that, in the embodiment of the present invention, after the background removal threshold of one data block is obtained, the background removal processing is immediately performed on the data block; or, after obtaining the background removal threshold of each data block in all data blocks of the entire image to be processed, the obtained background removal threshold may be used to perform the background removal processing on each data block in the entire image to be processed. The embodiment of the present invention is not particularly limited to this.
In a specific implementation process, the background removal processing is performed on each data block according to the background removal threshold of each data block, which may include, but is not limited to, the following two ways:
firstly, according to the pixel value of the pixel point in each data block and the background removal threshold value of each data block, the pixel point of which the pixel value is greater than the background removal threshold value of the data block in the data block is determined to be used as a first appointed pixel point in each data block, and the pixel value of the first appointed pixel point in each data block is adjusted to be the maximum pixel value.
It can be understood that the maximum pixel value of a pixel is related to the number of binary bits of the pixel, and if i binary bits are used to represent a pixel value, the maximum pixel value of the pixel is 2i-1。
In a specific implementation process, if a pixel adopts 8 binary bits to represent a pixel value, the maximum pixel value of the pixel is 255, and the pixel value of the pixel whose pixel value is greater than the background removal threshold of the data block may be adjusted to 255.
And secondly, determining pixel points of which the pixel values are smaller than or equal to the background removal threshold value of the data block in the data block according to the pixel values of the pixel points in each data block and the background removal threshold value of each data block to serve as second designated pixel points in each data block, and keeping the pixel values of the second designated pixel points in each data block unchanged.
It can be understood that, in the embodiment of the present invention, the background removal processing is performed on each data block according to the background removal threshold of each data block, that is, the background removal processing is performed on all the data blocks after the whole image to be processed is divided.
In a specific implementation process, after performing background removal processing on each data block, whether other unprocessed data blocks exist in the image to be processed may be detected, which is not particularly limited in the embodiment of the present invention.
For example, it may be detected whether the processing sequence number of the data block is equal to the number of the data blocks in the entire image to be processed, and if the processing sequence number of the data block is smaller than the number of the data blocks in the entire image to be processed, it is determined that other unprocessed data blocks exist in the image to be processed, the background removal processing on the entire image to be processed is not completed, and the background removal processing on the unprocessed data blocks is continued; and if the processing sequence number of the data blocks is equal to the number of the data blocks in the whole image to be processed, determining that no other unprocessed data blocks exist in the image to be processed, and finishing the background removal processing of the whole image to be processed.
One technical scheme in the embodiment of the invention has the following beneficial effects:
in the embodiment of the present invention, an image to be processed is divided into at least two smaller data blocks, and then a background removal threshold corresponding to each data block is obtained according to an identification result of each divided data block for performing background removal processing, which is different from the prior art in which a fixed background removal threshold is used to perform background removal processing on an entire image to be processed Problems and, in turn, problems with the loss of portions of content in the image.
Example ten
Based on the two implementation manners of the background removal processing on each data block provided by the ninth embodiment of the present invention, the embodiment of the present invention provides a specific implementation method of the background removal processing on each data block.
Referring to fig. 7, which is a schematic diagram illustrating background removal processing on each data block in the embodiment of the present invention, for each data block of an image to be processed, the background removal processing may be performed according to the method shown in fig. 7. As shown in fig. 7, the method includes:
s701, judging whether the pixel value of a pixel point in a data block is larger than a background removal threshold of the data block; if yes, go to S702; if not, go to S703.
S702, adjusting the pixel value of the pixel point to be the maximum pixel value.
And S703, keeping the pixel value of the pixel unchanged.
It is understood that the pixel value of the pixel point is kept unchanged, i.e., no other processing is performed.
One technical scheme in the embodiment of the invention has the following beneficial effects:
in the embodiment of the present invention, an image to be processed is divided into at least two smaller data blocks, and then a background removal threshold corresponding to each data block is obtained according to an identification result of each divided data block for performing background removal processing, which is different from the prior art in which a fixed background removal threshold is used to perform background removal processing on an entire image to be processed Problems and, in turn, problems with the loss of portions of content in the image.
EXAMPLE eleven
Based on the way of obtaining the background removal threshold of each data block provided by the way a in the third embodiment of the present invention, the embodiment of the present invention provides a specific implementation method of image processing.
Please refer to fig. 8, which is a flowchart illustrating an image processing method according to a second embodiment of the present invention. As shown in fig. 8, the method includes:
s801, dividing the image to be processed into at least two data blocks.
S802, judging whether each data block is a background data block; if yes, go to S803; if not, go to S804.
S803, the background removal threshold of the data block is calculated according to formula 2.
Specifically, formula 2 is:
wherein, CNA background removal threshold value for the data block, N is the processing sequence number of the data block in at least two data blocks, M is the processing sequence number of the data block in the background data block, CM-1Background removal threshold, A, for a background data block preceding the data blockNIs the average value of pixel values of pixel points in the data block
S804, calculate the background removal threshold of the data block according to formula 3.
Specifically, formula 3 is: cN=CN-1+O。
Wherein, CNA background removal threshold for the data block, N being at least two for the data blockNumber of processing times in individual data block, CN-1The background removal threshold for the previous block of the data block, and O is a compensation factor.
S805, performing background removal processing on each data block according to the background removal threshold of each data block.
S806, judging whether other unprocessed data blocks exist in the image to be processed; if yes, go to S802; if not, the flow is ended.
One technical scheme in the embodiment of the invention has the following beneficial effects:
in the embodiment of the present invention, an image to be processed is divided into at least two smaller data blocks, and then a background removal threshold corresponding to each data block is obtained according to an identification result of each divided data block for performing background removal processing, which is different from the prior art in which a fixed background removal threshold is used to perform background removal processing on an entire image to be processed Problems and, in turn, problems with the loss of portions of content in the image.
Example twelve
Based on the image processing method provided by the first embodiment, the embodiment of the present invention further provides an embodiment of an apparatus for implementing each step and method in the above method embodiment.
Please refer to fig. 9, which is a functional block diagram of an image processing apparatus according to an embodiment of the present invention. As shown in fig. 9, the apparatus includes:
a dividing unit 901, configured to divide an image to be processed into at least two data blocks;
an identifying unit 902, configured to identify each data block to obtain an identification result of each data block, where the identification result of each data block includes that the data block is a content data block or that the data block is a background data block;
an obtaining unit 903, configured to obtain a background removal threshold of each data block according to the identification result of each data block;
a processing unit 904, configured to perform background removal processing on each data block according to the background removal threshold of each data block.
Specifically, in the embodiment of the present invention, the identifying unit 902 is specifically configured to:
acquiring an average value of pixel values of pixel points in each data block;
obtaining the number of target pixel points in each data block according to the pixel value of the pixel point in each data block and the average value of the pixel values of the pixel points in each data block, wherein the target pixel points are pixel points of which the difference degree between the pixel value in the data block and the average value of the pixel values of the pixel points in the data block is greater than or equal to a preset difference threshold;
comparing the number of target pixel points in each data block with a preset number threshold value respectively;
data blocks having a number of target pixel points less than or equal to a number threshold are identified as background data blocks, or data blocks having a number of target pixel points greater than a number threshold are identified as content data blocks.
Specifically, in the embodiment of the present invention, the identifying unit 902 is specifically configured to:
acquiring an average value of pixel values of pixel points in each data block;
obtaining the variance of the pixel value of each data block according to the pixel value of the pixel point in each data block and the average value of the pixel values of the pixel points in each data block;
comparing the variance of the pixel value of each data block with a preset variance threshold value respectively;
data blocks having a variance of pixel values greater than or equal to a variance threshold are identified as content data blocks, or data blocks having a variance of pixel values less than a variance threshold are identified as background data blocks.
Specifically, in this embodiment of the present invention, the obtaining unit 903 is specifically configured to:
if the data block is a background data block, obtaining a background removal threshold value of the data block by the following formula:
wherein, CNA background removal threshold value for the data block, N is the processing sequence number of the data block in at least two data blocks, M is the processing sequence number of the data block in the background data block, CM-1Background removal threshold, A, for a background data block preceding the data blockNThe average value of the pixel values of the pixel points in the data block is obtained;
if the data block is a content data block, obtaining the background removal threshold value of the data block by the following formula:
CN=CN-1+O
wherein, CNA background removal threshold for the data block, N is a processing order number of the data block in at least two data blocks, CN-1The background removal threshold for the previous block of the data block, and O is a compensation factor.
Specifically, in this embodiment of the present invention, the obtaining unit 903 is specifically configured to:
for each data block, selecting a pixel point from the data block as a candidate pixel point;
obtaining the absolute value of the difference value between the number of pixel points in a first specified range of candidate pixel points and the number of pixel points in a second specified range of the candidate pixel points in the data block, wherein the first specified range and the second specified range are not overlapped completely;
comparing the absolute value with a preset absolute value threshold;
and if the absolute value is less than or equal to the absolute value threshold, determining the pixel value of the candidate pixel point as the background removal threshold of the data block.
Specifically, in this embodiment of the present invention, the obtaining unit 903 is specifically configured to:
presetting a first background removal threshold, wherein the first background removal threshold is a background removal threshold of a background data block; if the data block is a background data block, taking the first background removal threshold as the background removal threshold of the data block; and/or the presence of a gas in the gas,
presetting a second background removal threshold, wherein the second background removal threshold is a background removal threshold of the content data block; and if the data block is a content data block, taking the second background removal threshold as the background removal threshold of the data block.
In a specific implementation process, the obtaining unit 903 is specifically configured to:
determining a target data block according to the identification result of each data block, wherein all data blocks before the target data block are background data blocks, and all data blocks after the target data block are content data blocks;
acquiring an average value of pixel values of pixel points in each data block before a target data block, and taking the average value as a background removal threshold value of each data block in all data blocks before the target data block; and acquiring the average value of the sum of the background removal thresholds of all the background data blocks before the target data block as the background removal threshold of each unprocessed data block in all the data blocks after the target data block.
Specifically, in this embodiment of the present invention, the processing unit 904 is configured to:
determining a pixel point of which the pixel value in the data block is greater than the background removal threshold of the data block according to the pixel value of the pixel point in each data block and the background removal threshold of each data block, and taking the pixel point as a first designated pixel point in each data block; adjusting the pixel value of a first designated pixel point in each data block to be the maximum pixel value; or,
determining a pixel point of which the pixel value in the data block is smaller than or equal to the background removal threshold of the data block according to the pixel value of the pixel point in each data block and the background removal threshold of each data block, and taking the pixel point as a second designated pixel point in each data block; the pixel values of the second designated pixel points in each data block are kept unchanged.
Since each unit in the present embodiment can execute the method shown in fig. 1, reference may be made to the related description of fig. 1 for a part of the present embodiment that is not described in detail.
One technical scheme in the embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, an image to be processed is divided into at least two data blocks by a dividing unit in an image processing device, then, an identification unit in the image processing device identifies each data block to obtain an identification result of each data block, the identification result of each data block comprises that the data block is a content data block or that the data block is a background data block, so that an acquisition unit in the image processing device obtains a background removal threshold of each data block according to the identification result of each data block, and further, a processing unit in the image processing device performs background removal processing on each data block according to the background removal threshold of each data block. In the embodiment of the present invention, an image to be processed is divided into at least two smaller data blocks, and then a background removal threshold corresponding to each data block is obtained according to an identification result of each divided data block for performing background removal processing, which is different from the prior art in which a fixed background removal threshold is used to perform background removal processing on an entire image to be processed Problems and, in turn, problems with the loss of portions of content in the image.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions in actual implementation, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a Processor (Processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (12)

1. An image processing method, characterized in that the method comprises:
dividing an image to be processed into at least two data blocks;
identifying each data block to obtain an identification result of each data block, wherein the identification result of each data block comprises that the data block is a content data block or a background data block;
obtaining a background removal threshold value of each data block according to the identification result of each data block;
performing background removal processing on each data block according to the background removal threshold value of each data block;
obtaining a background removal threshold value of each data block according to the identification result of each data block, including:
if the data block is a background data block, obtaining a background removal threshold value of the data block by the following formula:
wherein, CNA background removal threshold value of the data block is obtained, N is the processing sequence number of the data block in the at least two data blocks, M is the processing sequence number of the data block in the background data block, CM-1A background removal threshold, A, for a background data block preceding said data blockNThe average value of the pixel values of the pixel points in the data block is obtained;
if the data block is a content data block, obtaining a background removal threshold value of the data block by the following formula:
CN=CN-1+O
wherein, CNRemoving a threshold value for the background of the data block, N being the processing order number of the data block in the at least two data blocks, CN-1A background removal threshold for a previous one of the data blocks, and O is a compensation coefficient.
2. An image processing method, characterized in that the method comprises:
dividing an image to be processed into at least two data blocks;
identifying each data block to obtain an identification result of each data block, wherein the identification result of each data block comprises that the data block is a content data block or a background data block;
obtaining a background removal threshold value of each data block according to the identification result of each data block;
performing background removal processing on each data block according to the background removal threshold value of each data block;
obtaining a background removal threshold value of each data block according to the identification result of each data block, including:
for each data block, selecting a pixel point from the data block as a candidate pixel point;
obtaining an absolute value of a difference between the number of pixel points in a first specified range of the candidate pixel points and the number of pixel points in a second specified range of the candidate pixel points in the data block, wherein the first specified range and the second specified range are not overlapped completely;
comparing the absolute value with a preset absolute value threshold;
and if the absolute value is smaller than or equal to the absolute value threshold, determining the pixel value of the candidate pixel point as a background removal threshold of the data block.
3. An image processing method, characterized in that the method comprises:
dividing an image to be processed into at least two data blocks;
identifying each data block to obtain an identification result of each data block, wherein the identification result of each data block comprises that the data block is a content data block or a background data block;
obtaining a background removal threshold value of each data block according to the identification result of each data block;
performing background removal processing on each data block according to the background removal threshold value of each data block;
obtaining a background removal threshold value of each data block according to the identification result of each data block, including:
determining a target data block according to the identification result of each data block, wherein all data blocks before the target data block are background data blocks, and all data blocks after the target data block are content data blocks;
acquiring an average value of pixel values of pixel points in each data block before the target data block, wherein the average value is used as a background removal threshold value of each data block in all data blocks before the target data block; and acquiring an average value of the sum of background removal thresholds of all background data blocks before the target data block, wherein the average value is used as the background removal threshold of each data block in all data blocks after the target data block.
4. The method according to any one of claims 1 to 3, wherein identifying each of the data blocks to obtain an identification result of each of the data blocks comprises:
acquiring an average value of pixel values of pixel points in each data block;
obtaining the number of target pixel points in each data block according to the pixel value of the pixel point in each data block and the average value of the pixel values of the pixel points in each data block, wherein the target pixel points are pixel points of which the difference degree between the pixel values in the data block and the average value of the pixel values of the pixel points in the data block is greater than or equal to a preset difference threshold value;
comparing the number of target pixel points in each data block with a preset number threshold value respectively;
identifying data blocks with the number of target pixel points being less than or equal to the number threshold as background data blocks, or identifying data blocks with the number of target pixel points being greater than the number threshold as content data blocks.
5. The method according to any one of claims 1 to 3, wherein identifying each of the data blocks to obtain an identification result of each of the data blocks comprises:
acquiring an average value of pixel values of pixel points in each data block;
obtaining the variance of the pixel value of each data block according to the pixel value of the pixel point in each data block and the average value of the pixel values of the pixel points in each data block;
comparing the variance of the pixel value of each data block with a preset variance threshold value;
and identifying a data block of which the variance of the pixel values is greater than or equal to the variance threshold as a content data block, or identifying a data block of which the variance of the pixel values is less than the variance threshold as a background data block.
6. The method according to any one of claims 1 to 3, wherein performing the background removal processing on each of the data blocks according to the background removal threshold of each of the data blocks comprises:
determining a pixel point of which the pixel value in the data block is greater than the background removal threshold of the data block according to the pixel value of the pixel point in each data block and the background removal threshold of each data block, and using the pixel point as a first designated pixel point in each data block; adjusting the pixel value of a first designated pixel point in each data block to be a maximum pixel value; or,
determining pixel points of which the pixel values are smaller than or equal to the background removal threshold value of each data block in the data blocks according to the pixel values of the pixel points in each data block and the background removal threshold value of each data block, and using the pixel points as second designated pixel points in each data block; the pixel values of the second designated pixel points in each of said data blocks are kept unchanged.
7. An image processing apparatus, characterized in that the apparatus comprises:
the dividing unit is used for dividing the image to be processed into at least two data blocks;
the identification unit is used for identifying each data block to obtain an identification result of each data block, wherein the identification result of each data block comprises that the data block is a content data block or a background data block;
the acquisition unit is used for acquiring a background removal threshold of each data block according to the identification result of each data block;
the processing unit is used for carrying out background removal processing on each data block according to the background removal threshold value of each data block;
the obtaining unit is specifically configured to:
if the data block is a background data block, obtaining a background removal threshold value of the data block by the following formula:
wherein, CNA background removal threshold value of the data block is obtained, N is the processing sequence number of the data block in the at least two data blocks, M is the processing sequence number of the data block in the background data block, CM-1A background removal threshold, A, for a background data block preceding said data blockNThe average value of the pixel values of the pixel points in the data block is obtained;
if the data block is a content data block, obtaining a background removal threshold value of the data block by the following formula:
CN=CN-1+O
wherein, CNRemoving a threshold value for the background of the data block, N being the processing order number of the data block in the at least two data blocks, CN-1A background removal threshold for a previous one of the data blocks, and O is a compensation coefficient.
8. An image processing apparatus, characterized in that the apparatus comprises:
the dividing unit is used for dividing the image to be processed into at least two data blocks;
the identification unit is used for identifying each data block to obtain an identification result of each data block, wherein the identification result of each data block comprises that the data block is a content data block or a background data block;
the acquisition unit is used for acquiring a background removal threshold of each data block according to the identification result of each data block;
the processing unit is used for carrying out background removal processing on each data block according to the background removal threshold value of each data block;
the obtaining unit is specifically configured to:
for each data block, selecting a pixel point from the data block as a candidate pixel point;
obtaining an absolute value of a difference between the number of pixel points in a first specified range of the candidate pixel points and the number of pixel points in a second specified range of the candidate pixel points in the data block, wherein the first specified range and the second specified range are not overlapped completely;
comparing the absolute value with a preset absolute value threshold;
and if the absolute value is smaller than or equal to the absolute value threshold, determining the pixel value of the candidate pixel point as a background removal threshold of the data block.
9. An image processing apparatus, characterized in that the apparatus comprises:
the dividing unit is used for dividing the image to be processed into at least two data blocks;
the identification unit is used for identifying each data block to obtain an identification result of each data block, wherein the identification result of each data block comprises that the data block is a content data block or a background data block;
the acquisition unit is used for acquiring a background removal threshold of each data block according to the identification result of each data block;
the processing unit is used for carrying out background removal processing on each data block according to the background removal threshold value of each data block;
the obtaining unit is specifically configured to:
determining a target data block according to the identification result of each data block, wherein all data blocks before the target data block are background data blocks, and all data blocks after the target data block are content data blocks;
acquiring an average value of pixel values of pixel points in each data block before the target data block, wherein the average value is used as a background removal threshold value of each data block in all data blocks before the target data block; and acquiring an average value of the sum of background removal thresholds of all background data blocks before the target data block, wherein the average value is used as the background removal threshold of each data block in all data blocks after the target data block.
10. The apparatus according to any one of claims 7 to 9, wherein the identification unit is specifically configured to:
acquiring an average value of pixel values of pixel points in each data block;
obtaining the number of target pixel points in each data block according to the pixel value of the pixel point in each data block and the average value of the pixel values of the pixel points in each data block, wherein the target pixel points are pixel points of which the difference degree between the pixel values in the data block and the average value of the pixel values of the pixel points in the data block is greater than or equal to a preset difference threshold value;
comparing the number of target pixel points in each data block with a preset number threshold value respectively;
identifying data blocks with the number of target pixel points being less than or equal to the number threshold as background data blocks, or identifying data blocks with the number of target pixel points being greater than the number threshold as content data blocks.
11. The apparatus according to any one of claims 7 to 9, wherein the identification unit is specifically configured to:
acquiring an average value of pixel values of pixel points in each data block;
obtaining the variance of the pixel value of each data block according to the pixel value of the pixel point in each data block and the average value of the pixel values of the pixel points in each data block;
comparing the variance of the pixel value of each data block with a preset variance threshold value;
and identifying a data block of which the variance of the pixel values is greater than or equal to the variance threshold as a content data block, or identifying a data block of which the variance of the pixel values is less than the variance threshold as a background data block.
12. The apparatus according to any one of claims 7 to 9, wherein the processing unit is specifically configured to:
determining a pixel point of which the pixel value in the data block is greater than the background removal threshold of the data block according to the pixel value of the pixel point in each data block and the background removal threshold of each data block, and using the pixel point as a first designated pixel point in each data block; adjusting the pixel value of a first designated pixel point in each data block to be a maximum pixel value; or,
determining pixel points of which the pixel values are smaller than or equal to the background removal threshold value of each data block in the data blocks according to the pixel values of the pixel points in each data block and the background removal threshold value of each data block, and using the pixel points as second designated pixel points in each data block; the pixel values of the second designated pixel points in each of said data blocks are kept unchanged.
CN201610643274.1A 2016-08-08 2016-08-08 A kind of image processing method and device Active CN106251358B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201610643274.1A CN106251358B (en) 2016-08-08 2016-08-08 A kind of image processing method and device
PCT/CN2017/080898 WO2018028234A1 (en) 2016-08-08 2017-04-18 Image processing method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610643274.1A CN106251358B (en) 2016-08-08 2016-08-08 A kind of image processing method and device

Publications (2)

Publication Number Publication Date
CN106251358A CN106251358A (en) 2016-12-21
CN106251358B true CN106251358B (en) 2019-05-07

Family

ID=58078763

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610643274.1A Active CN106251358B (en) 2016-08-08 2016-08-08 A kind of image processing method and device

Country Status (2)

Country Link
CN (1) CN106251358B (en)
WO (1) WO2018028234A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106251358B (en) * 2016-08-08 2019-05-07 珠海赛纳打印科技股份有限公司 A kind of image processing method and device
CN109785562B (en) * 2018-12-29 2023-08-15 华中光电技术研究所(中国船舶重工集团有限公司第七一七研究所) Vertical photoelectric ground threat alert system and suspicious target identification method
CN110175995B (en) * 2019-05-29 2021-04-30 腾讯科技(深圳)有限公司 Pathological image-based image state determination method, device and system
CN114267149B (en) * 2021-12-30 2024-09-06 浙江顶视智能科技有限公司 Early fire detection and early warning method and system
CN117671497B (en) * 2023-12-04 2024-05-28 广东筠诚建筑科技有限公司 Engineering construction waste classification method and device based on digital images

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7986831B2 (en) * 2006-08-29 2011-07-26 Sony Corporation Image processing apparatus, image processing method and computer program
CN102982545A (en) * 2012-11-22 2013-03-20 清华大学深圳研究生院 Image depth estimation method
CN103235948A (en) * 2013-04-22 2013-08-07 中山大学 Adaptive threshold binarization method for two-dimensional barcode
CN104504686A (en) * 2014-12-04 2015-04-08 哈尔滨工程大学 Hyper-spectral image abnormity detection method adopting local self-adaptive threshold segmentation
CN104657969A (en) * 2013-11-25 2015-05-27 方正国际软件(北京)有限公司 Method and system for removing image background
CN104917975A (en) * 2015-06-01 2015-09-16 北京空间机电研究所 Adaptive automatic exposure method based on object characteristics

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1806697B1 (en) * 2006-01-10 2016-08-10 Microsoft Technology Licensing, LLC Segmenting image elements
JP4808267B2 (en) * 2009-05-27 2011-11-02 シャープ株式会社 Image processing apparatus, image forming apparatus, image processing method, computer program, and recording medium
CN106251358B (en) * 2016-08-08 2019-05-07 珠海赛纳打印科技股份有限公司 A kind of image processing method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7986831B2 (en) * 2006-08-29 2011-07-26 Sony Corporation Image processing apparatus, image processing method and computer program
CN102982545A (en) * 2012-11-22 2013-03-20 清华大学深圳研究生院 Image depth estimation method
CN103235948A (en) * 2013-04-22 2013-08-07 中山大学 Adaptive threshold binarization method for two-dimensional barcode
CN104657969A (en) * 2013-11-25 2015-05-27 方正国际软件(北京)有限公司 Method and system for removing image background
CN104504686A (en) * 2014-12-04 2015-04-08 哈尔滨工程大学 Hyper-spectral image abnormity detection method adopting local self-adaptive threshold segmentation
CN104917975A (en) * 2015-06-01 2015-09-16 北京空间机电研究所 Adaptive automatic exposure method based on object characteristics

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"Anomaly detection using an adaptive algorithm for cstimating mixtures of background in hyperspectral images";Ariel orfaig等;《2012 IEEE 27th convention of Electrical and Electronics Engineers in Isracl》;20121117;第1-5页
"基于改进自动语义标注的图像识别方法";陆伟艳;《科技通报》;20130228;第29卷(第2期);第76-78页

Also Published As

Publication number Publication date
CN106251358A (en) 2016-12-21
WO2018028234A1 (en) 2018-02-15

Similar Documents

Publication Publication Date Title
CN106251358B (en) A kind of image processing method and device
US8064721B2 (en) Method and apparatus for removing noise from a digital image
US8326078B2 (en) System and method for removing artifacts from a digitized document
CN106991422B (en) Character cutting method and device, computer readable storage medium and electronic equipment
JP5312111B2 (en) Image reading method and image reading apparatus
JP5984880B2 (en) Image processing device
JP4502001B2 (en) Image processing apparatus and image processing method
JP2007279825A (en) Image processing apparatus, image processing method, and program
JP2016184914A (en) Image processing apparatus
JP5821994B2 (en) Image processing apparatus, image forming apparatus, and program
CN109643451B (en) Line detection method
JP5453215B2 (en) Image processing apparatus, image forming apparatus, and image processing method
JP2020198085A (en) Image processing apparatus, image processing program, and image processing method
JP3478781B2 (en) Image processing apparatus, image processing method, and storage medium
JP4967488B2 (en) Code image processing method, code image processing apparatus, and code image processing program
CN111127288A (en) Reversible image watermarking method and device and computer readable storage medium
JP4007134B2 (en) Image processing device
JP7377435B2 (en) Image processing device
KR100260923B1 (en) Apparatus and method for local binarization on images
JP5482945B1 (en) Image processing apparatus and program
JP5915411B2 (en) Image processing apparatus and program
JP2008219086A (en) Information embedding device, information extraction device and information embedding system
JP3783005B2 (en) Image processing device
JP2007328652A (en) Image processing device and image processing program
JP6520853B2 (en) Image processing apparatus and image processing method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20201125

Address after: 519060 A, building 3, building 01, 3883 Zhuhai Avenue, Zhuhai, Guangdong, China

Patentee after: ZHUHAI PANTUM ELECTRONICS Co.,Ltd.

Address before: 519060 Area A, 7th Floor, Building 01, No. 3883, Zhuhai Avenue, Xiangzhou District, Zhuhai City, Guangdong Province

Patentee before: Zhuhai Saine Printing Technology Co.,Ltd.

TR01 Transfer of patent right