Banknote crack detection method, device, equipment and readable medium
Through the smoothing and binarization of the paper currency transmission image, combined with the information of the connecting domain and the offset image area, the problems of high environmental requirements and low accuracy in the prior art are solved, and the accuracy of paper currency crack detection and efficiency.
Patent Information
- Application Number
- CN202010000429.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-01-02
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2040-01-02
AI Technical Summary
The prior art has high environmental requirements and low accuracy in banknote crack detection, resulting in high detection difficulty and high error detection rate.
By smoothing and binarizing the transmissive image of the banknote to be detected, the communication domain information is determined, and whether there is a crack is judged based on the communication domain width and length threshold, and further judgment is made based on the grayscale information and projection information of the offset image area.
It reduces the difficulty of detection, improves the accuracy and efficiency of banknote crack detection, and reduces the false detection rate.
Smart Images

Figure CN113139927B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing and recognition technology, and in particular to a banknote crack detection method, device, equipment and readable medium. Background Art
[0002] The widespread use of cash self-service equipment has put forward higher and higher requirements for banknote processing technology, especially the detection of banknote circulation. As a type of non-compliant banknotes that is likely to cause equipment jams, the detection of torn banknotes is also an important part of the detection of non-circulating banknotes. This requires cash self-service equipment and other various banknote-entering equipment to identify torn banknotes to further determine whether to accept the banknotes or judge them as non-circulating banknotes and enter the waste banknote box.
[0003] In the prior art, the detection of torn banknotes usually involves detecting whether there is a connected domain with edge pixel grayscale close to 255 (i.e., the grayscale limit) in the transmission image of the banknote, and then comparing the edge length and depth of the existing connected domain with a preset threshold, so as to determine whether the connected domain contained in the banknote corresponds to a crack.
[0004] The defect of the above method is that in order to make the existing crack area appear as a connected domain with a grayscale close to 255, the optical environment for acquiring the transmission image is very demanding. At the same time, judging whether the pixel value at the edge of the banknote meets the grayscale condition will cause the existence of tears inside the banknote to be missed. All these make the detection of banknote cracks difficult and the accuracy is low. Summary of the invention
[0005] Based on this, it is necessary to propose a banknote crack detection method, device, computer equipment and readable medium to address the above problems.
[0006] A banknote crack detection method, characterized in that the method comprises:
[0007] Acquire a transmission image of the banknote to be detected as a target image to be detected, and perform smoothing processing on the target image to be detected to obtain a target smoothed image;
[0008] Binarizing the target smoothed image to obtain a target binary image, and determining connected domain information of the target binary image;
[0009] Determine whether there is a crack in the banknote to be detected according to the connected domain information.
[0010] The step of smoothing the target image to be detected includes:
[0011] Determine a target detection direction, wherein the target detection direction includes a horizontal direction and a vertical direction;
[0012] Performing edge detection on the target image to be detected in the target detection direction according to a preset convolution kernel algorithm to determine edge pixel points of the target image to be detected;
[0013] The grayscale values of other pixels in the target image to be detected except the edge pixels are set to preset grayscale values.
[0014] Furthermore, the connected domain information includes a connected domain width and a connected domain length of at least one connected domain;
[0015] The step of judging whether there is a crack in the banknote to be detected according to the connected domain information includes:
[0016] For each connected domain, determining whether a connected domain width of the connected domain satisfies a preset width threshold, and / or whether a connected domain length of the connected domain satisfies a preset length threshold;
[0017] When the width of the connected domain without the connected domain satisfies the preset width threshold and the length of the connected domain without the connected domain satisfies the preset length threshold, it is determined that there is no crack in the banknote to be detected;
[0018] When there is a connected domain whose width satisfies a preset width threshold and / or whose length satisfies a preset length threshold, an image region corresponding to the connected domain in the target image to be detected is obtained as a first target region.
[0019] After the step of obtaining the image area corresponding to the connected domain in the target image to be detected as the first target area, the method further includes:
[0020] Determine edge coordinates of the first target area, where the edge coordinates include edge coordinates corresponding to at least three directions of top, bottom, left and / or right of the first target area;
[0021] Determine an offset image region of the first target region in the target image to be detected according to the edge coordinates and a preset number of offset pixels;
[0022] The grayscale information of the offset image area is obtained as target grayscale information, and whether there is a crack in the banknote to be detected is determined according to the target grayscale information.
[0023] The step of judging whether there is a crack in the banknote to be detected according to the target grayscale information includes:
[0024] Determine a grayscale value mean of a preset proportion of pixel points in the offset image area according to the target grayscale information, and determine a first grayscale mean according to the grayscale mean;
[0025] Acquire the number of pixel points whose grayscale values in the first target area are greater than the first grayscale mean as the target pixel point number;
[0026] Determining whether the target pixel count matches the preset width threshold and / or whether the target pixel count matches the preset length threshold;
[0027] When the target pixel number does not match the preset width threshold and the preset length threshold, it is determined that there is no crack in the banknote to be detected;
[0028] When the target pixel count matches the preset width threshold and / or the preset length threshold, the projection information of the target image to be detected in the offset image area is obtained as the target projection information, and it is determined whether there is a crack in the banknote to be detected based on the target projection information.
[0029] Furthermore, the target projection information includes projection information of the target image to be detected in the offset image area in the target detection direction;
[0030] The step of judging whether there is a crack in the banknote to be detected according to the target projection information comprises:
[0031] Determine, according to the target projection information, the coordinate information corresponding to the maximum projection value in the target detection direction;
[0032] Determining whether the coordinate information matches the edge coordinates in the first target area adjacent to the target detection direction;
[0033] When the coordinate information matches the edge coordinates in the first target area adjacent to the target detection direction, it is determined that there is a crack in the banknote to be detected; when the coordinate information does not match the edge coordinates in the first target area adjacent to the target detection direction, it is determined that there is no crack in the banknote to be detected.
[0034] The step of determining the preset width threshold and the preset length threshold comprises:
[0035] Obtaining the number of pixels contained in a preset length of the target image to be detected in the target detection direction;
[0036] The width threshold and the length threshold are determined according to the number of pixels.
[0037] A banknote crack detection device, characterized in that the device comprises:
[0038] An acquisition unit is used to acquire a transmission image of the banknote to be detected as a target image to be detected, and to perform smoothing processing on the target image to be detected to obtain a target smoothed image;
[0039] Processing unit: used for performing binarization processing on the target smoothed image to obtain a target binary image, and determining the connected domain information of the target binary image;
[0040] A judgment unit is used to determine whether there is a crack in the banknote to be detected according to the connected domain information.
[0041] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following steps:
[0042] Acquire a transmission image of the banknote to be detected as a target image to be detected, and perform smoothing processing on the target image to be detected to obtain a target smoothed image;
[0043] Binarizing the target smoothed image to obtain a target binary image, and determining connected domain information of the target binary image;
[0044] Determine whether there is a crack in the banknote to be detected according to the connected domain information.
[0045] A computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the following steps:
[0046] Acquire a transmission image of the banknote to be detected as a target image to be detected, and perform smoothing processing on the target image to be detected to obtain a target smoothed image;
[0047] Binarizing the target smoothed image to obtain a target binary image, and determining connected domain information of the target binary image;
[0048] Determine whether there is a crack in the banknote to be detected according to the connected domain information.
[0049] In an embodiment of the present invention, a transmission image of a banknote to be inspected is first obtained as a target image to be inspected, and a smoothing process including edge detection is performed on the target image to be inspected to obtain a target smoothed image. The target smoothed image is then binarized to obtain a target binary image, and connected domain information of the target binary image is determined. Based on the connected domain information, it is judged whether there are cracks in the banknote to be inspected.
[0050] Therefore, compared with the high environmental requirements for crack detection in the prior art, which results in great detection difficulty and low efficiency, as well as a high false detection rate when detecting only based on the connected domain at the edge of the banknote, the present invention reduces the difficulty of subsequent detection by first smoothing the transmission image of the banknote to be detected, and also performs crack detection based on the connected domain inside the banknote image, thereby improving the accuracy and efficiency of detecting cracks in the banknote. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0052] in:
[0053] Figure 1 A flow chart of a banknote crack detection method in one embodiment is shown;
[0054] Figure 2 A flow chart showing a smoothing process for a target image to be detected in one embodiment is shown;
[0055] Figure 3 A flow chart of determining whether there is a crack in the banknote to be detected according to the connected domain information in one embodiment is shown;
[0056] Figure 4 A flow chart of determining a preset width threshold and a preset length threshold in one embodiment is shown;
[0057] Figure 5 A flow chart for determining an offset image region in one embodiment is shown;
[0058] Figure 6 A flow chart of determining whether there is a crack in the banknote to be detected according to the target grayscale information in one embodiment is shown;
[0059] Figure 7 A flow chart of determining whether there is a crack in the banknote to be inspected according to the target projection information in one embodiment is shown;
[0060] Figure 8 A structural block diagram of a banknote crack detection device in one embodiment is shown;
[0061] Fig. 9 The figure shows the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0062] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0063] The present invention proposes a method for detecting cracks in banknotes. In one embodiment, the present invention can be based on a computer processing device such as a smart phone, a PC, etc. Specifically, it can be based on an ATM machine, a banknote detector, etc.
[0064] refer to Figure 1 , an embodiment of the present invention provides a method for detecting cracks in banknotes.
[0065] Figure 1 FIG. 1 is a flow chart showing a method for detecting cracks in banknotes in one embodiment. The method for detecting cracks in banknotes in the present invention at least comprises the following steps: Figure 1 Steps S1022-S1026 shown are described in detail as follows:
[0066] In step S1022, a transmission image of the banknote to be detected is obtained as a target image to be detected, and a smoothing process is performed on the target image to be detected to obtain a target smoothed image.
[0067] The banknotes to be detected here can be banknotes of various types (such as denominations and currencies), and their transmission images can be infrared transmission images or visible light transmission images. The reason for obtaining transmission images is that under strong infrared and visible light irradiation, the grayscale information is more obvious. The purpose of smoothing is to further remove the background noise in the transmission image and make the image features more obvious.
[0068] Specifically, the smoothing process in this step may also include at least Figure 2 Steps S1032-S1036 are shown. Figure 2 A flow chart of smoothing a target image to be detected in one embodiment is shown.
[0069] In step S1032, the target detection direction is determined, and the target detection direction includes horizontal and vertical directions.
[0070] Based on the imaging principle of the optical transmission image of banknotes, when there are cracks in the banknotes (the cracks are often in a quasi-horizontal or quasi-vertical direction), the light transmittance effect between the crack area and the non-crack area in its optical transmission image is very different. It is usually manifested as the grayscale of the crack area image is bright and concentrated, which contrasts with the uniform low brightness of the non-crack area image, forming certain quasi-vertical or quasi-horizontal "highlight lines".
[0071] Therefore, the cracks that may exist in the banknote can be determined based on the connected domains in the transmission image of the banknote to be detected that have a grayscale distribution different from the surrounding and the whole. The specific determination process will be explained below.
[0072] In step S1034, edge detection is performed on the target image to be detected in the target detection direction according to a preset convolution kernel algorithm to determine edge pixel points of the target image to be detected;.
[0073] First, the principle and purpose of edge detection are explained: edge detection is a research field in image processing and computer vision, especially in feature extraction. It is used to identify points in digital images where brightness changes significantly. This is because significant changes in image attributes usually reflect important events and changes in attributes, such as discontinuities in depth, discontinuities in surface orientation, changes in material properties, etc. Edge detection of images can greatly reduce the amount of data and eliminate information that can be identified as irrelevant, while retaining important structural properties of the image.
[0074] In combination with the embodiments of the present invention, that is, in order to make the "highlight lines" (that is, the image area with a grayscale value very large and close to 255) corresponding to the potential cracks more prominent, grayscale detection can be performed on the connected domain in the entire image area to be detected, thereby weakening the background image outside the connected domain corresponding to the cracks.
[0075] In a specific embodiment, the banknote to be inspected may be illuminated by visible light or infrared light to obtain an image to be inspected, and then the image to be inspected is smoothed according to a 3x3 convolution kernel of a Prewitt operator to highlight the edge of the crack area.
[0076] The Prewitt operator is a first-order differential operator, which uses the grayscale difference of the upper, lower, left, and right neighboring points of a pixel point, and uses two directional templates to perform neighborhood convolution with the image in the image space, so as to detect the edge at the extreme value at the edge and smooth the noise. In an optional embodiment, operators such as Roberts Cross operator, Sobel operator, Canny operator, and Krisch operator can also be used.
[0077] In an embodiment of crack detection in the longitudinal direction, a 3x3 convolution kernel in the vertical direction may be selected: [-1, 0, 1, -1, 0, 1, -1, 0, 1].
[0078] In step S1036, the grayscale values of the pixels other than the edge pixels in the target image to be detected are set to preset grayscale values.
[0079] Specifically, the grayscale values of pixels around the four sides of the image can be set to 0 (corresponding to the black color of the background, thereby highlighting the crack area with a larger grayscale value that is close to white).
[0080] In step S1024, the target smoothed image is binarized to obtain a target binary image, and connected domain information of the target binary image is determined.
[0081] Optionally, a suitable binarization threshold may be first determined here, such as processing the grayscale value of pixels with a grayscale value less than 40 or 50 to 0 (ie, black), and correspondingly processing the grayscale value of pixels with a grayscale value greater than 40 or 50 to 255 (ie, white).
[0082] The connected domain information here may include the connected domain width and connected domain length corresponding to at least one connected domain included in the target binary image, that is, the horizontal and vertical size information of a connected domain (the maximum number of pixels included in two mutually perpendicular directions).
[0083] In step S1026, it is determined whether there is a crack in the banknote to be inspected based on the connected domain information.
[0084] Specifically, crack determination may be performed based on the matching result between the width and length of the connected domain and the corresponding width threshold and length threshold.
[0085] Specifically, step S1026 may also include: Figure 3 Steps S1042-S1046 are shown. Figure 3 A flow chart of determining whether there is a crack in the banknote to be detected according to the connected domain information in one embodiment is shown.
[0086] In step S1042, for each connected domain, it is determined whether the connected domain width of the connected domain satisfies a preset width threshold and / or whether the connected domain length of the connected domain satisfies a preset length threshold.
[0087] It should be noted that, in an optional embodiment, the step of determining the preset width threshold and the preset length threshold may include: Figure 4 Steps S1052-S1054 are shown. Figure 4 A flow chart of determining a preset width threshold and a preset length threshold in one embodiment is shown.
[0088] In step S1052, the number of pixels contained in a preset length of the target image to be detected in the target detection direction is obtained.
[0089] In step S1054, the width threshold and the length threshold are determined according to the number of pixels.
[0090] With reference to a specific embodiment, when the target detection direction is vertical, the preset width threshold here can be 2 pixels, and the length threshold can be set to the number of pixels corresponding to the 3mm length (i.e., the preset length in step S1052) in the target image.
[0091] The advantage of this setting is that, taking into account that banknotes may have creases and scratches during actual use, and that the material of the banknote itself has certain line characteristics, only connected domains whose sizes are within the range of the width threshold and length threshold here are identified as possible cracks, and targeted detection is continued in subsequent steps, so that connected domains with too small an area are regarded as non-crack noise existing in the banknote itself and are filtered out.
[0092] In step S1044, when the width of the connected domain without the connected domain satisfies the preset width threshold and the length of the connected domain without the connected domain satisfies the preset length threshold, it is determined that there is no crack in the banknote to be detected.
[0093] That is to say, when the sizes of all connected domains in the banknote to be detected are smaller than (ie, do not meet) the preset threshold, it is determined that there is no connected domain that can be determined as a crack in the banknote to be detected.
[0094] In step S1046, when there is a connected domain whose width satisfies a preset width threshold and / or whose length satisfies a preset length threshold, an image area corresponding to the connected domain in the target image to be detected is obtained as a first target area.
[0095] Further, after determining the first target area that meets the preset length / width threshold, the following steps may be performed: Figure 5 Steps S1062-S1066 are shown. Figure 5 A flow chart for determining an offset image region in one embodiment is shown.
[0096] In step S1062, edge coordinates of the first target area are determined, where the edge coordinates include edge coordinates corresponding to at least three directions of top, bottom, left and / or right of the first target area.
[0097] That is to say, for a connected domain whose size satisfies the aforementioned length threshold and width threshold, it is taken as the first target area and recorded as DomainRect. The edge coordinates corresponding to at least three directions of top, bottom, left and / or right can be recorded as DomainRect.top, DomainRect.bottom, DomainRect.left and DomainRect.right respectively.
[0098] In step S1064, the offset image region of the first target region in the target image to be detected is determined according to the edge coordinates and a preset number of offset pixels.
[0099] Correspondingly, the offset image area here is recorded as OffsetRect, and the edge coordinates corresponding to at least three directions of top, bottom, left and / or right are recorded as OffsetRect.top, OffsetRect.bottom, OffsetRect.left and OffsetRect.right respectively.
[0100] The specific process of determining the offset image area can be as follows:
[0101] OffsetRect.top=DomainRect.top;
[0102] OffsetRect.left=DomainRect.left-XOffset;
[0103] OffsetRect.right=DomainRect.right+XOffset;
[0104] OffsetRect.bottom=DomainRect.bottom;
[0105] Here, XOffSet is an average offset value, which can be set according to the needs of crack detection in different application scenarios. In a specific embodiment, it can be set to the number of pixels in an image with a length of 2 cm.
[0106] In step S1066, the grayscale information of the offset image area is obtained as target grayscale information, and it is determined whether there is a crack in the banknote to be inspected based on the target grayscale information.
[0107] Furthermore, step S1066 may include the following steps: Figure 6 Steps S1072-S10710 are shown. Figure 6 A flow chart of determining whether there is a crack in the banknote to be inspected according to the target grayscale information in one embodiment is shown.
[0108] In step S1072, a grayscale mean of a preset proportion of pixels in the offset image area is determined according to the target grayscale information, and a first grayscale mean is determined according to the grayscale mean.
[0109] First, the target grayscale information here can specifically be a grayscale histogram of the offset image area, and the preset ratio can be 50%-70% of the pixels in the offset image area. The mean grayscale value of these pixels is calculated, and considering the differences in the grayscale mean levels of the transmission images of banknotes in different acquisition environments, appropriate additions and subtractions can be made on the basis of the above-mentioned grayscale value mean to determine the first grayscale mean here.
[0110] In step S1074, the number of pixel points in the first target area whose grayscale values are greater than the first grayscale mean is obtained as the target pixel number.
[0111] In step S1076, it is determined whether the target pixel count matches the preset width threshold and / or whether the target pixel count matches the preset length threshold.
[0112] Specifically, whether there is a match here refers to whether the number of target pixels is greater than the number of pixels corresponding to the preset width threshold and length threshold respectively.
[0113] In step S1078, when the target pixel number does not match the preset width threshold and the preset length threshold, it is determined that there is no crack in the banknote to be detected.
[0114] In step S10710, when the target pixel count matches the preset width threshold and / or the preset length threshold, the projection information of the target image to be detected in the offset image area is obtained as target projection information, and it is determined whether there is a crack in the banknote to be detected based on the target projection information.
[0115] Specifically, the process of determining according to the target projection information and judging according to the target projection information whether there is a crack in the banknote to be detected may include: Figure 7 Steps S1082-S1086 are shown. Figure 7 A flow chart of determining whether there is a crack in the banknote to be inspected according to the target projection information in one embodiment is shown.
[0116] In step S1082, coordinate information corresponding to the maximum projection value in the target detection direction is determined according to the target projection information.
[0117] First, the target projection information here includes the projection information of the target image to be detected in the offset image area in the target detection direction. Specifically, when the target detection direction is vertical, the column projection of the target detection image in the aforementioned offset image area is calculated here.
[0118] What is determined here is the column coordinates of the maximum column projection, recorded as MaxPos.
[0119] In step S1084, it is determined whether the coordinate information matches the edge coordinates in the first target area adjacent to the target detection direction.
[0120] The specific judgment process can be as follows: when DomainRect.left<MaxPos<DomainRect.right, it is judged that the banknote has cracks, otherwise it is judged as a banknote without cracks.
[0121] In step S1086, when the coordinate information matches the edge coordinates in the first target area adjacent to the target detection direction, it is determined that there is a crack in the banknote to be detected; when the coordinate information does not match the edge coordinates in the first target area adjacent to the target detection direction, it is determined that there is no crack in the banknote to be detected.
[0122] Finally, it should be noted that if the purpose is to detect horizontal cracks in banknotes, the corresponding approach is similar, except that the change is from vertical to horizontal. For example, the convolution kernel in step S1034 is changed to [-1, -1, -1, 0, 0, 0, 1, 1, 1], and the height threshold corresponding to the horizontal crack detection is set to 2 pixels, and the width threshold is set to the number of pixels in the image 3 mm in length.
[0123] Figure 8 A structural block diagram of a banknote crack detection device in one embodiment is shown.
[0124] refer to Figure 8 As shown, a banknote crack detection device 1090 according to an embodiment of the present invention includes: an acquisition unit 1092, a processing unit 1094, and a judgment unit 1096.
[0125] The acquisition unit 1092 is used to acquire a transmission image of the banknote to be detected as a target image to be detected, and perform smoothing processing on the target image to be detected to obtain a target smoothed image;
[0126] Processing unit 1094: configured to perform binarization processing on the target smoothed image to obtain a target binary image, and determine connected domain information of the target binary image;
[0127] The judgment unit 1096 is used to determine whether there is a crack in the banknote to be detected according to the connected domain information.
[0128] Fig. 9 FIG. 1 shows an internal structure diagram of a computer device in an embodiment. The computer device may be a terminal or a server. Fig. 9As shown, the computer device includes a processor, a memory, a processing module, an acquisition module and a communication module connected via a system bus. Among them, the memory includes a non-volatile 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. When the computer program is executed by the processor, the processor can implement the banknote crack detection method. The internal memory may also store a computer program. When the computer program is executed by the processor, the processor can execute the banknote crack detection method. Those skilled in the art can understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0129] In one embodiment, a computer device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following steps:
[0130] Acquire a transmission image of the banknote to be detected as a target image to be detected, and perform smoothing processing on the target image to be detected to obtain a target smoothed image;
[0131] Binarizing the target smoothed image to obtain a target binary image, and determining connected domain information of the target binary image;
[0132] Determine whether there is a crack in the banknote to be detected according to the connected domain information.
[0133] In one embodiment, a computer-readable storage medium is provided, storing a computer program, wherein when the computer program is executed by a processor, the processor performs the following steps:
[0134] Acquire a transmission image of the banknote to be detected as a target image to be detected, and perform smoothing processing on the target image to be detected to obtain a target smoothed image;
[0135] Binarizing the target smoothed image to obtain a target binary image, and determining connected domain information of the target binary image;
[0136] Determine whether there is a crack in the banknote to be detected according to the connected domain information.
[0137] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many 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).
[0138] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0139] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A banknote crack detection method, characterized in that: The method comprises: Acquire a transmission image of the banknote to be detected as a target image to be detected, and perform smoothing processing on the target image to be detected to obtain a target smoothed image; Binarizing the target smoothed image to obtain a target binary image, and determining connected domain information of the target binary image, wherein the connected domain information includes a connected domain width and a connected domain length of at least one connected domain; Determining whether there is a crack in the banknote to be detected according to the connected domain information; The determining whether there is a crack in the banknote to be detected based on the connected domain information includes: for each connected domain, determining whether the connected domain width of the connected domain satisfies a preset width threshold and / or whether the connected domain length of the connected domain satisfies a preset length threshold; if the connected domain width of the non-connected domain satisfies the preset width threshold and the connected domain length of the non-connected domain satisfies the preset length threshold, determining that there is no crack in the banknote to be detected; if the connected domain width of the connected domain satisfies the preset width threshold and / or the connected domain length of the connected domain satisfies the preset length threshold, obtaining an image area corresponding to the connected domain in the target image to be detected as a first target area, and the first target area is used to continue determining whether there is a crack in the banknote to be detected; The step of determining the preset width threshold and the preset length threshold includes: obtaining the number of pixels contained in the preset length of the target image to be detected in the target detection direction; and determining the width threshold and the length threshold according to the number of pixels.
2. The method according to claim 1, characterized in that The step of smoothing the target image to be detected comprises: Determine a target detection direction, wherein the target detection direction includes a horizontal direction and a vertical direction; Performing edge detection on the target image to be detected in the target detection direction according to a preset convolution kernel algorithm to determine edge pixel points of the target image to be detected; The grayscale values of other pixels in the target image to be detected except the edge pixels are set to preset grayscale values.
3. The method according to claim 1, characterized in that After the step of obtaining the image area corresponding to the connected domain in the target image to be detected as the first target area, the method further includes: Determine edge coordinates of the first target area, where the edge coordinates include edge coordinates corresponding to at least three directions of top, bottom, left and / or right of the first target area; Determine an offset image region of the first target region in the target image to be detected according to the edge coordinates and a preset number of offset pixels; The grayscale information of the offset image area is obtained as target grayscale information, and whether there is a crack in the banknote to be detected is determined according to the target grayscale information.
4. The method according to claim 3, characterized in that The step of judging whether there is a crack in the banknote to be detected according to the target grayscale information includes: Determine a grayscale value mean of a preset proportion of pixel points in the offset image area according to the target grayscale information, and determine a first grayscale mean according to the grayscale mean; Acquire the number of pixel points whose grayscale values are greater than the first grayscale mean in the first target area as the target pixel point number; Determining whether the target pixel count matches the preset width threshold and / or whether the target pixel count matches the preset length threshold; When the target pixel number does not match the preset width threshold and the preset length threshold, it is determined that there is no crack in the banknote to be detected; When the target pixel count matches the preset width threshold and / or the preset length threshold, the projection information of the target image to be detected in the offset image area is obtained as the target projection information, and it is determined whether there is a crack in the banknote to be detected based on the target projection information.
5. The method according to claim 4, wherein the target projection information comprises projection information of the target image to be detected in the offset image area in the target detection direction; The step of judging whether there is a crack in the banknote to be detected according to the target projection information comprises: Determine, according to the target projection information, coordinate information corresponding to the maximum projection value in the target detection direction; Determining whether the coordinate information matches the edge coordinates in the first target area adjacent to the target detection direction; When the coordinate information matches the edge coordinates in the first target area adjacent to the target detection direction, it is determined that there is a crack in the banknote to be detected; when the coordinate information does not match the edge coordinates in the first target area adjacent to the target detection direction, it is determined that there is no crack in the banknote to be detected.
6. A banknote crack detection device, characterized in that: The device comprises: An acquisition unit is used to acquire a transmission image of the banknote to be detected as a target image to be detected, and to perform smoothing processing on the target image to be detected to obtain a target smoothed image; Processing unit: used for performing binarization processing on the target smoothed image to obtain a target binary image, and determining the connected domain information of the target binary image; A judgment unit: used for determining whether there is a crack in the banknote to be detected according to the connected domain information; The judging unit is further used for: for each connected domain, judging whether the connected domain width of the connected domain satisfies a preset width threshold and / or whether the connected domain length of the connected domain satisfies a preset length threshold; if the connected domain width of the non-connected domain satisfies the preset width threshold and the connected domain length of the non-connected domain satisfies the preset length threshold, judging that there is no crack in the banknote to be detected; if the connected domain width of the connected domain satisfies the preset width threshold and / or the connected domain length of the connected domain satisfies the preset length threshold, obtaining the image area corresponding to the connected domain in the target image to be detected as the first target area; The judgment unit is further used for: obtaining the number of pixels contained in a preset length of the target image to be detected in the target detection direction; and determining the width threshold and the length threshold according to the number of pixels.
7. A readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor is caused to execute the steps of the method according to any one of claims 1 to 5.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 5.
