CN112825142A - Bill detection method, device, terminal and storage medium - Google Patents

Bill detection method, device, terminal and storage medium Download PDF

Info

Publication number
CN112825142A
CN112825142A CN201911140080.XA CN201911140080A CN112825142A CN 112825142 A CN112825142 A CN 112825142A CN 201911140080 A CN201911140080 A CN 201911140080A CN 112825142 A CN112825142 A CN 112825142A
Authority
CN
China
Prior art keywords
gray
value
bill
gray level
threshold value
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.)
Pending
Application number
CN201911140080.XA
Other languages
Chinese (zh)
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.)
Shenzhen Yihua Computer Co Ltd
Shenzhen Yihua Time Technology Co Ltd
Shenzhen Yihua Financial Intelligent Research Institute
Original Assignee
Shenzhen Yihua Computer Co Ltd
Shenzhen Yihua Time Technology Co Ltd
Shenzhen Yihua Financial Intelligent Research Institute
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 Shenzhen Yihua Computer Co Ltd, Shenzhen Yihua Time Technology Co Ltd, Shenzhen Yihua Financial Intelligent Research Institute filed Critical Shenzhen Yihua Computer Co Ltd
Priority to CN201911140080.XA priority Critical patent/CN112825142A/en
Publication of CN112825142A publication Critical patent/CN112825142A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/56Extraction of image or video features relating to colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition

Landscapes

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

Abstract

The embodiment of the invention provides a bill detection method, a bill detection device, a terminal and a storage medium, wherein the bill detection method comprises the following steps: acquiring an infrared perspective view of the bill; acquiring a gray level histogram of the infrared transmission image; acquiring a tail part in the gray level histogram according to a first gray level threshold value and a second gray level threshold value; and confirming whether the bill is scratched or not according to the tail part. The method has the advantages that the scratch phenomenon in the bill is detected, the infrared perspective image is adopted, the requirement for the visible light image high-frequency texture background is avoided, in addition, the scratch detection of the two-dimensional image is converted into the quantitative measurement of the one-dimensional array, the time rate is improved, and the operation is simple.

Description

Bill detection method, device, terminal and storage medium
Technical Field
The embodiment of the invention relates to the field of finance, in particular to a bill detection method, a bill detection device, a bill detection terminal and a storage medium.
Background
When the bills are processed, the standard of the bills to be processed is required to be filled, the surfaces of the bills are clean and have no correction, and if the surfaces of the bills to be processed are stained or corrected, the subsequent processing and operation can be influenced.
At present, whether the bill is scratched or not is judged by a manual detection mode, or scratching detection is carried out according to smoothness of a visible light graph. But the efficiency of manual detection is low, and the error caused by visual inspection by human eyes is inevitable; and the smoothness detection is mainly based on the smoothness difference between the background pattern of the bill and the scratch area, but for the bill with smaller smoothness difference between the background pattern and the scratch area, the scratch detection is difficult by adopting the method.
Disclosure of Invention
In view of the above, the present invention provides a bill detection method, apparatus, terminal and storage medium, so as to achieve intelligent detection of scratch marks on bills.
In a first aspect, an embodiment of the present invention provides a method for positioning a print product, including the following steps:
acquiring an infrared perspective view of the bill;
acquiring a gray level histogram of the infrared transmission image;
acquiring a tail part in the gray level histogram according to a first gray level threshold value and a second gray level threshold value;
and confirming whether the bill is scratched or not according to the tail part.
Preferably, the abscissa of the grayscale histogram is a grayscale value, and the ordinate is a pixel amount;
the obtaining of the tail portion in the gray level histogram according to the first gray level threshold and the second gray level threshold includes:
determining parameters of the gray level histogram, wherein the parameters of the gray level histogram comprise a pixel quantity peak value, a gray level value corresponding to the pixel quantity peak value and a maximum gray level value;
setting a first pixel quantity and a second pixel quantity, wherein the second pixel quantity is smaller than the first pixel quantity, and the first pixel quantity is smaller than the peak value of the pixel quantity;
and acquiring a first gray threshold and a second gray threshold according to the parameters of the gray histogram, the first pixel quantity and the second pixel quantity.
And acquiring the part between the first gray threshold value and the second gray threshold value in the gray histogram as the tail part.
Further, the obtaining a first gray level threshold according to the parameter of the gray level histogram, the first pixel amount, and the second pixel amount includes:
and moving the gray value corresponding to the peak value of the pixel amount of the gray histogram along the direction of increasing the gray value of the abscissa axis, and setting the gray value corresponding to the gray value as the first gray threshold when the pixel amount corresponding to the gray value is smaller than the first pixel amount.
Further, the obtaining a second gray level threshold according to the parameter of the gray level histogram, the first pixel amount, and the second pixel amount further includes:
and moving along the direction that the gray value of the abscissa becomes smaller from the maximum gray value, and setting the gray value corresponding to the gray value as the second gray threshold when the pixel quantity corresponding to the gray value is larger than or equal to the second pixel quantity firstly.
Further, the confirming whether the bill is scratched according to the tail part comprises the following steps:
setting a first length threshold;
if the length of the tail part is larger than or equal to the first length threshold value, the bill is considered to have a scraping phenomenon;
and if the length of the tail part is smaller than the first length threshold value, the bill is considered to have no scraping phenomenon.
Preferably, the confirming whether the bill is scratched according to the tail part further comprises:
setting a second length threshold;
if the length of the tail part is larger than or equal to the second length threshold value, setting a first gray threshold value as a binarization threshold value;
if the tail part length is smaller than the second threshold value, setting a second gray threshold value as a binarization threshold value;
and binarizing the infrared transmission image according to the binarization threshold value to obtain a binarized image.
Further, before the acquiring the infrared transmission image of the bill, the method further comprises the following steps:
acquiring a colored seal area according to the colored seal on the bill;
after the infrared transmission image is binarized according to the binarization threshold value to obtain a binarized image, the method further comprises the following steps:
and setting all the gray values in the colored seal areas in the binary image as the maximum gray value.
Further, after the binarizing the infrared transmission map according to the binarizing threshold value to obtain a binarized image, the method further includes:
and carrying out transverse and longitudinal communication or expansion on the binary image.
Preferably, the confirming whether the bill is scratched according to the tail part further comprises:
acquiring the size and the number of connected domains in the binary image;
if the size and the number of the connected domains exceed preset values, the bill is considered to have a scraping phenomenon;
and if the size or the number of the connected domains does not exceed a preset value, determining that the bill is not scratched.
In a second aspect, an embodiment of the present invention further provides a bill detection apparatus, including:
the infrared transmission image acquisition module is used for acquiring the infrared transmission image of the bill;
the gray level histogram generation module is used for acquiring a gray level histogram of the infrared perspective image;
the tail part acquisition module is used for acquiring a tail part in the gray level histogram according to a first gray level threshold value and a second gray level threshold value;
and the scraping judgment module is used for confirming whether the bill is scraped or not according to the tail part.
Preferably, the abscissa of the grayscale histogram is a grayscale value, and the ordinate is a pixel amount;
the tail portion acquisition module includes:
a parameter determining module, configured to determine parameters of the histogram, where the parameters of the histogram include a pixel quantity peak value, a gray value corresponding to the pixel quantity peak value, and a maximum gray value,
the pixel quantity setting module is used for setting a first pixel quantity and a second pixel quantity, wherein the second pixel quantity is smaller than the first pixel quantity, and the first pixel quantity is smaller than the peak value of the pixel quantity;
the gray threshold setting module is used for acquiring a first gray threshold and a second gray threshold according to the parameters of the gray histogram, the first pixel quantity and the second pixel quantity;
the tail portion obtaining module is further configured to obtain a portion of the gray histogram between the first gray threshold and the second gray threshold as the tail portion.
Preferably, the gray threshold setting module includes: and the first gray threshold setting module is used for moving along the direction that the gray value of the abscissa axis is increased from the gray value corresponding to the peak value of the pixel quantity of the gray histogram, and setting the gray value corresponding to the gray value as the first gray threshold when the pixel quantity corresponding to the gray value is smaller than the first pixel quantity.
Further, the gray threshold setting module further includes: and moving along the direction that the gray value of the abscissa becomes smaller from the maximum gray value, and setting the gray value corresponding to the gray value as the second gray threshold when the pixel quantity corresponding to the gray value is larger than or equal to the second pixel quantity firstly.
Further, the scraping judging module includes:
the first length threshold setting module is used for setting a first length threshold;
if the length of the tail part is larger than or equal to the first length threshold value, the bill is considered to have a scraping phenomenon;
and if the length of the tail part is smaller than the first length threshold value, the bill is considered to have no scraping phenomenon.
Preferably, the scraping judging module further includes:
the second length threshold setting module is used for setting the first length threshold;
a binarization threshold setting module, configured to set a first gray threshold as a binarization threshold if the length of the tail portion is greater than or equal to the second length threshold;
if the length of the tail part is smaller than the second threshold value, the binarization threshold value setting module is used for setting the second gray level threshold value as a binarization threshold value;
and the binarization module is used for binarizing the infrared transmission image according to the binarization threshold value to obtain a binarized image.
Further, the device also comprises a colored seal area acquisition module, which is used for acquiring a colored seal area according to the colored seal on the bill;
the binarization module further comprises a gray value resetting module which is used for setting all gray values in the colored seal area in the binarization image as the maximum gray value.
Preferably, the apparatus further comprises: and the binarization image processing module is used for carrying out horizontal and longitudinal communication or expansion on the binarization image.
Further, the scraping judging module further comprises:
a connected domain obtaining module, configured to obtain the size and number of connected domains in the binarized image;
if the size and the number of the connected domains exceed preset values, the bill is considered to have a scraping phenomenon;
and if the size or the number of the connected domains does not exceed a preset value, determining that the bill is not scratched.
In a third aspect, an embodiment of the present invention further provides a terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the steps of the method for detecting a ticket according to the first aspect of the embodiment of the present invention.
In a fourth aspect, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by the processor, implements the steps of the method for detecting a ticket according to the first aspect of the embodiment of the present invention.
The embodiment of the invention provides a bill detection method, a bill detection device, a terminal and a storage medium, wherein the bill detection method comprises the steps of obtaining an infrared perspective view of a bill; acquiring a gray level histogram of the infrared transmission image; acquiring a tail part in the gray level histogram according to a first gray level threshold value and a second gray level threshold value; and confirming whether the bill is scratched or not according to the tail part. The method has the advantages that the scratch phenomenon in the bill is detected, the infrared perspective image is adopted, the requirement for the visible light image high-frequency texture background is avoided, in addition, the scratch detection of the two-dimensional image is converted into the quantitative measurement of the one-dimensional array, the time rate is improved, and the operation is simple.
Drawings
FIG. 1 is a flow chart of a bill detecting method according to a first embodiment of the present invention;
FIG. 2 is a flow chart of a bill detecting method according to a second embodiment of the present invention;
FIG. 3 is a flowchart illustrating a specific method of step S230 according to a second embodiment of the present invention;
FIG. 4 is a flow chart of a bill detecting method according to a third embodiment of the present invention;
FIG. 5 is a flowchart illustrating a specific method of step S330 according to a third embodiment of the present invention;
FIG. 6 is a flowchart illustrating a specific method of step S340 according to a third embodiment of the present invention;
FIG. 7 is a schematic structural diagram of a bill detecting apparatus according to a fourth embodiment of the present invention;
fig. 8 is a schematic structural diagram of a terminal in the fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
It is also to be noted that, unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items. And in order to avoid obscuring the invention with unnecessary detail, only the structures and/or process steps that are germane to the scheme according to the present invention are shown in the drawings, while other details that are not germane to the present invention are omitted.
Furthermore, the terms "first," "second," and the like may be used herein to describe various orientations, actions, steps, elements, or the like, but the orientations, actions, steps, or elements are not limited by these terms. These terms are only used to distinguish one direction, action, step or element from another direction, action, step or element. For example, without departing. With the scope of the present invention, the first pixel amount may be referred to as a second pixel amount, and similarly, the second pixel amount may be referred to as a first pixel amount. The first pixel amount and the second pixel amount are both pixel amounts, but they are not the same pixel amount. The terms "first", "second", etc. are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
Example one
Fig. 1 is a flowchart of a bill detection method according to an embodiment of the present invention, which can be applied to detecting scratches or falsifications on a bill. The bill detection method provided by the embodiment of the invention comprises the following steps:
and S110, acquiring the infrared perspective of the bill.
Preferably, since the area of the document where scratching or alteration occurs is often brighter in its ir transmission than the normal area, an ir camera can be used to photograph the document to obtain an ir transmission of the document in order to detect the scratched area.
And S120, acquiring a gray level histogram of the infrared transmission image.
The gray histogram is a function of gray level distribution, and is a statistic of gray level distribution in an image. The gray histogram is to count the probability of occurrence of all pixels in the digital image according to the size of the gray value. The gray histogram is a function of gray levels, which represents the number of pixels in an image having a certain gray level, reflecting the probability of the occurrence of a certain gray level in the image.
Since the scratch part area in the infrared perspective image is off white relative to the background, namely, the gray value of the area part is larger, whether the bill is scratched or not can be judged according to the parameter characteristics of the gray histogram.
Preferably, a computer program such as MATLAB may be used to generate a grey level histogram of the ir transmission map from the ir transmission map obtained.
Preferably, the gray histogram in the present embodiment has a gray level of 256, a gray value on the abscissa, a pixel amount on the ordinate, and a gray value range of [0, 255 ]. In general, the gray scale value gradually increases from black to white, the gray scale value of black is 0, and the gray scale value of white is 255.
And S130, acquiring a tail part in the gray level histogram according to the first gray level threshold value and the second gray level threshold value.
Preferably, the tail portion refers to a portion where the gradation value is high but the pixel amount is low. A portion where the gray value is greater than the preset value and the pixel amount is less than the preset value may be regarded as a tail portion.
And S140, confirming whether the bill is scratched or not according to the tail part.
Preferably, whether the bill is scratched or not can be confirmed according to the length of the tail part, wherein the difference value between the second gray level threshold value and the first gray level threshold value is the length of the tail part.
Preferably, a first length threshold is set. The first length threshold is preferably 20, i.e. the difference between the first gray threshold and the second gray threshold is 20.
If the length of the tail part is larger than or equal to the first length threshold value, the bill is considered to have a scraping phenomenon; and if the length of the tail part is smaller than the first length threshold value, the bill is considered to have no scraping phenomenon.
According to the bill detection method provided by the embodiment of the invention, the infrared transmission image of the bill is obtained, the gray level histogram of the infrared transmission image is obtained, the tail part in the gray level histogram is obtained according to the first gray level threshold value and the second gray level threshold value, and whether the bill is scratched or not is confirmed according to the tail part. The method has the advantages that the scratch phenomenon in the bill is detected, the infrared perspective image is adopted, the requirement for the high-frequency texture background of the visible light image is avoided, in addition, the scratch detection of the two-dimensional image is converted into the quantitative measurement of the one-dimensional array in the gray value histogram, the time rate is improved, and the operation is simple.
Example two
Fig. 2 is a flowchart of a bill detection method according to a second embodiment of the present invention, which can be applied to detecting scratches or falsifications on a bill. The bill detection method provided by the embodiment of the invention comprises the following steps:
and S210, acquiring the infrared perspective of the bill.
Since the area of a document where scratches or alterations occur is often brighter in its ir transmission than the normal area, an ir camera can be used to capture the document to obtain an ir transmission of the document in order to detect the scratch area.
And S220, acquiring a gray level histogram of the infrared transmission image.
The gray histogram is a function of gray level distribution, and is a statistic of gray level distribution in an image. The gray histogram is to count the probability of occurrence of all pixels in the digital image according to the size of the gray value. The gray histogram is a function of gray levels, which represents the number of pixels in an image having a certain gray level, reflecting the probability of the occurrence of a certain gray level in the image.
Since the scratch part area in the infrared perspective image is off white relative to the background, namely, the gray value of the area part is larger, whether the bill is scratched or not can be judged according to the parameter characteristics of the gray histogram.
Preferably, a computer program such as MATLAB may be used to generate a grey level histogram of the ir transmission map from the ir transmission map obtained.
Preferably, the gray histogram in the present embodiment has a gray level of 256, a gray value on the abscissa, a pixel amount on the ordinate, and a gray value range of [0, 255 ]. In general, the gray scale value gradually increases from black to white, the gray scale value of black is 0, and the gray scale value of white is 255.
And S230, acquiring a tail part in the gray level histogram according to the first gray level threshold value and the second gray level threshold value.
Here, the tail portion refers to a portion where the gradation value is high but the pixel amount is low. Specifically, as shown in fig. 3, step S230 includes the steps of:
s231, determining parameters of the gray level histogram, wherein the parameters of the gray level histogram comprise a pixel quantity peak value, a gray level value corresponding to the pixel quantity peak value and a maximum gray level value.
The peak value of the pixel quantity is the maximum value of the ordinate of the gray histogram, namely the maximum pixel quantity; the gray value corresponding to the pixel quantity peak value is the gray value with the largest occurrence frequency in the target area; the maximum gray value is the maximum value of the abscissa of the gray histogram, i.e. the maximum value of the gray in the target area.
S232, setting a first pixel quantity and a second pixel quantity, wherein the second pixel quantity is smaller than the first pixel quantity, and the first pixel quantity is smaller than the peak value of the pixel quantity.
And S233, acquiring a first gray threshold and a second gray threshold according to the parameters of the gray histogram, the first pixel quantity and the second pixel quantity.
First, the gray value corresponding to the peak value of the pixel amount of the gray histogram is shifted in the direction in which the gray value of the abscissa axis becomes larger, and when the pixel amount corresponding to the gray value is smaller than the first pixel amount, the gray value corresponding to the gray value is set as the first gray threshold value.
And moving along the direction that the gray value of the abscissa becomes smaller from the maximum gray value, and setting the gray value corresponding to the gray value as the second gray threshold when the pixel quantity corresponding to the gray value is larger than or equal to the second pixel quantity firstly.
And S234, acquiring the part between the first gray threshold value and the second gray threshold value in the gray histogram as the tail part.
And S240, confirming whether the bill is scratched or not according to the tail part.
And confirming whether the bill is scratched or not according to the length of the tail part, wherein the difference value between the second gray level threshold value and the first gray level threshold value is the length of the tail part.
Specifically, a first length threshold is set. The first length threshold is preferably 20, i.e. the difference between the first gray threshold and the second gray threshold is 20.
If the length of the tail part is larger than or equal to the first length threshold value, the bill is considered to have a scraping phenomenon; and if the length of the tail part is smaller than the first length threshold value, the bill is considered to have no scraping phenomenon.
According to the bill detection method provided by the embodiment of the invention, the infrared transmission image of the bill is obtained, the gray level histogram of the infrared transmission image is obtained, the tail part in the gray level histogram is obtained according to the first gray level threshold value and the second gray level threshold value, and whether the bill is scratched or not is confirmed according to the tail part. The method has the advantages that the scratch phenomenon in the bill is detected, the infrared perspective image is adopted, the requirement for the high-frequency texture background of the visible light image is avoided, in addition, the scratch detection of the two-dimensional image is converted into the quantitative measurement of the one-dimensional array in the gray value histogram, the time rate is improved, and the operation is simple.
EXAMPLE III
Fig. 4 is a flowchart of a bill detection method according to a third embodiment of the present invention, which can be applied to detecting scratches or falsifications on a bill. The bill detection method provided by the embodiment of the invention comprises the following steps:
s300, obtaining a colored seal area according to the colored seal on the bill.
For some documents with colored stamps, the ir-transparent image may have visually-perceptible white patches that are lighter than the background, and there is a high probability that it will be considered scratched.
Therefore, in order to avoid this phenomenon, the visible light diagram of the bill can be used firstly to obtain the colored seal area with specific hue, saturation and lightness through the HSV color model.
And S310, acquiring the infrared transmission image of the bill.
And shooting the ticket by adopting an infrared camera to obtain an infrared transmission image of the ticket so as to detect the scratch area.
And S320, acquiring a gray level histogram of the infrared transmission image.
Preferably, a computer program such as MATLAB may be used to generate a grey level histogram of the ir transmission map from the ir transmission map obtained.
Preferably, the gray histogram in the present embodiment has a gray level of 256, a gray value on the abscissa, a pixel amount on the ordinate, and a gray value range of [0, 255 ]. In general, the gray scale value gradually increases from black to white, the gray scale value of black is 0, and the gray scale value of white is 255.
S330, acquiring a tail part in the gray level histogram according to the first gray level threshold value and the second gray level threshold value.
Here, the tail portion refers to a portion where the gradation value is high but the pixel amount is low. Specifically, as shown in fig. 5, step S330 includes the steps of:
s331, determining parameters of the gray level histogram, wherein the parameters of the gray level histogram comprise a pixel quantity peak value, a gray level value corresponding to the pixel quantity peak value and a maximum gray level value.
The peak value of the pixel quantity is the maximum value of the ordinate of the gray histogram, namely the maximum pixel quantity; the gray value corresponding to the pixel quantity peak value is the gray value with the largest occurrence frequency in the target area; the maximum gray value is the maximum value of the abscissa of the gray histogram, i.e. the maximum value of the gray in the target area.
S332, setting a first pixel quantity and a second pixel quantity, wherein the second pixel quantity is smaller than the first pixel quantity, and the first pixel quantity is smaller than the peak value of the pixel quantity.
S333, acquiring a first gray threshold and a second gray threshold according to the parameters of the gray histogram, the first pixel quantity and the second pixel quantity.
First, the gray value corresponding to the peak value of the pixel amount of the gray histogram is shifted in the direction in which the gray value of the abscissa axis becomes larger, and when the pixel amount corresponding to the gray value is smaller than the first pixel amount, the gray value corresponding to the gray value is set as the first gray threshold value.
And moving along the direction that the gray value of the abscissa becomes smaller from the maximum gray value, and setting the gray value corresponding to the gray value as the second gray threshold when the pixel quantity corresponding to the gray value is larger than or equal to the second pixel quantity firstly.
And S334, acquiring the part between the first gray threshold value and the second gray threshold value in the gray level histogram as the tail part.
And S340, confirming whether the bill is scratched or not according to the tail part.
Preferably, a binarization threshold value can be set according to the length of the tail part, the infrared transmission image is converted into a binarization image according to the set binarization threshold value, whether the bill is scratched or not is confirmed according to the binarization image, and the scratching degree of the bill can be further judged. Wherein a difference between the second gray level threshold and the first gray level threshold is a length of the tail portion.
Specifically, as shown in fig. 6, step S340 includes the steps of:
and S341, setting a second length threshold value.
The second length threshold is preferably 20, i.e. the difference between the first gray threshold and the second gray threshold is 20.
And S342, if the length of the tail part is greater than or equal to the second length threshold value, setting a first gray threshold value as a binarization threshold value.
And S343, if the tail part length is smaller than the second threshold value, setting the second gray threshold value as a binarization threshold value.
And S344, binarizing the infrared transparent image according to the binarization threshold value to obtain a binarized image.
Preferably, a computer program such as MATLAB and the like can be used to binarize the infrared transmission map, that is, all gray values greater than or equal to the binarization threshold value are replaced by 0; and replacing all gray values smaller than the binarization threshold value with 255 so as to obtain a binarization image.
Preferably, in the process of binarization, all the gray values in the colored stamp region in the binarized image are also set as the maximum gray value, that is, set as 255.
Preferably, when the bill is scratched, the scratch area is always changed in the scratch area, so that the scratch area is reduced, and therefore the connected domain in the binary image is reduced and/or dispersed, and in the process of binarization, the binary image is also transversely and longitudinally connected or expanded.
And S345, acquiring the size and the number of the connected domains in the binary image.
And extracting all parts with the gray values of 0 in the binary image to form one or more connected domains, and acquiring the size of each connected domain and the number of the connected domains.
S346, if the size and the number of the connected domains exceed preset values, the bill is considered to have a scraping phenomenon.
Preferably, the connected domain size includes the width and height of the connected domain. The preset values include: the width is 6, the height is 8, the number is 60, and only when the width, the height and the number of the connected domains exceed the preset values, the bill is considered to have the scraping phenomenon.
And S347, if the size or the number of the connected domains does not exceed a preset value, determining that the bill is not scratched.
Namely, in the width, the height and the number of the connected domains, if any one of the width, the height and the number of the connected domains does not exceed a preset value, the bill is considered to have no scraping phenomenon.
According to the bill detection method provided by the embodiment of the invention, the infrared transmission image of the bill is obtained, the gray level histogram of the infrared transmission image is obtained, the tail part in the gray level histogram is obtained according to the first gray level threshold value and the second gray level threshold value, and whether the bill is scratched or not is confirmed according to the tail part. The method has the advantages that the scratch phenomenon in the bill is detected, the infrared perspective image is adopted, the requirement for the high-frequency texture background of the visible light image is avoided, in addition, the scratch detection of the two-dimensional image is converted into the quantitative measurement of the one-dimensional array in the gray value histogram, the time rate is improved, and the operation is simple. In addition, a binaryzation image of the infrared perspective image is obtained, detection of scraping phenomena existing in the bill is achieved according to the connected domain of the binaryzation image, the scraping degree can be further analyzed, meanwhile, influences of colored seals and correction stains on results are eliminated, and detection accuracy is improved.
Example four
Fig. 7 is a cargo access device according to a fourth embodiment of the present invention, including: the infrared transmission image acquisition module 10, the gray histogram generation module 20, the tail portion acquisition module 30 and the scratch judgment module 40.
And the infrared transmission image acquisition module 10 is used for acquiring the infrared transmission image of the bill.
And a gray histogram generating module 20, configured to obtain a gray histogram of the infrared transmission map.
Preferably, the gray level of the gray histogram is 256, the abscissa is a gray value, the ordinate is a pixel amount, and the gray value range is [0, 255 ]. In general, the gray scale value gradually increases from black to white, the gray scale value of black is 0, and the gray scale value of white is 255.
And a tail part acquiring module 30, configured to acquire a tail part in the grayscale histogram according to the first grayscale threshold and the second grayscale threshold.
Preferably, the tail portion acquiring module 30 includes:
and the parameter determining module is used for determining parameters of the gray histogram, wherein the parameters of the gray histogram comprise a pixel quantity peak value, a gray value corresponding to the pixel quantity peak value and a maximum gray value. The peak value of the pixel quantity is the maximum value of the ordinate of the gray histogram, namely the maximum pixel quantity; the gray value corresponding to the pixel quantity peak value is the gray value with the largest occurrence frequency in the target area; the maximum gray value is the maximum value of the abscissa of the gray histogram, i.e. the maximum value of the gray in the target area.
The pixel quantity setting module is used for setting a first pixel quantity and a second pixel quantity, wherein the second pixel quantity is smaller than the first pixel quantity, and the first pixel quantity is smaller than the peak value of the pixel quantity.
And the gray threshold setting module is used for acquiring a first gray threshold and a second gray threshold according to the parameters of the gray histogram, the first pixel quantity and the second pixel quantity. Specifically, the gray threshold setting module may start from the gray value corresponding to the peak value of the pixel amount of the gray histogram, move along the direction in which the gray value of the abscissa axis becomes larger, and set the gray value corresponding to the gray value as the first gray threshold when the pixel amount corresponding to the gray value is smaller than the first pixel amount; and moving along the direction that the gray value of the abscissa becomes smaller from the maximum gray value, and setting the gray value corresponding to the gray value as the second gray threshold when the pixel quantity corresponding to the gray value is larger than or equal to the second pixel quantity firstly.
The tail portion obtaining module 30 is further configured to obtain a portion of the gray histogram between the first gray threshold and the second gray threshold as the tail portion.
And the scraping judging module 40 is used for confirming whether the bill is scraped or not according to the tail part.
Preferably, the scratch judging module 40 may determine whether the bill is scratched according to the length of the tail portion, where the difference between the second gray threshold and the first gray threshold is the length of the tail portion. For example, the scraping judgment module 40 in the embodiment of the present invention first sets a first length threshold, where the first length threshold is preferably 20, that is, a difference between the first gray threshold and the second gray threshold is 20; if the length of the tail part is larger than or equal to the first length threshold value, the bill is considered to have a scraping phenomenon; and if the length of the tail part is smaller than the first length threshold value, the bill is considered to have no scraping phenomenon.
According to the bill detection device provided by the embodiment of the invention, the infrared perspective image of the bill is acquired through the infrared perspective image acquisition module; acquiring a gray level histogram of the infrared perspective image through a gray level histogram generation module; acquiring a tail part in the gray level histogram through a tail part acquisition module; whether the bills are scratched or not is confirmed through the scratching judgment module according to the tail part, so that the scratching phenomenon in the bills is detected, the requirement on a high-frequency texture background of a visible light image is avoided by adopting an infrared transmission image, in addition, the scratching detection on the two-dimensional image is converted into quantitative measurement on a one-dimensional array in a gray value histogram, the time rate is improved, and the operation is simple.
In an alternative embodiment, the scratch determination module 40 further includes:
and the second length threshold setting module is used for setting the first length threshold.
A binarization threshold setting module, configured to set a first gray threshold as a binarization threshold if the length of the tail portion is greater than or equal to the second length threshold; and if the length of the tail part is smaller than the second threshold value, the binarization threshold value setting module is used for setting the second gray level threshold value as a binarization threshold value.
And the binarization module is used for binarizing the infrared transmission image according to the binarization threshold value to obtain a binarized image. Performing binarization on the infrared transmission image, namely replacing all gray values which are greater than or equal to the binarization threshold value with 0; and replacing all gray values smaller than the binarization threshold value with 255 so as to obtain a binarization image.
Preferably, the bill detecting apparatus further comprises: and the colored seal area acquisition module is used for acquiring a colored seal area according to the colored seal on the bill.
Further, the binarization module further comprises: and the gray value resetting module is used for setting all the gray values in the colored seal areas in the binarized image as the maximum gray value, namely 255.
Preferably, the binarization module further comprises: and the binarization image processing module is used for carrying out horizontal and longitudinal communication or expansion on the binarization image.
Preferably, the bill detecting apparatus further comprises: and the connected domain obtaining module is used for obtaining the size and the number of the connected domains in the binary image. If the size and the number of the connected domains exceed preset values, the bill is considered to have a scraping phenomenon; and if the size or the number of the connected domains does not exceed a preset value, determining that the bill is not scratched.
In an alternative embodiment, the binaryzation image of the infrared perspective image is obtained through the binaryzation module, the scratch phenomenon existing in the bill is detected according to the connected domain of the binaryzation image, the scratch degree can be further analyzed, meanwhile, the influence of a colored seal and a correction stain on the result is eliminated, and the detection precision is improved.
EXAMPLE five
Fig. 8 is a schematic structural diagram of a terminal according to a fifth embodiment of the present invention, and as shown in fig. 8, the terminal includes a processor 510, a memory 520, an input device 530, and an output device 540; the number of the processors 510 in the terminal may be one or more, and one processor 510 is taken as an example in fig. 5; the processor 510, the memory 520, the input device 530 and the output device 540 in the terminal may be connected by a bus or other means, which is exemplified in fig. 5.
The memory 510 is a computer-readable storage medium, and can be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the bill detection method in the embodiment of the present invention (for example, based on an infrared transmission image acquisition module, a gray histogram generation module, a tail portion acquisition module, and a scratch determination module in the bill detection device). The processor 510 executes various functional applications and data processing of the terminal by executing software programs, instructions and modules stored in the memory 520, that is, implements the above-described ticket detecting method.
Namely:
and acquiring an infrared perspective view of the bill.
And acquiring a gray level histogram of the infrared transmission image.
And acquiring a tail part in the gray level histogram according to the first gray level threshold value and the second gray level threshold value.
And confirming whether the bill is scratched or not according to the tail part.
The memory 520 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 520 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 520 may further include memory located remotely from the processor 510, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 530 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the terminal. The output device 540 may include a display device such as a display screen.
EXAMPLE six
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform a method for detecting a ticket, the method including:
and acquiring an infrared perspective view of the bill.
And acquiring a gray level histogram of the infrared transmission image.
And acquiring a tail part in the gray level histogram according to the first gray level threshold value and the second gray level threshold value.
And confirming whether the bill is scratched or not according to the tail part.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the method operations described above, and may also perform related operations in the ticket detection method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a terminal, or a network device) to execute the methods according to the embodiments of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (12)

1. A method of bill inspection, comprising:
acquiring an infrared perspective view of the bill;
acquiring a gray level histogram of the infrared transmission image;
acquiring a tail part in the gray level histogram according to a first gray level threshold value and a second gray level threshold value;
and confirming whether the bill is scratched or not according to the tail part.
2. The method of claim 1, wherein the gray histogram has an abscissa of gray values and an ordinate of pixel amounts;
the obtaining of the tail portion in the gray level histogram according to the first gray level threshold and the second gray level threshold includes:
determining parameters of the gray level histogram, wherein the parameters of the gray level histogram comprise a pixel quantity peak value, a gray level value corresponding to the pixel quantity peak value and a maximum gray level value;
setting a first pixel quantity and a second pixel quantity, wherein the second pixel quantity is smaller than the first pixel quantity, and the first pixel quantity is smaller than the peak value of the pixel quantity;
acquiring a first gray threshold and a second gray threshold according to the parameters of the gray histogram, the first pixel quantity and the second pixel quantity;
and acquiring the part between the first gray threshold value and the second gray threshold value in the gray histogram as the tail part.
3. The method of claim 2, wherein obtaining the first gray level threshold according to the parameters of the gray level histogram, the first pixel amount and the second pixel amount comprises:
and moving the gray value corresponding to the peak value of the pixel amount of the gray histogram along the direction of increasing the gray value of the abscissa axis, and setting the gray value corresponding to the gray value as the first gray threshold when the pixel amount corresponding to the gray value is smaller than the first pixel amount.
4. The method of claim 3, wherein obtaining the second gray level threshold according to the parameter of the gray level histogram, the first pixel amount, and the second pixel amount further comprises:
and moving along the direction that the gray value of the abscissa becomes smaller from the maximum gray value, and setting the gray value corresponding to the gray value as the second gray threshold when the pixel quantity corresponding to the gray value is larger than or equal to the second pixel quantity firstly.
5. The method of claim 4, wherein said confirming whether the document is scratched according to the tail portion comprises:
setting a first length threshold;
if the length of the tail part is larger than or equal to the first length threshold value, the bill is considered to have a scraping phenomenon;
and if the length of the tail part is smaller than the first length threshold value, the bill is considered to have no scraping phenomenon.
6. The method of claim 4, wherein said confirming whether the document is scratched according to the tail portion comprises:
setting a second length threshold;
if the length of the tail part is larger than or equal to the second length threshold value, setting a first gray threshold value as a binarization threshold value;
if the tail part length is smaller than the second threshold value, setting a second gray threshold value as a binarization threshold value;
and binarizing the infrared transmission image according to the binarization threshold value to obtain a binarized image.
7. The method of claim 6, further comprising, prior to said obtaining the ir-transparent image of the document:
acquiring a colored seal area according to the colored seal on the bill;
the binarizing the infrared transmission image according to the binarizing threshold value to obtain a binarized image further comprises:
and setting all the gray values in the colored seal areas in the binary image as the maximum gray value.
8. The method according to claim 6, wherein the binarizing the infrared transmission map according to the binarization threshold value to obtain a binarized image further comprises:
and carrying out transverse and longitudinal communication or expansion on the binary image.
9. The method of any of claims 6-8, wherein said confirming whether the document is scratched is based on the tail portion, further comprising:
acquiring the size and the number of connected domains in the binary image;
if the size and the number of the connected domains exceed preset values, the bill is considered to have a scraping phenomenon;
and if the size or the number of the connected domains does not exceed a preset value, determining that the bill is not scratched.
10. A bill validator comprising:
the infrared transmission image acquisition module is used for acquiring the infrared transmission image of the bill;
the gray level histogram generation module is used for acquiring a gray level histogram of the infrared perspective image;
the tail part acquisition module is used for acquiring a tail part in the gray level histogram according to a first gray level threshold value and a second gray level threshold value;
and the scraping judgment module is used for confirming whether the bill is scraped or not according to the tail part.
11. A terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method of ticket detection according to any of claims 1-9 when executing the computer program.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of ticket detection of any one of claims 1-9.
CN201911140080.XA 2019-11-20 2019-11-20 Bill detection method, device, terminal and storage medium Pending CN112825142A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911140080.XA CN112825142A (en) 2019-11-20 2019-11-20 Bill detection method, device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911140080.XA CN112825142A (en) 2019-11-20 2019-11-20 Bill detection method, device, terminal and storage medium

Publications (1)

Publication Number Publication Date
CN112825142A true CN112825142A (en) 2021-05-21

Family

ID=75906715

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911140080.XA Pending CN112825142A (en) 2019-11-20 2019-11-20 Bill detection method, device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN112825142A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6040584A (en) * 1998-05-22 2000-03-21 Mti Corporation Method and for system for detecting damaged bills
US20100322503A1 (en) * 2008-01-31 2010-12-23 Universal Entertainment Corporation Paper sheet identifying device and paper sheet identifying method
CN104573700A (en) * 2015-02-04 2015-04-29 广州广电运通金融电子股份有限公司 Folded bill identification method and device
CN105005969A (en) * 2015-06-18 2015-10-28 辰通智能设备(深圳)有限公司 Note image correction detecting method and system
CN109543554A (en) * 2018-10-30 2019-03-29 深圳怡化电脑股份有限公司 Bill detection method, device, terminal and computer readable storage medium
CN110473333A (en) * 2019-07-11 2019-11-19 深圳怡化电脑股份有限公司 Detection method, detection device and the terminal of note number

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6040584A (en) * 1998-05-22 2000-03-21 Mti Corporation Method and for system for detecting damaged bills
US20100322503A1 (en) * 2008-01-31 2010-12-23 Universal Entertainment Corporation Paper sheet identifying device and paper sheet identifying method
CN104573700A (en) * 2015-02-04 2015-04-29 广州广电运通金融电子股份有限公司 Folded bill identification method and device
CN105005969A (en) * 2015-06-18 2015-10-28 辰通智能设备(深圳)有限公司 Note image correction detecting method and system
CN109543554A (en) * 2018-10-30 2019-03-29 深圳怡化电脑股份有限公司 Bill detection method, device, terminal and computer readable storage medium
CN110473333A (en) * 2019-07-11 2019-11-19 深圳怡化电脑股份有限公司 Detection method, detection device and the terminal of note number

Similar Documents

Publication Publication Date Title
CN108229526B (en) Network training method, network training device, image processing method, image processing device, storage medium and electronic equipment
Liu et al. A universal destriping framework combining 1-D and 2-D variational optimization methods
CN108896278B (en) Optical filter silk-screen defect detection method and device and terminal equipment
EP1330111B1 (en) Automatic image quality evaluation and correction technique
EP0712094B1 (en) A multi-windowing technique for threshholding an image using local image properties
CN112837303A (en) Defect detection method, device, equipment and medium for mold monitoring
CN110766679A (en) Lens contamination detection method and device and terminal equipment
US8014574B2 (en) Character noise eliminating apparatus, character noise eliminating method, and character noise eliminating program
CN114519714B (en) Method and system for judging smudgy defect of display screen
Yangping et al. Real-time Defect Detection Method for Printed Images Based on Grayscale and Gradient Differences.
CN116883336A (en) Image processing method, device, computer equipment and medium
US8442348B2 (en) Image noise reduction for digital images using Gaussian blurring
CN113989336A (en) Visible light image and infrared image registration method and device
CN111563845B (en) Bill surface scratch detection method, device, equipment and storage medium
CN112017163A (en) Image blur degree detection method and device, electronic equipment and storage medium
CN112825142A (en) Bill detection method, device, terminal and storage medium
CN115797327A (en) Defect detection method and device, terminal device and storage medium
CN114066881B (en) Nonlinear transformation based detection method, computer equipment and storage medium
US20060233452A1 (en) Text enhancement methodology in scanned images of gray-scale documents
CN109949245B (en) Cross laser detection positioning method and device, storage medium and computer equipment
CN114140620A (en) Object straight line contour detection method
JP2005184787A (en) Image processing method and device
JP2010250387A (en) Image recognition device and program
Long et al. An Efficient Method For Dark License Plate Detection
US11750748B2 (en) Image processing apparatus, method, and storage medium to evaluate printed material with decreased influence of specific characteristic of print medium determined from margin area of printed chart

Legal Events

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