Banknote crack detection method and apparatus
10319172 ยท 2019-06-11
Assignee
Inventors
Cpc classification
G07D7/181
PHYSICS
G07D11/237
PHYSICS
G06T7/187
PHYSICS
International classification
G06T7/187
PHYSICS
G07D11/00
PHYSICS
G07D7/181
PHYSICS
Abstract
A banknote crack detection method and a banknote crack detection apparatus are provided. The banknote crack detection apparatus includes an image collection unit, configured to collect an optical transmission image of an inputted banknote, a pre-processing unit, configured to receive a banknote image signal collected by the image collection unit, and perform foreground region positioning and cutting on the banknote image signal; a crack detection unit, configured to detect whether a crack exists; and a determining unit, configured to determine whether the banknote is qualified according to a detection result of the crack detection unit; and a control unit, configured to control operation of each of the above units.
Claims
1. A banknote crack detection method, comprising: inputting a to-be-detected banknote; collecting an optical transmission image of the inputted banknote; detecting a foreground region of the inputted banknote, cutting the foreground region, and placing the foreground region in a pixel coordinate system; determining whether there is a crack at an edge of the foreground region; when it is determined that there is a crack at an edge of the foreground region, accumulating a crack edge length CL and a crack depth CH; determining whether the crack edge length CL is greater than a preset threshold and whether the crack depth CH is greater than the preset threshold, determining that the inputted banknote has a crack and rejecting the inputted banknote in a case that the crack edge length CL is greater than the preset threshold or the crack depth CH is greater than the preset threshold; and receiving, the inputted banknote in a case that the crack edge length CL is not greater than the preset threshold and the crack depth CH is not greater than the preset threshold, wherein determining whether there is a crack at an edge of the foreground region comprises: a first step of performing an initialization setting to set a starting edge point of the crack as P.sub.S, an end edge point of the crack as P.sub.E, a crack width as Cw=0, the crack edge length as Cl=0, and the crack depth as Ch=0; a second step of searching for a crack starting edge point and a crack end edge point in pixels in an edge of the foreground region, and updating P.sub.S=P(x.sub.01, y.sub.01), P.sub.E=P(x.sub.02, y.sub.01), CL=Cl+2 and CH=Ch+1 in a case that points P(x.sub.01, y.sub.01) and P(x.sub.02, y.sub.01) meet:
2. The banknote crack detection method according to claim 1, wherein the determining whether there is a crack at an edge of the foreground region comprises: sequentially determining, for each of adjacent pixel segments of a step length at upper, lower, left and right edges, whether a gray level of each pixel in the pixel segment exceeds a preset gray level threshold, and whether pixel gray gradients at two end points of each of the pixel segments both exceed a preset gradient threshold; and determining that there is a crack at the edges of the foreground region if the gray level of each pixel in each of the pixel segments exceeds the preset gray level threshold and the pixel gray gradients at two end points of each of the pixel segments both exceed the preset gradient threshold, otherwise, determining that there is no crack at the edges of the foreground region.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
(1)
(2)
(3)
(4)
(5)
(6)
(7)
DETAILED DESCRIPTION OF THE EMBODIMENTS
(8) In order to further explain the banknote crack detection apparatus and the banknote crack detection method according to the present disclosure, embodiments will be described in detail with reference to the drawings.
(9) As shown in
(10) As shown in
(11) Principles and steps of the banknote crack detection method are described in detail below.
(12) For the process of imaging a banknote through an optional transmission sensor, there is an energy equation as follows:
E=E.sub.0+E.sub.1+E.sub.2+(formula 1).
(13) E denotes energy of light source, E.sub.0 denotes energy absorbed by a medium, E.sub.1 denotes energy reflected by the medium, E.sub.2 denotes energy passing through the medium and is directly reflected by a gray value of a transmission image, and denotes inherent energy loss of the optical transmission imaging system. If a light passes through a crack, then:
(14)
(15) It is indicated that, in the crack region, energy passing through the medium increases significantly, which is reflected as that an image gray value in the transmission image is close to 255, the entire banknote crack region is presented as a white connected region with a width of one to two pixels, as shown in
(16) 1, an initialization setting is performed as follows. A starting edge point of the crack is set as P.sub.S, an end edge point of the crack is set as P.sub.E, a crack width is set as Cw=0, a crack edge length is set as Cl=0, and a crack depth is set as Ch=0.
(17) 2, the process starts. A banknote is inputted and an optical transmission image of the banknote is collected. A resolution ratio of an image sensor is set to w dpi. Variables CL and CH are respectively set to represent a crack edge length and a crack depth. The collected banknote transmission image is shown in
(18) 3, Image cutting is performed. Foreground region edges are detected and a foreground region is cut, and then the cut foreground region is placed in a pixel coordinate system xoy. And as shown in
(19) 4, the crack detection is performed for an upper edge of the foreground region as follows.
(20) (1) A crack starting edge point and a crack end edge point are searched for in pixels of the upper edge of the foreground region. If points P(x.sub.01, y.sub.01) and P(x.sub.02, y.sub.01) meet:
(21)
P.sub.S=P(x.sub.01, y.sub.01), P.sub.E=P(x.sub.02, y.sub.01), CL=Cl+2 and CH=Ch+1 are updated. In the formula 3, x.sub.02x.sub.011<=2 indicates that a width of the crack region on the foreground region image is no more than 2 pixels, gth max denotes a maximum gray value of an optical transmission image when there is no crack in medium, and is generally set to 200, gth min denotes a minimum gray value of a crack region in the optical transmission image, and is generally set to 250, and P.sub.M denotes a point between P(x.sub.01, y.sub.01) and P(x.sub.02, y.sub.01).
(22) (2) If Cw=1, that is there is one pixel point between P(x.sub.01, y.sub.01) and P(x.sub.02, y.sub.01), then
(23)
(24) 1) If
(25)
then for the crack in the line, the starting point of is updated to P.sub.S=P(x.sub.011, y.sub.01+1), the end point is updated to P.sub.E=P(x.sub.01+1, y.sub.01+1), the crack edge length is updated to CL=Cl+2, the crack depth is updated to CH=Ch+1, the crack width is updated to Cw=1.
(26) 2) If
(27)
then for the crack in the line, the starting point is updated to P.sub.S=P(x.sub.01+1, y.sub.01+1), the end point is updated to P.sub.E=P(x.sub.02+1, y.sub.01+1), the crack edge length is updated to CL=Cl+2, the crack depth is updated to CH=Ch+1, the crack width is updated to Cw=1.
(28) 3) If
(29)
then for the crack in the line, the starting point is updated to P.sub.S=P(x.sub.011, y.sub.01+1), the end point is updated to P.sub.E=P(x.sub.02, y.sub.01+1), the crack edge length is updated to CL=Cl+2, the crack depth is updated to CH=Ch+1, the crack width is updated to Cw=2.
(30) 4) If
(31)
then for the crack in the line, the starting point is updated to P.sub.S=P(x.sub.01, y.sub.01+1), the end point is updated to P.sub.E=P(x.sub.02+1, y.sub.01+1), the crack edge length is updated to CL=Cl+2, the crack depth is updated to CH=Ch+1, the crack width is updated to Cw=2.
(32) (3) If Cw=2, that is there are two pixels between P.sub.S and P.sub.E, then
(33)
(34) 1) If
(35)
then for the crack in the line, the starting point is updated to P.sub.S=P(x.sub.011, y.sub.01+1), the end point is updated to P.sub.E=P(x.sub.01+1, y.sub.01+1), the crack edge length is updated to CL=Cl+2, the crack depth is updated to CH=Ch+1, the crack width is updated to Cw=1.
(36) 2) If
(37)
then for the crack in the line, the starting point is updated to P.sub.S=P(x.sub.01, y.sub.01+1), the end point is updated to P.sub.E=P(x.sub.01+2, y.sub.01+1), the crack edge length is updated to CL=Cl+2, the crack depth is updated to CH=Ch+1, the crack width is updated to Cw=1.
(38) 3) If
(39)
then for the crack in the line, the starting point is updated to P.sub.S=P(x.sub.01+1, y.sub.01+1), the end point is updated to P.sub.E=P(x.sub.01+3, y.sub.01+1), the crack edge length is updated to CL=Cl+2, the crack depth is updated to CH=Ch+1, the crack width is updated to Cw=1.
(40) 4) If
(41)
then for the crack in the line, the starting point is updated to P.sub.S=P(x.sub.01+2, y.sub.01+1), the end point is updated to P.sub.E=P(x.sub.02+1, y.sub.01+1), the crack edge length is updated to CL=Cl+2, the crack depth is updated to CH=Ch+1, the crack width is updated to Cw=1.
(42) 5) If
(43)
then for the crack in the line, the starting point is updated to P.sub.S=P(x.sub.011, y.sub.01+1), the end point is updated to P.sub.E=P(x.sub.01+2, y.sub.01+1), the crack edge length is updated to CL=Cl+2, the crack depth is updated to CH=Ch+1, the crack width is updated to Cw=2.
(44) 6) If
(45)
then for the crack in the line, the starting point is updated to P.sub.S=P(x.sub.01, y.sub.01+1), the end point is updated to P.sub.E=P(x.sub.01+3, y.sub.01+1), the crack edge length is updated to CL=Cl+2, the crack depth is updated to CH=Ch+1, the crack width is updated to Cw=2.
(46) 7) If
(47)
then for the crack in the line, the starting point is updated to P.sub.S=P(x.sub.01+1, y.sub.01+1), the end point is updated to P.sub.E=P(x.sub.02+1, y.sub.01+1), the crack edge length is updated to CL=Cl+2, the crack depth is updated to CH=Ch+1, the crack width is updated to Cw=2.
(48) In other cases, it is determined that the crack does not extend to the line and the crack detection ends.
(49) (4) An iterative computation is performed. If Cw=1, step (2) is performed repeatedly, and if Cw=2, step (3) is performed repeatedly, until a complete detection for a crack is finished.
(50) If CH>CHth or CL>CLth, that is CH is greater than a preset depth threshold, or CL is greater than a preset length threshold, the inputted banknote is rejected, otherwise, the inputted banknote is received.
(51) For a crack at a left edge, a right edge or a lower edge of the inputted banknote, a similar search method may be performed to detect the crack edge length and width. A final determination is made to receive or reject the inputted banknote, which is described herein.
(52) The banknote crack detection method according to the present disclosure is based on an imaging principle of a banknote optical transmission image. The gray level of the banknote transmission image is closely related to an intensity of a sensor light source and light transmittance of the banknote. In a case that the intensity of the light source is constant, there is a huge difference between a transmittance of a crack region and a transmittance of a non-crack region. Furthermore, image gray levels in the crack region are the same, and thus the crack region is expressed as a connected region starting from an edge of the banknote where gray levels of all pixel points are close to 255. If the above connected region exists on the banknote transmission image, whether to reject or receive the banknote can be determined by calculating an edge length and a depth of the connected region and comparing them with the preset threshold.
(53) The above description is only preferred embodiments of the present disclosure. It should be noted that, the above preferred embodiments should not be understood as a limitation to the present disclosure, and the scope of the present disclosure is defined by the claims of the present disclosure. For the person skilled in the art, several improvements and modifications may be made to the present disclosure without departing from the spirit and scope of the present disclosure, and these improvements and modifications also fall into the scope of the present disclosure.