Method, system, detection device and storage device for detecting bill pasting area
By combining grayscale processing and binarization comparison of visible light and infrared perspective images, the problem of high time consumption and interference of bill pasting detection in the prior art is solved, and the accuracy and sensitivity of detection are improved.
Patent Information
- Application Number
- CN202011508137.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-18
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2040-12-18
AI Technical Summary
The existing bill pasting detection algorithm is based on full-frame detection, which consumes a lot of time and is prone to interference, resulting in missed detection, reduced sensitivity, and inability to effectively detect pasting in non-featured areas.
The visible and infrared perspective detection images are obtained, grayscale processing is performed, the grayscale threshold is calculated and the infrared perspective and visible light binary images are compared to determine whether there is a paste area.
The accuracy of the document pasting area detection is improved, and the error judgment caused by dark image detection is prevented, and the detection ability of the entire area pasting is enhanced.
Smart Images

Figure CN113255640B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image detection technology, and in particular to a method, system, detection equipment and storage device for detecting a bill pasting area. Background Art
[0002] Existing bill pasting detection algorithms are generally based on full-width pasting detection, and usually only use infrared transmission Figure 1 The whole-frame pasting detection consumes a lot of time, and the pasting detection in non-element areas is meaningless. Secondly, the whole-frame detection will inevitably have more interference, and the binarization method is difficult to design. In addition, in order to be compatible with these interferences, the sensitivity of the pasting algorithm will inevitably be reduced. Therefore, it is very likely to cause missed detection, resulting in losses. Summary of the invention
[0003] The present invention provides a method, system, detection equipment and storage device for detecting a bill pasting area, which can effectively solve the problem of missed detection caused by much interference in judging whether a bill has a pasting area.
[0004] A method for detecting a bill pasting area comprises: obtaining a visible light detection image and an infrared perspective detection image of a preset detection area of a target detection bill; performing grayscale processing on the infrared perspective detection image and the visible light detection image to obtain an infrared perspective grayscale image of the infrared perspective detection image and a visible light grayscale image of the visible light detection image; obtaining an infrared perspective grayscale value of each pixel of the infrared perspective grayscale image, calculating an infrared perspective grayscale average value of the infrared perspective grayscale image according to the infrared perspective grayscale value, and using the infrared perspective grayscale average value as a minimum binarization threshold of the infrared perspective grayscale image; calculating an infrared perspective grayscale threshold of the infrared perspective grayscale image according to the infrared perspective grayscale value, if If the infrared perspective grayscale threshold is greater than or equal to the minimum binarization threshold, the infrared perspective grayscale image is binarized according to the infrared perspective grayscale threshold to obtain an infrared perspective binarized image; the visible light grayscale value of each pixel of the visible light grayscale image is obtained, the visible light grayscale threshold of the visible light grayscale image is calculated according to the visible light grayscale value, the visible light image is binarized according to the visible light grayscale threshold to obtain a visible light binarized image; the infrared perspective binarized image is compared with the visible light binary image, and if the difference between the infrared perspective binarized image and the visible light binary image is greater than or equal to the preset difference threshold, it is determined that the pasting area exists in the preset detection area.
[0005] A system for detecting a bill pasting area comprises: an acquisition module for acquiring a visible light detection image and an infrared perspective detection image of a preset detection area of a target detection bill; a grayscale module for performing grayscale processing on the infrared perspective detection image and the visible light detection image to acquire an infrared perspective grayscale image of the infrared perspective detection image and a visible light grayscale image of the visible light detection image; a minimum module for acquiring an infrared perspective grayscale value of each pixel of the infrared perspective grayscale image, calculating an infrared perspective grayscale average value of the infrared perspective grayscale image according to the infrared perspective grayscale value, and using the infrared perspective grayscale average value as a minimum binarization threshold value of the infrared perspective grayscale image; a first binary module for calculating an infrared perspective grayscale value of the infrared perspective grayscale image according to the infrared perspective grayscale value; An external perspective grayscale threshold, if the infrared perspective grayscale threshold is greater than or equal to the minimum binarization threshold, the infrared perspective grayscale image is binarized according to the infrared perspective grayscale threshold to obtain an infrared perspective binarized image; a second binary module obtains the visible light grayscale value of each pixel of the visible light grayscale image, calculates the visible light grayscale threshold of the visible light grayscale image according to the visible light grayscale value, binarizes the visible light image according to the visible light grayscale threshold to obtain a visible light binarized image; a result module is used to compare the infrared perspective binarized image with the visible light binary image, and if the difference between the infrared perspective binarized image and the visible light binary image is greater than or equal to the preset difference threshold, it is determined that the preset detection area has the pasting area.
[0006] A detection 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 executes the steps of the method as described above.
[0007] A storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the method described above.
[0008] The embodiments of the present invention have the following beneficial effects:
[0009] Obtain the visible light detection image and infrared perspective detection image of the preset detection area of the target detection ticket, and compare the infrared perspective binary image obtained based on the infrared perspective detection image with the visible light binary image obtained based on the visible light detection highlight to determine whether there is a pasting area in the preset detection area. Combining the comparison with the visible light detection image can further improve the accuracy of the judgment. Calculate the infrared perspective grayscale threshold of the infrared perspective grayscale image based on the infrared perspective grayscale value. If the infrared perspective grayscale threshold is greater than or equal to the minimum binarization threshold, binarize the infrared perspective grayscale image based on the infrared perspective grayscale threshold. This can prevent abnormal infrared perspective detection image acquisition, the whole image is dark and causes detection errors, and can also prevent misjudgment when the target detection area is pasted in the entire area, thereby effectively improving the accuracy of the judgment. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] 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.
[0011] in:
[0012] Figure 1 It is a flow chart of a first embodiment of the method for detecting a bill pasting area provided by the present invention;
[0013] Figure 2 is a schematic diagram of a visible light image of a target detection bill provided by the present invention;
[0014] Figure 3 It is a schematic diagram of an infrared perspective image of a target detection bill provided by the present invention;
[0015] Figure 4 It is a schematic diagram of a visible light detection image of a preset detection area of a target detection bill provided by the present invention;
[0016] Figure 5 It is a schematic diagram of an infrared perspective image of a preset detection area of a target detection bill provided by the present invention;
[0017] Figure 6 It is a schematic diagram of an infrared perspective grayscale image of a preset detection area of a target detection bill provided by the present invention;
[0018] Figure 7 It is a schematic diagram of a visible light grayscale image of a preset detection area of a target detection bill provided by the present invention;
[0019] Figure 8It is a schematic diagram of an infrared perspective binary image of a preset detection area of a target detection bill provided by the present invention;
[0020] Fig. 9 It is a schematic diagram of a visible light binary image of a preset detection area of a target detection bill provided by the present invention;
[0021] Fig.10 It is a flow chart of a second embodiment of the method for detecting a bill pasting area provided by the present invention;
[0022] Fig.11 It is a schematic diagram of an infrared perspective expansion image of a preset detection area of a target detection bill provided by the present invention;
[0023] Fig.12 It is a schematic diagram of a visible light expansion image of a preset detection area of a target detection bill provided by the present invention;
[0024] Fig.13 It is a schematic diagram of an image of a pasting area of a preset detection area of a target detection ticket provided by the present invention;
[0025] Fig.14 It is a structural schematic diagram of an embodiment of a system for detecting a bill pasting area provided by the present invention;
[0026] Fig.15 It is a structural schematic diagram of an embodiment of the detection device provided by the present invention;
[0027] Fig.16 It is a structural schematic diagram of an embodiment of the storage medium provided by the present invention. DETAILED DESCRIPTION
[0028] 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.
[0029] See also Figure 1 , Figure 1 1 is a flow chart of a first embodiment of a method for detecting a bill pasting area provided by the present invention. The method for detecting a bill pasting area provided by the present invention comprises the following steps:
[0030] S101: Acquire a visible light detection image and an infrared perspective detection image of a preset detection area of a target detection bill.
[0031] In a specific implementation scenario, the visible light image and infrared perspective image of the target detection bill are obtained. The visible light image and the infrared perspective image have the same size. Please refer to Figure 2 and Figure 3 , Figure 2 is a schematic diagram of a visible light image of a target detection bill provided by the present invention, Figure 3 The figure is a schematic diagram of the infrared perspective image of the target detection bill provided by the present invention. The position parameters of the preset detection area are obtained, including the distances of the four sides relative to the edge of the target detection bill and at least one of the coordinate values of the four vertices. The visible light image and the infrared perspective image are captured according to the position parameters to obtain the visible light detection image and the infrared perspective detection image of the preset detection area of the target detection bill. Please refer to Figure 4 and Figure 5 , Figure 4 is a schematic diagram of a visible light detection image of a preset detection area of a target detection bill provided by the present invention, Figure 5 It is a schematic diagram of an infrared perspective image of a preset detection area of a target detection bill provided by the present invention.
[0032] S102: grayscale processing is performed on the infrared perspective detection image and the visible light detection image to obtain an infrared perspective grayscale image of the infrared perspective detection image and a visible light grayscale image of the visible light detection image.
[0033] In a specific implementation scenario, the infrared perspective detection image and the visible light detection image are gray-scaled to obtain an infrared perspective gray-scale image of the infrared perspective detection image and a visible light gray-scale image of the visible light detection image. Most areas of the infrared perspective detection image are gray-white, but there may be red seals, bank logos (generally red), and fluorescent words (generally red) on the bill. In order to avoid these colors affecting subsequent judgments, the infrared perspective detection image is gray-scaled. The visible light detection image is a color image, including multiple colors. The target detection bill itself can be red, green, blue, etc. The font color on the target detection bill can also include other colors besides black. In order to avoid these colors affecting subsequent judgments, the visible light image is gray-scaled.
[0034] Grayscale processing methods include the average method, the average weighted method, and the CV_RGB2GRAY function used in opencv.
[0035] In other implementation scenarios, the result of the first color channel of the infrared perspective detection image can also be taken as the infrared perspective grayscale image of the infrared perspective detection image. Since the common interference color in the infrared perspective detection image is red, the first color is red. Take the red channel of the infrared perspective detection image to obtain the infrared perspective grayscale image. Please refer to Figure 6 , Figure 6 It is a schematic diagram of an infrared perspective grayscale image of a preset detection area of a target detection bill provided by the present invention.
[0036] The result of taking the second color channel of the visible light detection image is used as the visible light grayscale image of the visible light detection image. The second color is the background color of the visible light detection image, that is, the color of the target detection bill. For example, if the target detection bill is red, the second color is red. Take the red channel of the visible light detection image to obtain the visible light grayscale image. Please refer to Figure 7 , Figure 7 It is a schematic diagram of a visible light grayscale image of a preset detection area of a target detection bill provided by the present invention.
[0037] S103: Obtaining the infrared perspective grayscale value of each pixel of the infrared perspective grayscale image, and calculating the infrared perspective grayscale average value and the infrared perspective grayscale threshold of the infrared perspective grayscale image according to the infrared perspective grayscale value.
[0038] In a specific implementation scenario, it is necessary to binarize the infrared perspective grayscale image and the visible light grayscale image. The binarization requires obtaining a grayscale threshold, and the pixel values greater than or equal to the grayscale threshold are uniformly set to 255 (white), and the pixel values less than the grayscale threshold are uniformly set to 0 (black). The infrared perspective grayscale value of each pixel of the infrared perspective grayscale image is obtained, and the infrared perspective grayscale threshold of the infrared perspective grayscale image is calculated according to the infrared perspective grayscale value. Methods for obtaining the infrared perspective grayscale threshold include bimodal method, P parameter method, great law method, maximum entropy threshold method, etc. In this implementation scenario, the average value (including arithmetic mean, geometric mean, square mean, harmonic mean, weighted mean) of the infrared perspective grayscale values of all pixels of the infrared perspective grayscale image can be obtained as the infrared perspective grayscale average value.
[0039] S104: If the infrared perspective grayscale threshold is greater than or equal to the infrared perspective grayscale average value, binarization is performed on the infrared perspective grayscale image according to the infrared perspective grayscale threshold to obtain an infrared perspective binarized image.
[0040] In a specific implementation scenario, if the target detection area is a completely pasted area, refer to Figure 2 and Figure 3 If the uppercase amount area in the image is only obtained by relying on the result in step S103, the infrared perspective grayscale threshold is likely to be very small, and even if there is pasting in the target detection area, it may lead to missed detection. Therefore, if the infrared perspective grayscale threshold is greater than or equal to the infrared perspective grayscale average value, the infrared perspective grayscale threshold is used as the infrared perspective grayscale threshold of the infrared perspective grayscale image to prevent abnormal infrared perspective detection image acquisition, the whole image is dark and causes detection errors, and can also prevent misjudgment when there is pasting in the entire area of the target detection area.
[0041] In other implementation scenarios, if the infrared perspective grayscale threshold is less than the infrared perspective grayscale average value, binarization processing is performed according to the infrared perspective grayscale average value.
[0042] S105: Obtaining a visible light grayscale value of each pixel of the visible light grayscale image, calculating a visible light grayscale threshold of the visible light grayscale image according to the visible light grayscale value, and binarizing the visible light image according to the visible light grayscale threshold to obtain a visible light binary image.
[0043] In a specific implementation scenario, the visible light gray value of each pixel of the visible light gray image is obtained, and the visible light gray threshold of the visible light gray image is calculated according to the visible light gray value. Methods for obtaining the visible light gray threshold include bimodal method, P parameter method, great law method, maximum entropy threshold method, etc. In this implementation scenario, the average value (including arithmetic mean, geometric mean, square mean, harmonic mean, weighted mean) of the visible light gray values of all pixels of the visible light gray image can be obtained, or at least one visible light gray value can be calculated according to a preset algorithm.
[0044] S106: Compare the infrared perspective binary image and the visible light binary image. If the difference between the infrared perspective binary image and the visible light binary image is greater than or equal to a preset difference threshold, determine that there is a pasting area in the preset detection area.
[0045] In a specific implementation scenario, the infrared perspective grayscale image is binarized according to the infrared perspective grayscale threshold to obtain an infrared perspective binarized image, and the pixel values in the infrared perspective grayscale image that are greater than or equal to the infrared perspective grayscale threshold are set to 255, and the pixel values that are less than the infrared perspective grayscale threshold are set to 0. Similarly, the visible light grayscale image is binarized according to the visible light grayscale threshold to obtain a visible light binarized image, and the pixel values in the visible light grayscale image that are greater than or equal to the visible light grayscale threshold are set to 255, and the pixel values that are less than the visible light grayscale threshold are set to 0. Please refer to Figure 8 and Fig. 9 , Figure 8 It is a schematic diagram of an infrared perspective binary image of a preset detection area of a target detection bill provided by the present invention. Fig. 9 It is a schematic diagram of a visible light binary image of a preset detection area of a target detection bill provided by the present invention.
[0046] After binarization, the black part in the schematic diagram of the infrared perspective binary image includes the pasted area and the altered area, while the black part of the visible light binary image includes the altered area. Therefore, the difference between the infrared perspective binary image and the visible light binary image can be calculated. If the difference is greater than or equal to the preset difference threshold, it is determined that there is a pasted area in the preset detection area.
[0047] It can be seen from the above description that in this embodiment, the visible light detection image and the infrared perspective detection image of the preset detection area of the target detection ticket are obtained, and the infrared perspective binary image obtained according to the infrared perspective detection image and the visible light binary image obtained according to the visible light detection highlight are compared to determine whether there is a pasting area in the preset detection area. Combining the comparison with the visible light detection image can effectively improve the accuracy of the judgment. The infrared perspective grayscale threshold of the infrared perspective grayscale image is calculated according to the infrared perspective grayscale value. If the infrared perspective grayscale threshold is greater than or equal to the minimum binarization threshold, the infrared perspective grayscale image is binarized according to the infrared perspective grayscale threshold. This can prevent abnormal infrared perspective detection image acquisition, the whole image is dark and causes detection errors, and can also prevent misjudgment when the target detection area is pasted in the entire area, thereby effectively improving the accuracy of the judgment.
[0048] See also Fig.10 , Fig.10 1 is a flow chart of a second embodiment of the method for detecting a bill pasting area provided by the present invention. The method for detecting a bill pasting area provided by the present invention comprises the following steps:
[0049] S201: Acquire a visible light detection image and an infrared perspective detection image of a preset detection area of a target detection bill.
[0050] S202: grayscale processing is performed on the infrared perspective detection image and the visible light detection image to obtain an infrared perspective grayscale image of the infrared perspective detection image and a visible light grayscale image of the visible light detection image.
[0051] In a specific implementation scenario, steps S201-S202 are substantially consistent with steps S101-S102 in the first embodiment of the method for detecting a bill pasting area provided by the present invention, and will not be described in detail herein.
[0052] S203: Obtaining the infrared perspective grayscale value of each pixel of the infrared perspective grayscale image, sorting the infrared perspective grayscale values from large to small to obtain an infrared perspective grayscale value sequence, and obtaining a value in the infrared perspective grayscale value sequence that meets a preset condition.
[0053] In a specific implementation scenario, the infrared perspective grayscale value of each pixel of the infrared perspective grayscale image is obtained, and the infrared perspective grayscale values are sorted from large to small to obtain an infrared perspective grayscale value sequence, and the value that meets the preset condition in the infrared perspective grayscale value sequence is obtained, which can be a preset number of values, such as the 20th infrared perspective grayscale value and the 30th infrared perspective grayscale value in the infrared perspective grayscale value sequence. Or the 20%*Nth, 30%*Nth, N is the number of infrared perspective grayscale values.
[0054] It can also be the value with the largest number of corresponding pixels, or the proportion of the pixels corresponding to the infrared perspective grayscale values in the infrared perspective grayscale value sequence in the infrared perspective grayscale image can be added. When the proportion of the result after addition meets the preset proportion threshold, the infrared perspective grayscale value of the pixel corresponding to the last added proportion is used as the value that meets the preset condition. Specifically, for example, the infrared perspective grayscale value sequence is {a, b, c, d, e...}. Among them, a corresponds to Na pixels, accounting for A% of the infrared perspective grayscale image, b corresponds to Nb pixels, accounting for B% of the infrared perspective grayscale image, c corresponds to Nc pixels, accounting for C% of the infrared perspective grayscale image, d corresponds to Nd pixels, accounting for D% of the infrared perspective grayscale image... Then it is judged whether A% meets the preset proportion threshold. If not, calculate whether A%+B% meets the preset proportion threshold. If still not, calculate whether A%+B%+C% meets the preset proportion threshold. If it meets, the infrared perspective grayscale value c corresponding to the last added C% is the value that meets the preset condition.
[0055] Because there may be interference from white watermarks in infrared perspective grayscale images, the value that meets the conditions is prevented from being the value of white watermarks due to too low a percentage, which may cause false detections later due to too high a binarization threshold. Similarly, it cannot be too low, which will cause missed detections. The value that meets the conditions can be taken as the grayscale value of a relatively uniform gray-white background between black and white watermarks or in the region. Therefore, the preset percentage threshold is 20%-40%, and in this implementation scenario, it is 30%.
[0056] S204: dividing a value in the infrared perspective gray value sequence that meets a preset condition by a preset value, and taking a first result as an infrared perspective gray threshold of the infrared perspective gray image.
[0057] In a specific implementation scenario, because the infrared perspective grayscale image contains text on the visible light back side in addition to the text elements on the visible light front side, the superimposed text has thick ink and direct use will lead to false detection. Therefore, the value that meets the conditions cannot be directly used as the infrared perspective grayscale threshold. Instead, the value that meets the conditions needs to be divided by a preset value to prevent false detection. Generally, the preset value is between 1 and 2.
[0058] S205: Calculate the infrared perspective grayscale average value of the infrared perspective grayscale image according to the infrared perspective grayscale value.
[0059] S206: If the infrared perspective grayscale threshold is greater than or equal to the infrared perspective grayscale average value, binarization is performed on the infrared perspective grayscale image according to the infrared perspective grayscale threshold to obtain an infrared perspective binary image.
[0060] In a specific implementation scenario, steps S205-S206 are basically the same as step S103 in the first embodiment of the method for detecting the bill pasting area provided by the present invention, in which the infrared perspective grayscale average value of the infrared perspective grayscale image is calculated based on the infrared perspective grayscale value, and S104, and will not be repeated here.
[0061] S207: Obtain the visible light grayscale value of each pixel of the visible light grayscale image, sort the visible light grayscale values from large to small to obtain a visible light grayscale value sequence, and obtain a value in the visible light grayscale value sequence that meets a preset condition.
[0062] In a specific implementation scenario, the step of obtaining a value satisfying a preset condition in a visible light grayscale value sequence is substantially the same as the step of obtaining a value satisfying a preset condition in an infrared perspective grayscale value sequence in step S204, and will not be described in detail here.
[0063] S208: Using the value in the visible light grayscale value sequence that meets the preset condition as the visible light grayscale threshold of the visible light grayscale image.
[0064] In a specific implementation scenario, since there is no backside perspective in visible light images and the overall pasting has little effect on the grayscale, the value that meets the preset conditions can be directly used as the visible light grayscale threshold of the visible light grayscale image.
[0065] In other implementation scenarios, the operation in step S204 may be performed on the value that meets the preset condition, and the obtained result may be used as the visible light grayscale threshold.
[0066] S209: Binarizing the visible light image according to the visible light grayscale threshold to obtain a visible light binary image.
[0067] In a specific implementation scenario, step S209 is substantially the same as the part of acquiring the infrared perspective binary image and the visible light binary image described in S105 in the first embodiment of the method for detecting the bill pasting area provided by the present invention, and will not be described in detail here.
[0068] S210: performing expansion processing on the infrared perspective binary image and the visible light binary image to obtain an infrared perspective expanded image and a visible light expanded image.
[0069] In a specific implementation scenario, the infrared perspective binary image is expanded. A sliding window is generated according to a preset height value and a preset width value, and the sliding window is slid in a "Z" shape on the infrared perspective binary image according to a preset sliding track. During the sliding process of the sliding window, the maximum value of all pixels in the area covered by the sliding window replaces the pixel value of the pixel at the center of the area covered by the sliding window. After the expansion process, the area occupied by the white area in the obtained infrared perspective expansion image will become larger.
[0070] Similarly, the visible light binary image is expanded. A sliding window is generated according to a preset height value and a preset width value, and the sliding window is slid in a "Z" shape on the visible light binary image according to a preset sliding trajectory. During the sliding of the sliding window, the maximum value of all pixels in the area covered by the sliding window replaces the pixel value of the pixel at the center of the area covered by the sliding window. After the expansion process, the area occupied by the white area in the obtained visible light expansion image will become larger. When the infrared perspective binary image and the visible light binary image are expanded, the size of the sliding window is set to be the same.
[0071] Please refer to Fig.11 and Fig.12 , Fig.11 It is a schematic diagram of an infrared perspective expansion image of a preset detection area of a target detection bill provided by the present invention. Fig.12 It is a schematic diagram of a visible light expansion image of a preset detection area of a target detection bill provided by the present invention.
[0072] S211: Determine whether the infrared perspective expansion image and the visible light expansion image are the same, if not, execute step S212.
[0073] In a specific implementation scenario, it is determined whether the infrared perspective expansion image and the visible light expansion image are the same. Specifically, the infrared perspective expansion image and the visible light expansion image have the same size, so it can be determined whether the positions of the black pixels in the infrared perspective expansion image are the same as the positions of the black image pixels in the visible light expansion image. Due to reasons such as image clarity, a determination threshold can be set to determine whether the percentage of the number of black pixels in the infrared perspective expansion image and the black image pixels in the visible light expansion image that are the same as the positions of the black image pixels in the visible light expansion image exceeds the determination threshold, such as 80%, 85%, 90%, etc. If so, it is determined that the infrared perspective expansion image and the visible light expansion image are the same.
[0074] S212: Determine whether there is a pasting area in the preset detection area, and take the area where the infrared perspective expansion image and the visible light expansion image are different as the pasting area.
[0075] In a specific implementation scenario, the infrared perspective expansion image is different from the visible light expansion image, and it is determined that there is a pasting area in the preset detection area. The black pixels in the infrared perspective expansion image that are at the same position as the black pixels in the visible light expansion image are replaced with white pixels to obtain a pasting area image. The area where the black pixels in the pasting area image are located is the pasting area. Please refer to Fig.13 , Fig.13 It is a schematic diagram of an image of a pasting area of a preset detection area of a target detection bill provided by the present invention.
[0076] In other implementation scenarios, if the infrared perspective expansion image and the visible light expansion image are the same, it is determined that there is no pasting area in the target detection area.
[0077] It can be seen from the above description that in this embodiment, the infrared perspective grayscale values are sorted from large to small to obtain an infrared perspective grayscale value sequence, the value that meets the preset condition in the infrared perspective grayscale value sequence is obtained, the infrared perspective grayscale threshold of the infrared perspective grayscale image is obtained, and the first result of dividing the value that meets the preset condition in the infrared perspective grayscale value sequence by the preset value is obtained. If the first result is greater than or equal to the average value of the infrared perspective grayscale value, the first result is used as the infrared perspective grayscale threshold of the infrared perspective grayscale image. This can prevent abnormal acquisition of the infrared perspective detection image, the whole image is dark and causes detection errors, and can also prevent misjudgment when the target detection area is fully pasted, thereby effectively improving the accuracy of the judgment.
[0078] See also Fig.14 , Fig.14 The system 10 for detecting the bill sticking area includes an acquisition module 11, a grayscale module 12, a minimum module 13, a first binary module 14, a second binary module 15, and a result module 16.
[0079] The acquisition module 11 is used to acquire the visible light detection image and the infrared perspective detection image of the preset detection area of the target detection ticket. The grayscale module 12 is used to perform grayscale processing on the infrared perspective detection image and the visible light detection image, and acquire the infrared perspective grayscale image of the infrared perspective detection image and the visible light grayscale image of the visible light detection image. The minimum module 13 is used to acquire the infrared perspective grayscale value of each pixel of the infrared perspective grayscale image, calculate the infrared perspective grayscale average value of the infrared perspective grayscale image according to the infrared perspective grayscale value, and use the infrared perspective grayscale average value as the minimum binarization threshold of the infrared perspective grayscale image. The first binary module 14 is used to calculate the infrared perspective grayscale threshold of the infrared perspective grayscale image according to the infrared perspective grayscale value. If the infrared perspective grayscale threshold is greater than or equal to the minimum binarization threshold, the infrared perspective grayscale image is binarized according to the infrared perspective grayscale threshold to acquire the infrared perspective binarized image. The second binary module 15 is used to obtain the visible light gray value of each pixel of the visible light gray image, calculate the visible light gray threshold of the visible light gray image according to the visible light gray value, and perform binarization processing on the visible light image according to the visible light gray threshold to obtain the visible light binary image. The result module 16 is used to compare the infrared perspective binary image with the visible light binary image. If the difference between the infrared perspective binary image and the visible light binary image is greater than or equal to the preset difference threshold, it is determined that there is a pasting area in the preset detection area.
[0080] From the above description, it can be known that in this implementation scenario, the system for detecting the pasting area of the bill obtains the visible light detection image and the infrared perspective detection image of the preset detection area of the target detection bill, and compares the infrared perspective binary image obtained according to the infrared perspective detection image and the visible light binary image obtained according to the visible light detection highlight to determine whether there is a pasting area in the preset detection area. The accuracy of the judgment can be further improved by combining the visible light detection image for comparison. The infrared perspective grayscale threshold of the infrared perspective grayscale image is calculated according to the infrared perspective grayscale value. If the infrared perspective grayscale threshold is greater than or equal to the minimum binarization threshold, the infrared perspective grayscale image is binarized according to the infrared perspective grayscale threshold. This can prevent abnormal infrared perspective detection image acquisition, the whole image is dark and causes detection errors, and can also prevent misjudgment when the target detection area is pasted in the entire area, thereby effectively improving the accuracy of the judgment.
[0081] See also Fig.15 , Fig.15 2 is a schematic diagram of a structure of an embodiment of the detection device provided by the present invention. The mutual detection device 20 includes a processor 21 and a memory 22. The processor 21 is coupled to the memory 22. The memory 22 stores a computer program, and the processor 21 executes the computer program when working to implement the following Figure 1 and Fig.13The detailed method can be found in the above, which will not be described here.
[0082] It can be seen from the above description that in this embodiment, the detection device obtains the visible light detection image and the infrared perspective detection image of the preset detection area of the target detection ticket, and compares the infrared perspective binary image obtained according to the infrared perspective detection image and the visible light binary image obtained according to the visible light detection highlight to determine whether there is a pasting area in the preset detection area. The accuracy of the judgment can be further improved by combining the visible light detection image for comparison. The infrared perspective grayscale threshold of the infrared perspective grayscale image is calculated according to the infrared perspective grayscale value. If the infrared perspective grayscale threshold is greater than or equal to the minimum binarization threshold, the infrared perspective grayscale image is binarized according to the infrared perspective grayscale threshold. This can prevent abnormal infrared perspective detection image acquisition, the whole image is dark and causes detection errors, and can also prevent misjudgment when the target detection area is pasted in the entire area, thereby effectively improving the accuracy of the judgment.
[0083] See also Fig.16 , Fig.16 The storage medium 30 stores at least one computer program 31, which is used to be executed by the processor to implement the following. Figure 1 and Fig.13 In one embodiment, the storage medium 30 may be a storage chip, a hard disk, a mobile hard disk, a USB flash drive, an optical disk, or other readable and writable storage tools in the terminal, or a server, etc.
[0084] It can be seen from the above description that the computer program in the storage medium in this embodiment can be used to obtain the visible light detection image and the infrared perspective detection image of the preset detection area of the target detection ticket, and compare the infrared perspective binary image obtained according to the infrared perspective detection image and the visible light binary image obtained according to the visible light detection highlight to determine whether there is a pasting area in the preset detection area. Combining the comparison with the visible light detection image can further improve the accuracy of the judgment. The infrared perspective grayscale threshold of the infrared perspective grayscale image is calculated according to the infrared perspective grayscale value. If the infrared perspective grayscale threshold is greater than or equal to the minimum binarization threshold, the infrared perspective grayscale image is binarized according to the infrared perspective grayscale threshold, which can prevent abnormal infrared perspective detection image acquisition, the whole image is dark and causes detection errors, and can also prevent misjudgment when the target detection area has full-area pasting, thereby effectively improving the accuracy of the judgment.
[0085] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments 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 the present 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).
[0086] 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.
[0087] The above 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 modifications 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 method for detecting a bill pasting area, characterized in that: include: Acquire a visible light detection image and an infrared perspective detection image of a preset detection area of a target detection ticket; Performing grayscale processing on the infrared perspective detection image and the visible light detection image to obtain an infrared perspective grayscale image of the infrared perspective detection image and a visible light grayscale image of the visible light detection image; Acquire the infrared perspective grayscale value of each pixel of the infrared perspective grayscale image, and calculate the infrared perspective grayscale average value and the infrared perspective grayscale threshold of the infrared perspective grayscale image according to the infrared perspective grayscale value; If the infrared perspective grayscale threshold is greater than or equal to the infrared perspective grayscale average value, binarizing the infrared perspective grayscale image according to the infrared perspective grayscale threshold to obtain an infrared perspective binarized image; Acquire a visible light grayscale value of each pixel of the visible light grayscale image, calculate a visible light grayscale threshold of the visible light grayscale image according to the visible light grayscale value, and perform binarization processing on the visible light grayscale image according to the visible light grayscale threshold to acquire a visible light binarized image; Comparing the infrared perspective binary image with the visible light binary image, and if the difference between the infrared perspective binary image and the visible light binary image is greater than or equal to a preset difference threshold, determining that the pasting area exists in the preset detection area; The step of calculating the infrared perspective grayscale threshold of the infrared perspective grayscale image according to the infrared perspective grayscale value comprises: Sorting the infrared perspective grayscale values from large to small to obtain an infrared perspective grayscale value sequence, and obtaining an infrared perspective grayscale threshold of the infrared perspective grayscale image according to a value in the infrared perspective grayscale value sequence that meets a preset condition; The step of calculating the visible light grayscale threshold of the visible light grayscale image according to the visible light grayscale value comprises: Sorting the visible light grayscale values from large to small to obtain a visible light grayscale value sequence, and obtaining the infrared perspective grayscale threshold of the visible light grayscale image according to a value in the visible light grayscale value sequence that meets a preset condition; The step of obtaining the infrared perspective grayscale threshold of the infrared perspective grayscale image according to the value satisfying the preset condition in the infrared perspective grayscale value sequence comprises: A first result of dividing a value in the infrared perspective gray value sequence that satisfies a preset condition by a preset value is used as an infrared perspective gray threshold of the infrared perspective gray image; wherein the preset value is greater than 1; The step of obtaining the infrared perspective grayscale threshold of the visible light grayscale image according to the value satisfying the preset condition in the visible light grayscale value sequence comprises: A value in the visible light grayscale value sequence that meets a preset condition is used as a visible light grayscale threshold of the visible light grayscale image.
2. The method for detecting the bill pasting area according to claim 1, characterized in that: The step of performing grayscale processing on the infrared perspective detection image and the visible light detection image to obtain an infrared perspective grayscale image of the infrared perspective detection image and a visible light grayscale image of the visible light detection image comprises: Taking the result of the first color channel of the infrared perspective detection image as the infrared perspective grayscale image of the infrared perspective detection image; The result of taking the second color channel of the visible light detection image is used as the visible light grayscale image of the visible light detection image.
3. The method for detecting the bill sticking area according to claim 2, characterized in that: The first color is selected according to the color of the fluorescent words, bank logo and seal included in the infrared perspective detection image; The second color is selected according to the background color of the visible light detection image.
4. The method for detecting the bill sticking area according to claim 1, characterized in that: The step of comparing the infrared perspective binary image with the visible light binary image comprises: Performing expansion processing on the infrared perspective binary image and the visible light binary image to obtain an infrared perspective expansion image and a visible light expansion image; determining whether the infrared perspective expansion image and the visible light expansion image are the same; If the infrared perspective expansion image is different from the visible light expansion image, it is determined that there is a pasting area in the preset detection area, and the area where the infrared perspective expansion image is different from the visible light expansion image is used as the pasting area.
5. The method for detecting the bill sticking area according to claim 4, characterized in that: The step of performing expansion processing on the infrared perspective binary image and the visible light binary image comprises: Generate a sliding window according to a preset height value and a preset width value, and slide the sliding window on the infrared perspective binary image or the visible light binary image according to a preset sliding track; The pixel value of the pixel at the center of the area covered by the sliding window is replaced by the maximum value of all pixels in the area covered by the sliding window.
6. A system for detecting a bill pasting area, characterized in that: include: An acquisition module, used to acquire a visible light detection image and an infrared perspective detection image of a preset detection area of a target detection ticket; A grayscale module is used to perform grayscale processing on the infrared perspective detection image and the visible light detection image to obtain an infrared perspective grayscale image of the infrared perspective detection image and a visible light grayscale image of the visible light detection image; A minimum module, used for obtaining the infrared perspective grayscale value of each pixel of the infrared perspective grayscale image, calculating the infrared perspective grayscale average value of the infrared perspective grayscale image according to the infrared perspective grayscale value, and using the infrared perspective grayscale average value as the minimum binarization threshold of the infrared perspective grayscale image; A first binary module is used to calculate an infrared perspective grayscale threshold of the infrared perspective grayscale image according to the infrared perspective grayscale value, and if the infrared perspective grayscale threshold is greater than or equal to the minimum binarization threshold, binarize the infrared perspective grayscale image according to the infrared perspective grayscale threshold to obtain an infrared perspective binary image; A second binary module is used to obtain a visible light grayscale value of each pixel of the visible light grayscale image, calculate a visible light grayscale threshold of the visible light grayscale image according to the visible light grayscale value, and perform a binarization process on the visible light grayscale image according to the visible light grayscale threshold to obtain a visible light binary image; A result module is used to compare the infrared perspective binary image with the visible light binary image, and if the difference between the infrared perspective binary image and the visible light binary image is greater than or equal to a preset difference threshold, it is determined that the pasting area exists in the preset detection area; The step of calculating the infrared perspective grayscale threshold of the infrared perspective grayscale image according to the infrared perspective grayscale value comprises: Sorting the infrared perspective grayscale values from large to small to obtain an infrared perspective grayscale value sequence, and obtaining an infrared perspective grayscale threshold of the infrared perspective grayscale image according to a value in the infrared perspective grayscale value sequence that meets a preset condition; The step of calculating the visible light grayscale threshold of the visible light grayscale image according to the visible light grayscale value comprises: Sorting the visible light grayscale values from large to small to obtain a visible light grayscale value sequence, and obtaining the infrared perspective grayscale threshold of the visible light grayscale image according to a value in the visible light grayscale value sequence that meets a preset condition; The step of obtaining the infrared perspective grayscale threshold of the infrared perspective grayscale image according to the value satisfying the preset condition in the infrared perspective grayscale value sequence comprises: A first result of dividing a value in the infrared perspective gray value sequence that satisfies a preset condition by a preset value is used as an infrared perspective gray threshold of the infrared perspective gray image; wherein the preset value is greater than 1; The step of obtaining the infrared perspective grayscale threshold of the visible light grayscale image according to the value satisfying the preset condition in the visible light grayscale value sequence comprises: A value in the visible light grayscale value sequence that meets a preset condition is used as a visible light grayscale threshold of the visible light grayscale image.
7. A detection device, characterized in that: The method 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 executes the steps of the method according to any one of claims 1 to 5.
8. A storage medium, characterized in that: A computer program is stored, and when the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 5.
