CN113269708B - Method and device for determining new and old media, computer equipment and storage medium - Google Patents

Method and device for determining new and old media, computer equipment and storage medium Download PDF

Info

Publication number
CN113269708B
CN113269708B CN202010304555.0A CN202010304555A CN113269708B CN 113269708 B CN113269708 B CN 113269708B CN 202010304555 A CN202010304555 A CN 202010304555A CN 113269708 B CN113269708 B CN 113269708B
Authority
CN
China
Prior art keywords
gray
image
target
value
region
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
CN202010304555.0A
Other languages
Chinese (zh)
Other versions
CN113269708A (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.)
Shenzhen Yihua Times Intelligent Automation System Co ltd
Shenzhen Yihua Computer Co Ltd
Shenzhen Yihua Time Technology Co Ltd
Original Assignee
Shenzhen Yihua Times Intelligent Automation System Co ltd
Shenzhen Yihua Computer Co Ltd
Shenzhen Yihua Time 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 Shenzhen Yihua Times Intelligent Automation System Co ltd, Shenzhen Yihua Computer Co Ltd, Shenzhen Yihua Time Technology Co Ltd filed Critical Shenzhen Yihua Times Intelligent Automation System Co ltd
Priority to CN202010304555.0A priority Critical patent/CN113269708B/en
Publication of CN113269708A publication Critical patent/CN113269708A/en
Application granted granted Critical
Publication of CN113269708B publication Critical patent/CN113269708B/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
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]
    • 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/50Extraction of image or video features by performing operations within image blocks; by using histograms, e.g. histogram of oriented gradients [HoG]; by summing image-intensity values; Projection analysis
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07DHANDLING OF COINS OR VALUABLE PAPERS, e.g. TESTING, SORTING BY DENOMINATIONS, COUNTING, DISPENSING, CHANGING OR DEPOSITING
    • G07D7/00Testing specially adapted to determine the identity or genuineness of valuable papers or for segregating those which are unacceptable, e.g. banknotes that are alien to a currency
    • G07D7/20Testing patterns thereon
    • G07D7/2016Testing patterns thereon using feature extraction, e.g. segmentation, edge detection or Hough-transformation

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Quality & Reliability (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Image Processing (AREA)
  • Studio Devices (AREA)

Abstract

The embodiment of the invention discloses a method and a device for determining whether a medium is old or new, computer equipment and a storage medium, wherein the method comprises the following steps: obtaining a gray level histogram corresponding to the target medium according to the target front image and the target back image; obtaining a first gray value corresponding to a first region and a second gray value corresponding to a second region according to the gray histogram, wherein the first region and the second region are image regions in the target front image and the target back image, and the gray value of a pixel point in the first region is larger than the gray value of a pixel point in the second region; obtaining a gray level difference value of the first region and the second region according to a first gray level value corresponding to the first region and a second gray level value corresponding to the second region; and determining whether the target medium is old or new according to the gray level difference value of the first area and the second area. The invention can reduce the false positive probability.

Description

Method and device for determining new and old media, computer equipment and storage medium
Technical Field
The present invention relates to the field of media old and new detection technologies, and in particular, to a method and apparatus for determining media old and new, a computer device, and a storage medium.
Background
The existing sheet medium detection device generally has a medium new and old detection function. For example, an automatic teller machine, or a bill machine can detect whether a sheet-like bill or bill is old or new.
However, the existing medium new and old determining method is mainly realized by judging the gray average value of the highlight area of the medium, and the lower the gray average value of the highlight area is, the older the medium is, the higher the gray average value of the highlight area is, and the newer the medium is. For a banknote, the highlight region is typically a rectangular region above the crown word number in the front image of the banknote.
Therefore, in the existing medium old and new judging method, because the highlight area is fixed, when a certain new medium is dirty in the highlight area, erroneous judgment is easy to occur.
Disclosure of Invention
Based on this, it is necessary to provide a method, a device, a computer device and a storage medium for determining whether a medium is old or new, so as to solve the technical problem in the prior art that the erroneous judgment rate is high when a highlight area in the medium is dirty.
In a first aspect, a method for determining whether a medium is old or new is provided, including: acquiring a target front image and a target back image of a target medium; obtaining a gray level histogram corresponding to the target medium according to the target front image and the target back image; obtaining a first gray value corresponding to a first region and a second gray value corresponding to a second region according to the gray histogram, wherein the first region and the second region are image regions in the target front image and the target back image, and the gray value of a pixel point in the first region is larger than the gray value of a pixel point in the second region; obtaining a gray level difference value of the first region and the second region according to a first gray level value corresponding to the first region and a second gray level value corresponding to the second region; and determining whether the target medium is old or new according to the gray level difference value of the first area and the second area.
In one embodiment, the acquiring the target front side image and the target back side image of the target medium includes: acquiring a preliminary front image and a preliminary back image of the target medium; and cutting the preliminary front image and the preliminary back image based on preset cutting information to obtain a target front image and a target back image of the target medium.
In one embodiment, the obtaining, according to the gray histogram, a first gray value corresponding to a first region and a second gray value corresponding to a second region includes: acquiring a first gray scale corresponding to a first area and a second gray scale corresponding to a second area, wherein the first gray scale reflects the proportion of gray values in the first area in the target front image and the target back image, and the second gray scale reflects the proportion of gray values in the second area in the target front image and the target back image; and obtaining a first gray value corresponding to the first region and a second gray value corresponding to the second region according to the number of gray values corresponding to the gray histogram, the first gray scale corresponding to the first region and the second gray scale corresponding to the second region.
In one embodiment, the obtaining the first gray value corresponding to the first region and the second gray value corresponding to the second region according to the number of gray values corresponding to the gray histogram, the first gray scale corresponding to the first region, and the second gray scale corresponding to the second region includes: the gray values corresponding to the gray histogram are arranged in order from small to large to obtain a gray value set, and each gray value in the gray value set corresponds to one gray value serial number; multiplying the number of the gray values corresponding to the gray histogram by a first gray scale ratio corresponding to the first region to obtain a first gray value sequence number, acquiring the gray value corresponding to the first gray value sequence number from the gray value set according to the first gray value sequence number, and taking the gray value corresponding to the first gray value sequence number as a first gray value corresponding to the first region; and multiplying the number of the gray values corresponding to the gray histogram by a second gray scale ratio corresponding to the second region to obtain a second gray value sequence number, acquiring the gray value corresponding to the second gray value sequence number from the gray value set according to the second gray value sequence number, and taking the gray value corresponding to the second gray value sequence number as the second gray value corresponding to the second region.
In one embodiment, the acquiring the target front side image and the target back side image of the target medium includes: acquiring a sensor front image and a sensor back image of the target medium; determining gray value distribution ranges of pixel points in the sensor front image and the sensor back image according to the sensor front image and the sensor back image; and if the gray value distribution ranges of the pixels in the sensor front image and the sensor back image are different from the preset gray value distribution ranges, processing the gray values of the pixels in the sensor front image and the sensor back image to obtain a target front image and a target back image of a target medium, wherein the gray value distribution of the pixels in the target front image and the target back image is in the preset gray value distribution ranges.
In one embodiment, the acquiring the target front side image and the target back side image of the target medium includes: acquiring a front color image, a back color image and a gray level image of a target medium, wherein the front color image and the back color image are shot by a color sensor, and the gray level image is shot by a gray level sensor; obtaining a red value distribution map, a green value distribution map and a blue value distribution map corresponding to the target medium according to the front color image and the back color image; and obtaining a target front image and a target back image of the target medium according to the red value distribution diagram, the green value distribution diagram, the blue value distribution diagram and the distribution information of the pixel values in the gray level image.
In one embodiment, the determining whether the target medium is old or new according to the gray level difference between the first area and the second area includes: acquiring a plurality of preset new and old level gray scale ranges; comparing the gray level difference value of the first area and the second area with each new and old gray level range to determine the new and old gray level range where the gray level difference value of the first area and the second area is located; and determining whether the target medium is old or new according to the old or new gray scale range of the gray scale difference value of the first area and the second area.
In a second aspect, a device for determining whether a medium is old or new is provided, including: the first acquisition module is used for acquiring a target front image and a target back image of a target medium; the histogram module is used for obtaining a gray level histogram corresponding to the target medium according to the target front image and the target back image; the gray value module is used for obtaining a first gray value corresponding to a first region and a second gray value corresponding to a second region according to the gray histogram, wherein the first region and the second region are image regions in the target front image and the target back image, and the gray value of a pixel point in the first region is larger than the gray value of a pixel point in the second region; the gray level difference module is used for obtaining a gray level difference value of the first region and the second region according to a first gray level value corresponding to the first region and a second gray level value corresponding to the second region; and the new and old determining module is used for determining the new and old of the target medium according to the gray level difference value of the first area and the second area.
In one embodiment, the first obtaining module is specifically configured to: acquiring a preliminary front image and a preliminary back image of the target medium; and cutting the preliminary front image and the preliminary back image based on preset cutting information to obtain a target front image and a target back image of the target medium.
In one embodiment, the gray value module is specifically configured to: acquiring a first gray scale corresponding to a first area and a second gray scale corresponding to a second area, wherein the first gray scale reflects the proportion of gray values in the first area in the target front image and the target back image, and the second gray scale reflects the proportion of gray values in the second area in the target front image and the target back image; and obtaining a first gray value corresponding to the first region and a second gray value corresponding to the second region according to the number of gray values corresponding to the gray histogram, the first gray scale corresponding to the first region and the second gray scale corresponding to the second region.
In one embodiment, the gray value module is specifically configured to: the gray values corresponding to the gray histogram are arranged in order from small to large to obtain a gray value set, and each gray value in the gray value set corresponds to one gray value serial number; multiplying the number of the gray values corresponding to the gray histogram by a first gray scale ratio corresponding to the first region to obtain a first gray value sequence number, acquiring the gray value corresponding to the first gray value sequence number from the gray value set according to the first gray value sequence number, and taking the gray value corresponding to the first gray value sequence number as a first gray value corresponding to the first region; and multiplying the number of the gray values corresponding to the gray histogram by a second gray scale ratio corresponding to the second region to obtain a second gray value sequence number, acquiring the gray value corresponding to the second gray value sequence number from the gray value set according to the second gray value sequence number, and taking the gray value corresponding to the second gray value sequence number as the second gray value corresponding to the second region.
In one embodiment, the first obtaining module is specifically configured to: acquiring a sensor front image and a sensor back image of the target medium; determining gray value distribution ranges of pixel points in the sensor front image and the sensor back image according to the sensor front image and the sensor back image; and if the gray value distribution ranges of the pixels in the sensor front image and the sensor back image are different from the preset gray value distribution ranges, processing the gray values of the pixels in the sensor front image and the sensor back image to obtain a target front image and a target back image of a target medium, wherein the gray value distribution of the pixels in the target front image and the target back image is in the preset gray value distribution ranges.
In one embodiment, the first obtaining module is specifically configured to: acquiring a front color image, a back color image and a gray level image of a target medium, wherein the front color image and the back color image are shot by a color sensor, and the gray level image is shot by a gray level sensor; obtaining a red value distribution map, a green value distribution map and a blue value distribution map corresponding to the target medium according to the front color image and the back color image; and obtaining a target front image and a target back image of the target medium according to the red value distribution diagram, the green value distribution diagram, the blue value distribution diagram and the distribution information of the pixel values in the gray level image.
In one embodiment, the new and old determining module is specifically configured to: acquiring a plurality of preset new and old level gray scale ranges; comparing the gray level difference value of the first area and the second area with each new and old gray level range to determine the new and old gray level range where the gray level difference value of the first area and the second area is located; and determining whether the target medium is old or new according to the old or new gray scale range of the gray scale difference value of the first area and the second area.
In a third aspect, there is provided a computer device comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of: acquiring a target front image and a target back image of a target medium; obtaining a gray level histogram corresponding to the target medium according to the target front image and the target back image; obtaining a first gray value corresponding to a first region and a second gray value corresponding to a second region according to the gray histogram, wherein the first region and the second region are image regions in the target front image and the target back image, and the gray value of a pixel point in the first region is larger than the gray value of a pixel point in the second region; obtaining a gray level difference value of the first region and the second region according to a first gray level value corresponding to the first region and a second gray level value corresponding to the second region; and determining whether the target medium is old or new according to the gray level difference value of the first area and the second area.
In a fourth aspect, there is provided a computer readable storage medium storing a computer program which, when executed by a processor, causes the processor to perform the steps of: acquiring a target front image and a target back image of a target medium; obtaining a gray level histogram corresponding to the target medium according to the target front image and the target back image; obtaining a first gray value corresponding to a first region and a second gray value corresponding to a second region according to the gray histogram, wherein the first region and the second region are image regions in the target front image and the target back image, and the gray value of a pixel point in the first region is larger than the gray value of a pixel point in the second region; obtaining a gray level difference value of the first region and the second region according to a first gray level value corresponding to the first region and a second gray level value corresponding to the second region; and determining whether the target medium is old or new according to the gray level difference value of the first area and the second area.
The implementation of the embodiment of the invention has the following beneficial effects:
The invention provides a method, a device, computer equipment and a storage medium for determining the new and old of a medium. Because the gray value of the first area is reduced more relative to the gray value of the second area when the medium is older, the judgment on whether the medium is newer or older can be realized based on the gray difference value of the first area and the second area. Further, in the medium image, the first area and the second area may include a plurality of areas, so long as the gray value of the pixel point of the first area is larger than the gray value of the pixel point of the second area, so that even if a certain area in the first area is stained, the influence on the first gray value is not great, the influence on the difference value between the first gray value and the second gray value is not great, and the probability of misjudgment of new and old media is further reduced.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Wherein:
FIG. 1 is a flow chart illustrating an implementation of a method for determining whether a medium is old or new in one embodiment;
FIG. 2 is a schematic view of a first region and a second region in one embodiment;
FIG. 3 is a schematic diagram of a histogram in one embodiment;
FIG. 4 is a schematic flow chart of an implementation of step 102 in one embodiment;
FIG. 5 is a schematic diagram of symmetric clipping and asymmetric clipping in one embodiment;
FIG. 6 is a schematic diagram of a process flow for implementing step 106 in one embodiment;
FIG. 7 is a flow chart illustrating the implementation of step 106B in one embodiment;
FIG. 8 is a schematic diagram of a process flow for implementing step 102 in one embodiment;
FIG. 9 is a graph of R value, G value, and B value for one embodiment;
FIG. 10 is a block diagram of a medium old and new determining device in one embodiment;
FIG. 11 is a block diagram of a computer device in one embodiment.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In an embodiment, a method for determining whether a medium is old or new is provided, and an execution subject of the method for determining whether a medium is old or new in the embodiment of the present invention is a device capable of implementing the method for determining whether a medium is old or new in the embodiment of the present invention, where the device may include, but is not limited to, a financial self-service device and a ticket device, for example, a self-service teller machine. It should be noted that, in order to better describe the embodiments of the present invention, medium "banknote" is taken as an example. As shown in fig. 1, the method for determining whether a medium is old or new according to the embodiment of the present invention specifically includes:
step 102, acquiring a target front image and a target back image of a target medium.
The target medium is the medium to be determined to be new and old. Wherein the media, particularly paper media in the form of sheets, may include, but is not limited to, notes and banknotes.
The target front image is a front image corresponding to the target medium; the target reverse image is a reverse image corresponding to the target medium, as shown in fig. 2.
The financial self-service equipment is provided with an image sensor, the front image and the back image of the medium can be obtained through shooting by the image sensor, the target front image can be obtained according to the front image of the medium shot by the image sensor, and the target back image can be obtained according to the back image of the medium shot by the image sensor.
And 104, obtaining a gray level histogram corresponding to the target medium according to the target front image and the target back image.
The gray histogram is a graph reflecting the statistics of gray values in the gray image, and as shown in fig. 3, the abscissa of the gray histogram is the gray value, and the ordinate is the number of pixels in the gray image, where the pixel value is the gray value.
When the target front image and the target back image are gray images, gray histograms are directly obtained according to the target front image and the target back image. Specifically, if the target front image and the target back image are gray images, determining gray sets corresponding to the target front image and the target back image, wherein the gray sets comprise a plurality of image gray values, and the gray values of the images in the gray sets are different; determining the number of gray values of each image contained in the target front image and the target back image based on the gray set; and generating a gray level histogram corresponding to the target medium according to each image gray level value and the number of each image gray level value.
When the target front image and the target back image are color images, gray images corresponding to the target front image and the target back image are generated, and then gray histograms are determined. Specifically, if the target front image and the target back image are color images, gray images corresponding to the target front image are obtained according to the target front image, gray images corresponding to the target back image are obtained according to the target back image, then a gray set is determined according to the mode, the number of gray values of the images is determined based on the gray set, and finally a gray histogram is obtained.
And 106, obtaining a first gray value corresponding to a first region and a second gray value corresponding to a second region according to the gray histogram, wherein the first region and the second region are image regions in the target front image and the target back image, and the gray value of a pixel point in the first region is larger than the gray value of a pixel point in the second region.
The first gray value corresponding to the first region reflects the gray condition of the first region, for example, if the first gray value is large, each gray value of the first region is relatively large, and the first region is more biased to be white; the second gray value corresponding to the second region reflects the gray condition of the second region, for example, if the second gray value is small, the gray values of the second region are relatively small, and the second region is more black. It should be noted that, in the embodiment of the present invention, as long as the area including at least two pixel points and having a relatively large gray value (specifically, how large the gray value of the pixel point can be set according to actual needs) is regarded as the first area; also, as long as a region including at least two pixel points and having a relatively small gray value of the pixel points (specifically, how small can be set according to actual needs) is regarded as the second region.
As shown in fig. 2, the first area may be an area indicated by a rectangular frame, that is, a highlight area in the image, where the highlight area is displayed in a bright color or white, and as can be seen from fig. 2, the first area may include a plurality of areas; the second area may be an area indicated by a curved frame, i.e. a dark area in the image, which appears darker, black, as can be seen from fig. 2, the second area may also comprise a plurality of areas.
And step 108, obtaining a gray level difference value between the first region and the second region according to the first gray level value corresponding to the first region and the second gray level value corresponding to the second region.
If the first gray value is A and the second gray value is B, the gray difference is A-B.
And 110, determining whether the target medium is old or new according to the gray level difference value of the first area and the second area.
As shown in fig. 3, there is a significant difference between the gray level histogram corresponding to the new bill and the gray level histogram corresponding to the old bill between the highlight region (i.e., the first region, such as the region having a large gray level value in fig. 3) and the dark region (the second region, such as the region having a small gray level value in fig. 3), but the difference between the gray level values of the second region of the new and old bills is not large, but the difference between the gray level values of the first region of the new and old bills is relatively large, so that the judgment of the new and old bills can be realized based on such a difference.
The gray difference value of the first area and the gray difference value of the second area are compared with the preset gray difference value, and if the gray difference value of the first area and the gray difference value of the second area are larger than the preset gray difference value, the target medium is a new medium; if the gray level difference value of the first area and the second area is smaller than or equal to the preset gray level difference value, the target medium is an old medium.
According to the method for determining the medium new and old, firstly, a gray level histogram is generated according to the target front image and the target back image, then, according to the generated gray level histogram, a first gray level value corresponding to the first area and a second gray level value corresponding to the second area are obtained, and finally, the medium new and old is determined based on the difference value of the first gray level value and the second gray level value. Because the gray value of the first area is reduced more relative to the gray value of the second area when the medium is older, the judgment on whether the medium is newer or older can be realized based on the gray difference value of the first area and the second area. Further, in the medium image, the first area and the second area may include a plurality of areas, so long as the gray value of the pixel point of the first area is larger than the gray value of the pixel point of the second area, so that even if a certain area in the first area is stained, the influence on the first gray value is not great, the influence on the difference value between the first gray value and the second gray value is not great, and the probability of misjudgment of new and old media is further reduced.
In one embodiment, considering that the banknote has unfilled corners/edges, the unfilled corners/edges may affect the calculation, and therefore, in order to ensure the calculation accuracy, the media image needs to be cut. As shown in fig. 4, step 102 of acquiring the target front side image and the target back side image of the target medium includes:
Step 102A, acquiring a preliminary front image and a preliminary back image of the target medium.
The primary front image is a front image of the target medium before cutting, for example, the primary front image is a front image of the target medium directly shot by an image sensor in the financial self-service equipment; the preliminary reverse image is a reverse image of the target medium before cutting, for example, the preliminary reverse image is a reverse image of the target medium obtained by direct shooting of an image sensor in the financial self-service equipment.
Step 102B, based on preset clipping information, clipping the preliminary front image and the preliminary back image to obtain a target front image and a target back image of the target medium.
The preset cutting information is preset information for controlling cutting results.
The preset clipping information includes clipping mode, target length and target width. The clipping mode comprises symmetrical clipping and asymmetrical clipping, wherein symmetrical clipping refers to that the image center of a preliminary front image/a preliminary back image (such as black solid circles in fig. 5) coincides with the image center of a target front image/a target back image, such as a left image in fig. 5; asymmetric cropping refers to that the image center of the preliminary front image/preliminary back image is not coincident with the image center of the target front image/target back image, as shown in the right diagram of fig. 5. The target length is the number of pixels in the abscissa direction of the target front image and the target back image obtained after cutting; the target width is the number of pixels in the ordinate direction of the target front image and the target back image obtained after cutting.
In one embodiment, a method of determining a first gray value and a second gray value is provided, wherein the duty ratio of the gray value in the first region/the second region in the target front image and the target back image is predetermined, and then the first gray value and the second gray value are determined according to the predetermined duty ratio. As shown in fig. 6, in step 106, obtaining a first gray value corresponding to the first region and a second gray value corresponding to the second region according to the gray histogram includes:
step 106A, obtaining a first gray scale corresponding to a first area and a second gray scale corresponding to a second area, wherein the first gray scale reflects the proportion of gray values in the first area in the target front image and the target back image, and the second gray scale reflects the proportion of gray values in the second area in the target front image and the target back image.
Wherein the first gray scale is a scale value; the second gray scale is a scale value. The first gray scale ratio is greater than the second gray scale ratio. In practical applications, the first gray scale and the second gray scale may be set according to information such as currency and monetary value.
And 106B, obtaining a first gray value corresponding to the first region and a second gray value corresponding to the second region according to the number of gray values corresponding to the gray histogram, the first gray scale corresponding to the first region and the second gray scale corresponding to the second region.
For the first gray scale, the first gray scale reflects the ratio of the gray values in the first area in the target front image and the target back image, so if the first gray scale is larger, the ratio range of the gray values in the first area in the target front image and the target back image is considered to be small, namely the gray values in the first area are the maximum gray values of the minimum part at the moment, and the first gray values calculated according to the number of the gray values corresponding to the gray histogram and the first gray scale are larger at the moment; if the first gray scale ratio is smaller, the duty ratio range of the gray values in the first area in the target front image and the target back image is considered to be larger, namely, the gray values in the first area are the maximum gray value of the minimum part and the gray value of which a part is smaller than the maximum gray value, and at the moment, the first gray values calculated according to the number of the gray values corresponding to the gray histogram and the first gray scale ratio are relatively smaller.
For the second gray scale, since the second gray scale reflects the ratio of the gray values in the second region in the target front image and the target back image, if the second gray scale is smaller, the ratio range of the gray values in the second region in the target front image and the target back image is considered to be smaller, that is, the gray values in the second region are the minimum part of the minimum gray values at this time, and at this time, the second gray values calculated according to the number of the gray values corresponding to the gray histogram and the second gray scale are smaller; if the second gray scale ratio is larger, the duty ratio range of the gray scale value in the second area in the target front image and the target back image is considered to be larger, namely, the gray scale value in the second area is the minimum gray scale value and the gray scale value of which part is larger than the minimum gray scale value, and at the moment, the second gray scale value calculated according to the number of the gray scale values corresponding to the gray scale histogram and the second gray scale ratio is relatively larger.
In one embodiment, as shown in fig. 7, in step 106B, according to the number of gray values corresponding to the gray histogram, the first gray scale corresponding to the first region, and the second gray scale corresponding to the second region, obtaining the first gray value corresponding to the first region, and the second gray value corresponding to the second region includes:
Step 106B1, arranging the gray values corresponding to the gray histogram in order from small to large, to obtain a gray value set, where each gray value in the gray value set corresponds to a gray value serial number.
For example, the number of gray values A1, A2, and A3 in the gray histogram is 2, and 3, respectively, where A1< A2< A3, the gray value set is { A1, A2, A3}.
Step 106B2, multiplying the number of gray values corresponding to the gray histogram by a first gray scale ratio corresponding to the first region to obtain a first gray value sequence number, obtaining a gray value corresponding to the first gray value sequence number from the gray value set according to the first gray value sequence number, and taking the gray value corresponding to the first gray value sequence number as the first gray value corresponding to the first region.
The number of gray values corresponding to the gray histogram is the same as the number of pixels in the target front image or the target back image, for example, if the image size of the target front image or the target back image is x×y, the number of pixels in the target front image or the target back image is x×y, and then the number of gray values corresponding to the gray histogram is x×y.
The first gray value sequence number is a gray value sequence number calculated according to the first gray scale and is used for determining the first gray value.
For example, when the number of gradation values corresponding to the gradation histogram is 200×100 and the first gradation ratio is 90%, the first gradation value number is 18000, and the gradation value corresponding to the first gradation value number 18000 is obtained from the gradation value set, and if 190 is assumed, 190 is the first gradation value.
Step 106B3, multiplying the number of gray values corresponding to the gray histogram by a second gray scale ratio corresponding to the second region to obtain a second gray value sequence number, obtaining a gray value corresponding to the second gray value sequence number from the gray value set according to the second gray value sequence number and according to the second gray value sequence number, and taking the gray value corresponding to the second gray value sequence number as the second gray value corresponding to the second region.
The second gray value sequence number is a gray value sequence number calculated according to the second gray scale ratio and is used for determining the second gray value.
For example, if the number of gradation values corresponding to the gradation histogram is 200×100 and the second gradation ratio is 10%, the second gradation value number is 2000, and the gradation value corresponding to the second gradation value number 2000 is obtained from the gradation value set, and if it is 50, 50 is regarded as the second gradation value.
Exemplary, in step 106B, the obtaining, according to the number of gray values corresponding to the gray histogram, the first gray scale corresponding to the first region, and the second gray scale corresponding to the second region, the first gray value corresponding to the first region and the second gray value corresponding to the second region includes: the gray values corresponding to the gray histogram are arranged in order from small to large to obtain a gray value set, and each gray value in the gray value set corresponds to one gray value serial number; multiplying the number of the gray values corresponding to the gray histogram by a first gray scale ratio corresponding to the first region to obtain a first gray value sequence number, calculating a first gray average value according to the first gray value sequence number, and taking the first gray average value as a first gray value corresponding to the first region, wherein the first gray average value is an average value of all gray values with the gray value sequence number larger than or equal to the first gray value sequence number in the gray value set; multiplying the number of the gray values corresponding to the gray histogram by a second gray scale ratio corresponding to the second region to obtain a second gray value sequence number, calculating a second gray average value according to the second gray value sequence number, and taking the second gray average value as a second gray value corresponding to the second region, wherein the second gray average value is an average value of all gray values with the gray value sequence number smaller than or equal to the second gray value sequence number in the gray value set.
For example, if the number of gray values corresponding to the gray histogram is 200×100 and the first gray scale ratio is 90%, the first gray scale number is 18000, each gray scale value having a gray scale number greater than or equal to the first gray scale number 18000 is obtained from the gray scale value set, an average value of the gray scale values is calculated, and the calculated average value is used as the first gray scale average value; and if the second gray scale ratio is 10%, the second gray scale number is 2000, each gray scale value with the gray scale number smaller than or equal to the second gray scale number 2000 is obtained from the gray scale value set, the average value of the gray scale values is calculated, and the calculated average value is used as the second gray scale average value.
In one embodiment, the gray values of images acquired by image sensors of the same medium, different brands, models and batches have certain differences, so that when the gray values are determined to have differences, correction on the gray values is required. As shown in fig. 8, step 102 of acquiring a target front image and a target back image of a target medium includes:
step 102a, acquiring a sensor front image and a sensor back image of the target medium.
The front image of the sensor is a front image of a target medium obtained through shooting by an image sensor in the financial self-service equipment; the back image of the sensor is a back image of the target medium obtained through shooting by an image sensor in the financial self-service equipment. The sensor front image and the sensor back image may be color images or gray scale images, and are not particularly limited herein.
Step 102b, determining gray value distribution ranges of pixel points in the sensor front image and the sensor back image according to the sensor front image and the sensor back image.
If the front image of the sensor and the back image of the sensor are both gray images, acquiring a maximum gray value and a minimum gray value in the front image of the sensor; obtaining a maximum gray value and a minimum gray value in a reverse image of a sensor; and obtaining gray value distribution ranges of pixel points in the front image and the back image of the sensor according to the maximum gray value and the minimum gray value in the front image of the sensor and the maximum gray value and the minimum gray value in the back image of the sensor.
For example, the maximum gray value and the minimum gray value in the sensor front image are 220 and 40, and the maximum gray value and the minimum gray value in the sensor back image are 220 and 30, and the gray value distribution range of the pixel points in the sensor front image and the sensor back image is [30, 220].
If the front sensor image and the back sensor image are both color images, converting the front sensor image and the back sensor image into gray images, and then entering the step of acquiring the maximum gray value and the minimum gray value in the front sensor image to obtain a gray value distribution range.
Step 102c, if the gray value distribution ranges of the pixels in the front sensor image and the back sensor image are different from the preset gray value distribution ranges, the gray values of the pixels in the front sensor image and the back sensor image are processed to obtain a front target image and a back target image of the target medium, and the gray values of the pixels in the front target image and the back target image are distributed in the preset gray value distribution ranges.
The preset gray value distribution range is a preset gray value distribution range, for example, the preset gray value distribution range is [0, 255].
Illustratively, the processing the gray values of each pixel point in the front sensor image and the back sensor image in step 102c to obtain the front target image and the back target image of the target medium includes: acquiring a first black reference and a first white reference corresponding to an image sensor for shooting the front image and the back image of the sensor; acquiring a second black reference and a second white reference corresponding to the preset gray value distribution range; and processing gray values of all pixel points in the sensor front image and the sensor back image according to the first black reference, the first white reference, the second black reference and the second white reference to obtain a target front image and a target back image of a target medium.
The black reference and the white reference reflect a lower limit and an upper limit of a gray value of an image captured by an image sensor, for example, if the lower limit and the upper limit of the gray value of the image captured by one image sensor are 30 and 220, respectively, the black reference corresponding to the image sensor is 30 and the white reference is 220, respectively.
And processing gray values of each pixel point in the sensor front image and the sensor back image according to a formula d2= ((d 1-h 1)/(b 1-h 1))× (b 2-h 2), so as to obtain a target front image and a target back image. Where d2 is a gray value obtained after the processing, d1 is a gray value before the processing, h1 is a first black reference, b1 is a first white reference, h2 is a second black reference, and b2 is a second white reference.
For example, a certain gray value d1 is 50, and the first black reference h1, the first white reference b1, the second black reference h2, and the second white reference b2 are respectively: 30. 220, 0 and 255, then d2= ((50-30)/(220-30))× (255-0) =26.8.
Note that, when a certain gray value d1 is a gray value of a noise pixel, the gray value may not be within a range (for example, [30, 220 ]) determined by the first black reference and the first white reference, and in this case, in order to ensure accuracy of the calculation result, if d1 is greater than 220, the value of d1 is updated to 220, and if d1 is less than 30, the value of d1 is updated to 30.
In one embodiment, to obtain a histogram with more gray value distributions to better distinguish between new and old notes, it is necessary to select the appropriate target front image and target back image. Step 102 of acquiring a target front image and a target back image of a target medium includes:
acquiring a front color image, a back color image and a gray level image of a target medium, wherein the front color image and the back color image are shot by a color sensor, and the gray level image is shot by a gray level sensor;
Obtaining a red value distribution map, a green value distribution map and a blue value distribution map corresponding to the target medium according to the front color image and the back color image;
And obtaining a target front image and a target back image of the target medium according to the red value distribution diagram, the green value distribution diagram, the blue value distribution diagram and the distribution information of the pixel values in the gray level image.
Wherein, the red value distribution map is a distribution map of R values in the color image; a green value distribution map which is a distribution map of G values in the color image; the blue value distribution map is a distribution map of B values in a color image. In the distribution chart, the abscissa represents the value of R or G or B, and the ordinate represents the number of the values (specifically, the total number of the values in the front color image and the back color image), such as the red value distribution chart, the green value distribution chart, and the blue value distribution chart shown in fig. 9.
Wherein, the distribution information reflects the distribution condition of the pixel values, and the distribution information can include, but is not limited to, the distribution range of the pixel values and the number of the pixel points.
As shown in fig. 9, the distribution range of the pixel values of the red value distribution map is minimum and the number of the pixel points is small, the distribution range of the pixel values of the green value distribution map is maximum and the number of the pixel points is maximum, and the distribution range of the pixel values of the blue value distribution map is moderate and the number of the pixel points is moderate. Therefore, in order to obtain a histogram with more gray value distribution so that more image information is viewed to better distinguish new and old banknotes, the green value distribution map of the target medium can be selected as the target front image and the target back image of the target medium.
In one embodiment, the new and old grades are classified, so that media with different new and old degrees can be better distinguished. Step 110 of determining whether the target medium is old or new according to the gray level difference between the first area and the second area includes:
acquiring a plurality of preset new and old level gray scale ranges;
Comparing the gray level difference value of the first area and the second area with each new and old gray level range to determine the new and old gray level range where the gray level difference value of the first area and the second area is located;
and determining whether the target medium is old or new according to the old or new gray scale range of the gray scale difference value of the first area and the second area.
The gray scale range of the new and old levels is the gray scale range corresponding to a certain new and old level. The higher the new and old levels are, the larger the gray value in the gray range of the new and old levels where the gray difference value is located is, and the more new the representing medium is; the lower the new and old levels, the smaller the gray value in the gray range of the new and old levels where the gray difference value is, representing the older medium.
For example, the new and old levels of the medium are classified into 5 levels, and the gradation ranges of the new and old levels corresponding to the 5 new and old levels are [0, 100 ], [100, 120 ], [120, 140 ], [140, 160 ], [160, 255), respectively. If the gray difference between the first area and the second area is 110, determining that the gray range of the new and old levels where the gray difference is located is [100, 120), and then obtaining the new and old levels corresponding to the gray range of the new and old levels [100, 120): and 2. Taking the 2 nd level as the new and old judging result of the target medium.
In one embodiment, a red image (including a front red image and a back red image), a blue image (including a front blue image and a back blue image), a green image (including a front green image and a back green image) and a gray image (including a front gray image and a back gray image) obtained by photographing by a gray sensor are respectively taken as a target front image and a target back image of a target medium, the steps are repeated to obtain new and old levels of the target medium corresponding to the red image, the blue image, the green image and the gray image, and the new and old levels of the target medium corresponding to the red image, the blue image, the green image and the gray image are synthesized to determine the new and old of the target medium.
Wherein, the red image, the blue image and the green image are gray images extracted from the color image. Specifically, the red image is a gray image obtained by extracting an R value in a color image; blue-image, which is a gray-scale image obtained by extracting the B value in the color image; green image is a gray image obtained by extracting the G value in the color image.
For example, the new and old level of the target medium corresponding to the red graph is the n1 st level, the new and old level of the target medium corresponding to the blue graph is the n2 nd level, the new and old level of the target medium corresponding to the green graph is the n3 rd level, and the new and old level of the target medium corresponding to the gray graph is the n4 th level, and then the new and old levels of the target medium are: a1×n1+a2×n2+a3×n3+a4×n4, wherein a1+a2+a3+a4=1.
As shown in fig. 10, a device 1000 for determining whether a medium is old or new is provided, which specifically includes:
A first acquiring module 1002, configured to acquire a target front image and a target back image of a target medium;
A histogram module 1004, configured to obtain a gray level histogram corresponding to the target medium according to the target front image and the target back image;
A gray value module 1006, configured to obtain a first gray value corresponding to a first region and a second gray value corresponding to a second region according to the gray histogram, where the first region and the second region are image regions in the target front image and the target back image, and a gray value of a pixel point in the first region is greater than a gray value of a pixel point in the second region;
A gray level difference module 1008, configured to obtain a gray level difference between the first region and the second region according to a first gray level value corresponding to the first region and a second gray level value corresponding to the second region;
And an old and new determining module 1010, configured to determine whether the target medium is old or new according to the gray level difference between the first area and the second area.
According to the device for determining the medium new and old, firstly, a gray level histogram is generated according to the target front image and the target back image, then, a first gray level value corresponding to the first area and a second gray level value corresponding to the second area are obtained according to the generated gray level histogram, and finally, the medium new and old is determined based on the difference value of the first gray level value and the second gray level value. Because the gray value of the first area is reduced more relative to the gray value of the second area when the medium is older, the judgment on whether the medium is newer or older can be realized based on the gray difference value of the first area and the second area. Further, in the medium image, the first area and the second area may include a plurality of areas, so long as the gray value of the pixel point of the first area is larger than the gray value of the pixel point of the second area, so that even if a certain area in the first area is stained, the influence on the first gray value is not great, the influence on the difference value between the first gray value and the second gray value is not great, and the probability of misjudgment of new and old media is further reduced.
In one embodiment, the first obtaining module 1002 is specifically configured to: acquiring a preliminary front image and a preliminary back image of the target medium; and cutting the preliminary front image and the preliminary back image based on preset cutting information to obtain a target front image and a target back image of the target medium.
In one embodiment, the gray value module 1006 is specifically configured to: acquiring a first gray scale corresponding to a first area and a second gray scale corresponding to a second area, wherein the first gray scale reflects the proportion of gray values in the first area in the target front image and the target back image, and the second gray scale reflects the proportion of gray values in the second area in the target front image and the target back image; and obtaining a first gray value corresponding to the first region and a second gray value corresponding to the second region according to the number of gray values corresponding to the gray histogram, the first gray scale corresponding to the first region and the second gray scale corresponding to the second region.
In one embodiment, the gray value module 1006 is specifically configured to: the gray values corresponding to the gray histogram are arranged in order from small to large to obtain a gray value set, and each gray value in the gray value set corresponds to one gray value serial number; multiplying the number of the gray values corresponding to the gray histogram by a first gray scale ratio corresponding to the first region to obtain a first gray value sequence number, acquiring the gray value corresponding to the first gray value sequence number from the gray value set according to the first gray value sequence number, and taking the gray value corresponding to the first gray value sequence number as a first gray value corresponding to the first region; and multiplying the number of the gray values corresponding to the gray histogram by a second gray scale ratio corresponding to the second region to obtain a second gray value sequence number, acquiring the gray value corresponding to the second gray value sequence number from the gray value set according to the second gray value sequence number, and taking the gray value corresponding to the second gray value sequence number as the second gray value corresponding to the second region.
In one embodiment, the first obtaining module 1002 is specifically configured to: acquiring a sensor front image and a sensor back image of the target medium; determining gray value distribution ranges of pixel points in the sensor front image and the sensor back image according to the sensor front image and the sensor back image; and if the gray value distribution ranges of the pixels in the sensor front image and the sensor back image are different from the preset gray value distribution ranges, processing the gray values of the pixels in the sensor front image and the sensor back image to obtain a target front image and a target back image of a target medium, wherein the gray value distribution of the pixels in the target front image and the target back image is in the preset gray value distribution ranges.
In one embodiment, the first obtaining module 1002 is specifically configured to: acquiring a front color image, a back color image and a gray level image of a target medium, wherein the front color image and the back color image are shot by a color sensor, and the gray level image is shot by a gray level sensor; obtaining a red value distribution map, a green value distribution map and a blue value distribution map corresponding to the target medium according to the front color image and the back color image; and obtaining a target front image and a target back image of the target medium according to the red value distribution diagram, the green value distribution diagram, the blue value distribution diagram and the distribution information of the pixel values in the gray level image.
In one embodiment, the new and old determining module 1010 is specifically configured to: acquiring a plurality of preset new and old level gray scale ranges; comparing the gray level difference value of the first area and the second area with each new and old gray level range to determine the new and old gray level range where the gray level difference value of the first area and the second area is located; and determining whether the target medium is old or new according to the old or new gray scale range of the gray scale difference value of the first area and the second area.
FIG. 11 illustrates an internal block diagram of a computer device in one embodiment. The computer device may include, but is not limited to, financial self-service devices and ticketing devices. As shown in fig. 11, the computer device includes a processor, a memory, and a communication interface connected by a system bus. The memory includes a nonvolatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system, and may also store a computer program that, when executed by a processor, causes the processor to implement a method for determining whether a medium is old or new. The internal memory may also store a computer program that, when executed by the processor, causes the processor to perform a method for determining whether a medium is old or new. It will be appreciated by those skilled in the art that the structure shown in FIG. 11 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, the method for determining whether a medium is old or new may be implemented in a form of a computer program, and the computer program may be executed on a computer device as shown in fig. 11. The memory of the computer device may store therein various program templates constituting the medium old and new determining means. Such as a first acquisition module 1002, a histogram module 1004, and a gray value module 1006.
A computer device comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of: acquiring a target front image and a target back image of a target medium; obtaining a gray level histogram corresponding to the target medium according to the target front image and the target back image; obtaining a first gray value corresponding to a first region and a second gray value corresponding to a second region according to the gray histogram, wherein the first region and the second region are image regions in the target front image and the target back image, and the gray value of a pixel point in the first region is larger than the gray value of a pixel point in the second region; obtaining a gray level difference value of the first region and the second region according to a first gray level value corresponding to the first region and a second gray level value corresponding to the second region; and determining whether the target medium is old or new according to the gray level difference value of the first area and the second area.
In one embodiment, the acquiring the target front side image and the target back side image of the target medium includes: acquiring a preliminary front image and a preliminary back image of the target medium; and cutting the preliminary front image and the preliminary back image based on preset cutting information to obtain a target front image and a target back image of the target medium.
In one embodiment, the obtaining, according to the gray histogram, a first gray value corresponding to a first region and a second gray value corresponding to a second region includes: acquiring a first gray scale corresponding to a first area and a second gray scale corresponding to a second area, wherein the first gray scale reflects the proportion of gray values in the first area in the target front image and the target back image, and the second gray scale reflects the proportion of gray values in the second area in the target front image and the target back image; and obtaining a first gray value corresponding to the first region and a second gray value corresponding to the second region according to the number of gray values corresponding to the gray histogram, the first gray scale corresponding to the first region and the second gray scale corresponding to the second region.
In one embodiment, the obtaining the first gray value corresponding to the first region and the second gray value corresponding to the second region according to the number of gray values corresponding to the gray histogram, the first gray scale corresponding to the first region, and the second gray scale corresponding to the second region includes: the gray values corresponding to the gray histogram are arranged in order from small to large to obtain a gray value set, and each gray value in the gray value set corresponds to one gray value serial number; multiplying the number of the gray values corresponding to the gray histogram by a first gray scale ratio corresponding to the first region to obtain a first gray value sequence number, acquiring the gray value corresponding to the first gray value sequence number from the gray value set according to the first gray value sequence number, and taking the gray value corresponding to the first gray value sequence number as a first gray value corresponding to the first region; and multiplying the number of the gray values corresponding to the gray histogram by a second gray scale ratio corresponding to the second region to obtain a second gray value sequence number, acquiring the gray value corresponding to the second gray value sequence number from the gray value set according to the second gray value sequence number, and taking the gray value corresponding to the second gray value sequence number as the second gray value corresponding to the second region.
In one embodiment, the acquiring the target front side image and the target back side image of the target medium includes: acquiring a sensor front image and a sensor back image of the target medium; determining gray value distribution ranges of pixel points in the sensor front image and the sensor back image according to the sensor front image and the sensor back image; and if the gray value distribution ranges of the pixels in the sensor front image and the sensor back image are different from the preset gray value distribution ranges, processing the gray values of the pixels in the sensor front image and the sensor back image to obtain a target front image and a target back image of a target medium, wherein the gray value distribution of the pixels in the target front image and the target back image is in the preset gray value distribution ranges.
In one embodiment, the acquiring the target front side image and the target back side image of the target medium includes: acquiring a front color image, a back color image and a gray level image of a target medium, wherein the front color image and the back color image are shot by a color sensor, and the gray level image is shot by a gray level sensor; obtaining a red value distribution map, a green value distribution map and a blue value distribution map corresponding to the target medium according to the front color image and the back color image; and obtaining a target front image and a target back image of the target medium according to the red value distribution diagram, the green value distribution diagram, the blue value distribution diagram and the distribution information of the pixel values in the gray level image.
In one embodiment, the determining whether the target medium is old or new according to the gray level difference between the first area and the second area includes: acquiring a plurality of preset new and old level gray scale ranges; comparing the gray level difference value of the first area and the second area with each new and old gray level range to determine the new and old gray level range where the gray level difference value of the first area and the second area is located; and determining whether the target medium is old or new according to the old or new gray scale range of the gray scale difference value of the first area and the second area.
In one embodiment, a computer-readable storage medium is provided, storing a computer program which, when executed by a processor, causes the processor to perform the steps of: acquiring a target front image and a target back image of a target medium; obtaining a gray level histogram corresponding to the target medium according to the target front image and the target back image; obtaining a first gray value corresponding to a first region and a second gray value corresponding to a second region according to the gray histogram, wherein the first region and the second region are image regions in the target front image and the target back image, and the gray value of a pixel point in the first region is larger than the gray value of a pixel point in the second region; obtaining a gray level difference value of the first region and the second region according to a first gray level value corresponding to the first region and a second gray level value corresponding to the second region; and determining whether the target medium is old or new according to the gray level difference value of the first area and the second area.
In one embodiment, the acquiring the target front side image and the target back side image of the target medium includes: acquiring a preliminary front image and a preliminary back image of the target medium; and cutting the preliminary front image and the preliminary back image based on preset cutting information to obtain a target front image and a target back image of the target medium.
In one embodiment, the obtaining, according to the gray histogram, a first gray value corresponding to a first region and a second gray value corresponding to a second region includes: acquiring a first gray scale corresponding to a first area and a second gray scale corresponding to a second area, wherein the first gray scale reflects the proportion of gray values in the first area in the target front image and the target back image, and the second gray scale reflects the proportion of gray values in the second area in the target front image and the target back image; and obtaining a first gray value corresponding to the first region and a second gray value corresponding to the second region according to the number of gray values corresponding to the gray histogram, the first gray scale corresponding to the first region and the second gray scale corresponding to the second region.
In one embodiment, the obtaining the first gray value corresponding to the first region and the second gray value corresponding to the second region according to the number of gray values corresponding to the gray histogram, the first gray scale corresponding to the first region, and the second gray scale corresponding to the second region includes: the gray values corresponding to the gray histogram are arranged in order from small to large to obtain a gray value set, and each gray value in the gray value set corresponds to one gray value serial number; multiplying the number of the gray values corresponding to the gray histogram by a first gray scale ratio corresponding to the first region to obtain a first gray value sequence number, acquiring the gray value corresponding to the first gray value sequence number from the gray value set according to the first gray value sequence number, and taking the gray value corresponding to the first gray value sequence number as a first gray value corresponding to the first region; and multiplying the number of the gray values corresponding to the gray histogram by a second gray scale ratio corresponding to the second region to obtain a second gray value sequence number, acquiring the gray value corresponding to the second gray value sequence number from the gray value set according to the second gray value sequence number, and taking the gray value corresponding to the second gray value sequence number as the second gray value corresponding to the second region.
In one embodiment, the acquiring the target front side image and the target back side image of the target medium includes: acquiring a sensor front image and a sensor back image of the target medium; determining gray value distribution ranges of pixel points in the sensor front image and the sensor back image according to the sensor front image and the sensor back image; and if the gray value distribution ranges of the pixels in the sensor front image and the sensor back image are different from the preset gray value distribution ranges, processing the gray values of the pixels in the sensor front image and the sensor back image to obtain a target front image and a target back image of a target medium, wherein the gray value distribution of the pixels in the target front image and the target back image is in the preset gray value distribution ranges.
In one embodiment, the acquiring the target front side image and the target back side image of the target medium includes: acquiring a front color image, a back color image and a gray level image of a target medium, wherein the front color image and the back color image are shot by a color sensor, and the gray level image is shot by a gray level sensor; obtaining a red value distribution map, a green value distribution map and a blue value distribution map corresponding to the target medium according to the front color image and the back color image; and obtaining a target front image and a target back image of the target medium according to the red value distribution diagram, the green value distribution diagram, the blue value distribution diagram and the distribution information of the pixel values in the gray level image.
In one embodiment, the determining whether the target medium is old or new according to the gray level difference between the first area and the second area includes: acquiring a plurality of preset new and old level gray scale ranges; comparing the gray level difference value of the first area and the second area with each new and old gray level range to determine the new and old gray level range where the gray level difference value of the first area and the second area is located; and determining whether the target medium is old or new according to the old or new gray scale range of the gray scale difference value of the first area and the second area.
It should be noted that the above method for determining whether a medium is old or new, the device for determining whether a medium is old or new, the computer device, and the computer readable storage medium belong to a general inventive concept, and the content in the embodiments of the method for determining whether a medium is old or new, the device for determining whether a medium is old or new, the computer device, and the computer readable storage medium may be mutually applicable.
Those skilled in the art will appreciate that all or part of the processes in the methods of the above embodiments may be implemented by a computer program for instructing relevant hardware, where the program may be stored in a non-volatile computer readable storage medium, and where the program, when executed, may include processes in the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.

Claims (7)

1. A method for determining whether a medium is old or new, comprising:
Acquiring a target front image and a target back image of a target medium;
Obtaining a gray level histogram corresponding to the target medium according to the target front image and the target back image;
Obtaining a first gray value corresponding to the first region and a second gray value corresponding to the second region according to the gray histogram, including: acquiring a first gray scale corresponding to a first area and a second gray scale corresponding to a second area, wherein the first gray scale reflects the proportion of gray values in the first area in the target front image and the target back image, and the second gray scale reflects the proportion of gray values in the second area in the target front image and the target back image;
Obtaining the first gray value corresponding to the first region and the second gray value corresponding to the second region according to the number of gray values corresponding to the gray histogram, the first gray scale corresponding to the first region and the second gray scale corresponding to the second region, including:
the gray values corresponding to the gray histogram are arranged in order from small to large to obtain a gray value set, and each gray value in the gray value set corresponds to one gray value serial number;
Multiplying the number of the gray values corresponding to the gray histogram by a first gray scale ratio corresponding to the first region to obtain a first gray value sequence number, calculating a first gray average value according to the first gray value sequence number, and taking the first gray average value as a first gray value corresponding to the first region, wherein the first gray average value is an average value of all gray values with the gray value sequence number larger than or equal to the first gray value sequence number in the gray value set;
Multiplying the number of the gray values corresponding to the gray histogram by a second gray scale ratio corresponding to the second region to obtain a second gray value sequence number, calculating a second gray average value according to the second gray value sequence number, and taking the second gray average value as a second gray value corresponding to the second region, wherein the second gray average value is an average value of all gray values with the gray value sequence number smaller than or equal to the second gray value sequence number in the gray value set;
the first area and the second area are image areas in the target front image and the target back image, and the gray value of the pixel point in the first area is larger than that in the second area;
obtaining a gray level difference value of the first region and the second region according to a first gray level value corresponding to the first region and a second gray level value corresponding to the second region;
and determining whether the target medium is old or new according to the gray level difference value of the first area and the second area.
2. The method of claim 1, wherein the acquiring the target front side image and the target back side image of the target medium comprises:
Acquiring a preliminary front image and a preliminary back image of the target medium;
and cutting the preliminary front image and the preliminary back image based on preset cutting information to obtain a target front image and a target back image of the target medium.
3. The method of claim 1, wherein the acquiring the target front side image and the target back side image of the target medium comprises:
acquiring a sensor front image and a sensor back image of the target medium;
determining gray value distribution ranges of pixel points in the sensor front image and the sensor back image according to the sensor front image and the sensor back image;
And if the gray value distribution ranges of the pixels in the sensor front image and the sensor back image are different from the preset gray value distribution ranges, processing the gray values of the pixels in the sensor front image and the sensor back image to obtain a target front image and a target back image of a target medium, wherein the gray value distribution of the pixels in the target front image and the target back image is in the preset gray value distribution ranges.
4. The method of claim 1, wherein the acquiring the target front side image and the target back side image of the target medium comprises:
acquiring a front color image, a back color image and a gray level image of a target medium, wherein the front color image and the back color image are shot by a color sensor, and the gray level image is shot by a gray level sensor;
Obtaining a red value distribution map, a green value distribution map and a blue value distribution map corresponding to the target medium according to the front color image and the back color image;
And obtaining a target front image and a target back image of the target medium according to the red value distribution diagram, the green value distribution diagram, the blue value distribution diagram and the distribution information of the pixel values in the gray level image.
5. The method of claim 1, wherein the determining the new or old of the target medium based on the gray level difference of the first region and the second region comprises:
acquiring a plurality of preset new and old level gray scale ranges;
Comparing the gray level difference value of the first area and the second area with each new and old gray level range to determine the new and old gray level range where the gray level difference value of the first area and the second area is located;
and determining whether the target medium is old or new according to the old or new gray scale range of the gray scale difference value of the first area and the second area.
6. A computer device comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of the method of determining whether a medium as claimed in any one of claims 1 to 5 is old or new.
7. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor performs the steps of the method for determining whether a medium is old or new according to any one of claims 1 to 5.
CN202010304555.0A 2020-04-17 2020-04-17 Method and device for determining new and old media, computer equipment and storage medium Active CN113269708B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010304555.0A CN113269708B (en) 2020-04-17 2020-04-17 Method and device for determining new and old media, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010304555.0A CN113269708B (en) 2020-04-17 2020-04-17 Method and device for determining new and old media, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113269708A CN113269708A (en) 2021-08-17
CN113269708B true CN113269708B (en) 2024-07-12

Family

ID=77227722

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010304555.0A Active CN113269708B (en) 2020-04-17 2020-04-17 Method and device for determining new and old media, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113269708B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115083066B (en) * 2022-07-20 2022-12-06 恒银金融科技股份有限公司 Method and device for detecting whether paper currency is old or new based on digital image

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102682514A (en) * 2012-05-17 2012-09-19 广州广电运通金融电子股份有限公司 Paper identification method and relative device
CN106355739A (en) * 2016-08-18 2017-01-25 深圳怡化电脑股份有限公司 Method and device for detecting new or old paper money

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0772861B2 (en) * 1990-08-24 1995-08-02 富士ゼロックス株式会社 Program creation device
KR101781009B1 (en) * 2016-08-31 2017-10-23 노틸러스효성 주식회사 Soiled banknote discrimination method
CN106815923A (en) * 2016-12-29 2017-06-09 深圳怡化电脑股份有限公司 A kind of recognition methods of bank note version and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102682514A (en) * 2012-05-17 2012-09-19 广州广电运通金融电子股份有限公司 Paper identification method and relative device
CN106355739A (en) * 2016-08-18 2017-01-25 深圳怡化电脑股份有限公司 Method and device for detecting new or old paper money

Also Published As

Publication number Publication date
CN113269708A (en) 2021-08-17

Similar Documents

Publication Publication Date Title
EP2187359B1 (en) Paper sheet identification device and paper sheet identification method
EP2602771A1 (en) Valuable file identification method and identification system, device thereof
CN107610322B (en) Banknote version identification method and device, electronic equipment and storage medium
CN107016363A (en) Bill images managing device, bill images management system and method
CN104851184A (en) Recognition method of transversely spliced banknote and device thereof
CN106952393B (en) Paper money identification method and device, electronic equipment and storage medium
CN113269708B (en) Method and device for determining new and old media, computer equipment and storage medium
CN107103683A (en) Paper Currency Identification and device, electronic equipment and storage medium
CN113139927A (en) Banknote crack detection method, device, equipment and readable medium
CN105654609A (en) Paper money processing method and paper money processing system
CN112465807A (en) License plate image authenticity identification method, device, equipment and medium
CN106558143A (en) A kind of recognition methodss of 100 yuans of splicings bank note and device
CN113192252B (en) Method, device, equipment and readable medium for detecting note duplicate
CN106599923B (en) Method and device for detecting seal anti-counterfeiting features
JP2001186340A (en) Forgery detecting method
CN108711213B (en) Method and device for identifying black and white blocks of paper money zebra stripes
Aliev et al. Algorithm for choosing the best frame in a video stream in the task of identity document recognition
CN115205882A (en) Intelligent identification and processing method for expense voucher in medical industry
CN108537945B (en) Bill watermark detection method and system and self-service equipment
CN112183454B (en) Image detection method and device, storage medium and terminal
CN108510638B (en) Paper money identification method and device
TWI378406B (en) Method for performing color analysis operation on image corresponding to monetary banknote
US7889885B2 (en) Method for detecting perforations on the edge of an image of a form
CN108346213B (en) Method and device for identifying characteristics of paper money image
CN113077355A (en) Insurance claim settlement method and device, electronic equipment and storage medium

Legal Events

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