A card image processing method and device

By using dual-threshold image segmentation technology to preprocess and binarize card images, the problem of light spot interference recognition is solved, achieving efficient light spot removal and image quality improvement.

CN116993602BActive Publication Date: 2026-01-23ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310781790.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-28
Publication Date
2026-01-23
Estimated Expiration
2043-06-28

AI Technical Summary

Technical Problem

In the current card registration process, light spots affect the recognition results, and deep learning models require a large amount of light spot data for training, but samples are difficult to obtain, resulting in high costs.

Method used

The dual-threshold image segmentation technique is adopted. By preprocessing the card image, converting it to grayscale, adaptive histogram equalization, dual-threshold binarization and opening operation, spot images are detected and filtered.

Benefits of technology

It effectively removes light spots in card images, improves image quality, and reduces the cost of light spot detection and elimination.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116993602B_ABST
    Figure CN116993602B_ABST
Patent Text Reader

Abstract

The embodiment of the application discloses a card image processing method and device, the method comprises the following steps: preprocessing a target image to obtain a gray image; performing a binarization processing on the gray image based on a first threshold to obtain a first light spot contour image; performing a binarization processing on the gray image based on a second threshold to obtain a light spot core image; filtering the light spot contour without core from the first light spot contour image based on the light spot core image to obtain a second light spot contour image; determining a light spot image based on the light spot core image and the second light spot contour image; and filtering the light spot image from the target image. The light spot on the card can be detected through the double-threshold image segmentation technology, so that the light spot image can be filtered from the card image, and a clear card image can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, in particular to a card image processing method and device. BACKGROUND

[0002] In the card registration process, it is necessary to ensure that the content of the key area is correct, and the light spot existing in the card image will affect the recognition result, so it is necessary to filter out the light spot image. At present, a deep learning based scheme is usually used to remove the light spot image in the card image. However, the deep learning model needs to rely on a large amount of light spot data for training, and the light spot training sample and the corresponding label are usually difficult to obtain. SUMMARY

[0003] One or more embodiments of the present application provide a card image processing method and device, which can detect the light spot on the card through a double threshold image segmentation technology, so as to filter out the light spot image from the card image and obtain a clear card image.

[0004] According to a first aspect, a card image processing method is provided, comprising:

[0005] preprocessing a target image to obtain a gray image;

[0006] performing a binarization processing on the gray image based on a first threshold to obtain a first light spot contour image, and performing a binarization processing on the gray image based on a second threshold to obtain a light spot core image, the first threshold being smaller than the second threshold;

[0007] filtering out the light spot contour without core from the first light spot contour image based on the light spot core image to obtain a second light spot contour image;

[0008] determining a light spot image based on the light spot core image and the second light spot contour image;

[0009] filtering out the light spot image from the target image.

[0010] As an optional implementation of the method of the first aspect, the preprocessing of the target image to obtain a gray image specifically comprises:

[0011] performing a gray processing on the target image; and for the image after the gray processing, at least one of the following processing modes is executed:

[0012] a closing operation processing; and

[0013] a median filtering processing.

[0014] As an optional implementation of the method of the first aspect, before the grayscale image is respectively subjected to the binarization processing based on the first threshold value and the second threshold value, the grayscale image is further subjected to adaptive histogram equalization processing.

[0015] As an optional implementation of the method of the first aspect, after the grayscale image is respectively subjected to the binarization processing based on the first threshold value and the second threshold value, the two obtained binarization images are respectively subjected to open operation processing to obtain the first light spot contour image and the light spot core image.

[0016] As an optional implementation of the method of the first aspect, the determination of the light spot image based on the light spot core image and the second light spot contour image specifically comprises:

[0017] Based on the grayscale image, an overexposure image is obtained.

[0018] Based on the light spot core image and the second light spot contour image, a light spot distribution area image is determined.

[0019] The union image of the overexposure image and the light spot distribution area image is taken as the light spot image.

[0020] Further, the obtaining of the overexposure image based on the grayscale image specifically comprises:

[0021] The grayscale image is subjected to binarization processing based on a third threshold value, and based on the result of the binarization processing, an overexposure image is determined.

[0022] As an optional implementation of the method of the first aspect, the determination of the light spot image based on the light spot core image and the second light spot contour image specifically comprises:

[0023] Based on the grayscale image, a light spot foreground image is obtained.

[0024] Based on the light spot core image and the second light spot contour image, a light spot distribution area image is determined.

[0025] The intersection of the light spot foreground image and the light spot distribution area image is taken as the light spot image.

[0026] Further, the obtaining of the light spot foreground image based on the grayscale image specifically comprises:

[0027] Each pixel in the grayscale image is subjected to median filtering processing based on a preset neighborhood window to obtain a background grayscale image and a foreground image.

[0028] determine a difference image of the background gray image and the foreground image, perform fourth threshold-based binarization processing on the difference image, and obtain the light spot foreground image based on a result of the binarization processing.

[0029] As an optional implementation of the method of the first aspect, the determining the light spot image based on the light spot core image and the second light spot outline image specifically includes:

[0030] obtaining a light spot foreground image and an overexposure image based on the gray image, respectively;

[0031] determining a light spot distribution area image based on the light spot core image and the second light spot outline image;

[0032] determining an intersection image of the light spot foreground image and the light spot distribution area image;

[0033] taking a union image of the intersection image and the overexposure image as the light spot image.

[0034] According to a second aspect, a card image processing apparatus is provided, including:

[0035] an image acquisition module configured to acquire a target image in response to a card image recognition request;

[0036] an image preprocessing module configured to perform preprocessing on the target image to obtain a gray image;

[0037] a light spot recognition module configured to perform first threshold-based binarization processing on the gray image to obtain a first light spot outline image, perform second threshold-based binarization processing on the gray image to obtain a light spot core image, the first threshold being smaller than the second threshold, filter light spot outlines without cores from the first light spot outline image based on the light spot core image to obtain a second light spot outline image, and determine a light spot image based on the light spot core image and the second light spot outline image;

[0038] a light spot filtering module configured to filter the light spot image from the target image.

[0039] According to a third aspect, a computer readable storage medium having a computer program stored thereon is provided, the computer program being executed by a processor to implement the card image processing method.

[0040] According to a fourth aspect, an electronic device is provided, including:

[0041] one or more processors; and

[0042] A memory associated with the one or more processors, the memory for storing program instructions that, when read and executed by the one or more processors, perform the specific steps of the card image processing method.

[0043] The card image processing method and device described in one or more embodiments of the specification can detect the light spot image on the card image through the double threshold image segmentation technology, and then filter the light spot image, thereby improving the image quality of the card image. BRIEF DESCRIPTION OF DRAWINGS

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the specification or the prior art, the drawings needed in the embodiment or prior art description will be briefly introduced below. Obviously, the drawings in the following description are some embodiments of the specification, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.

[0045] Figure 1 A flowchart of a card image processing method provided by one or more embodiments of the specification;

[0046] Figure 2 A flowchart of a card image processing method provided by one or more embodiments of the specification applied to a first image processing scene;

[0047] Figure 3 A flowchart of a card image processing method provided by one or more embodiments of the specification applied to a second image processing scene;

[0048] Figure 4 A flowchart of a card image processing method provided by one or more embodiments of the specification applied to a third image processing scene;

[0049] Figure 5 A flowchart of a card image processing method provided by one or more embodiments of the specification applied to a fourth image processing scene;

[0050] Figure 6 A structure diagram of an electronic device provided by one or more embodiments of the specification;

[0051] Figure 7 A structure diagram of a card image processing device provided by one or more embodiments of the specification. DETAILED DESCRIPTION

[0052] In order for those skilled in the art to better understand the technical solutions in the specification, the technical solutions in the specification will be clearly and completely described in the specification below in combination with the drawings in the specification. Obviously, the described embodiments are only part of the embodiments of the specification, not all. Based on the embodiments in the specification, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the specification.

[0053] It should be noted that the steps of the corresponding method in some other embodiments are not necessarily performed in the order shown and described in the specification. In some other embodiments, the steps included in the method can be more or less than described in the specification. In addition, a single step described in the specification can be divided into multiple steps for description in other embodiments; and multiple steps described in the specification can be combined into a single step for description in other embodiments.

[0054] At present, deep learning-based solutions are mostly used to solve the problems of card certificate light spot detection and elimination. However, the deep learning-based solution needs to construct a large number of training samples, and these data are difficult to obtain, so the sample construction cost is very high.

[0055] Therefore, the present specification aims to solve the card certificate light spot processing problem by using another idea. One or more embodiments of the present specification describe a card certificate image processing method and device, which can realize the detection and elimination of card certificate light spots at a lower cost.

[0056] The card certificate image processing method and device described in the embodiments of the specification will be further described in detail below in combination with the drawings and specific embodiments of the specification, but the detailed description does not constitute a limitation on the embodiments of the specification.

[0057] It should be noted that the terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise.

[0058] Reference is made to Figure 1 , Figure 1 A flowchart of a card certificate image processing method provided for an exemplary embodiment of the specification is shown. As shown in Figure 1 , in some embodiments, the card certificate image processing method can include steps S100 to S110:

[0059] S100, pre-processing the target image to obtain a gray-scale image.

[0060] The target image is usually an RGB color image. If the color image is directly processed, the pixels of three channels of RGB need to be processed. In order to reduce the original data of the target image and the calculation amount in subsequent processing, the target image can be subjected to a grayscale processing to obtain a grayscale image.

[0061] In some embodiments, considering that the data amount of the image after the grayscale processing is still large, the median filter processing can be used to further reduce the data amount of the grayscale image.

[0062] In some embodiments, in order to filter the noise points in the target image, the grayscale image can also be subjected to a smoothing operation, for example, a closing operation processing of the grayscale image, that is, a first expansion and then a corrosion operation of the target object in the grayscale image, so as to fill the small pits or holes in the grayscale image and achieve the effect of smoothing the grayscale image.

[0063] S102, the grayscale image is subjected to a binarization processing based on a first threshold value to obtain a first light spot contour image.

[0064] In some embodiments, before the grayscale image is subjected to the binarization processing based on the first threshold value and the second threshold value respectively, the grayscale image can also be subjected to an adaptive histogram equalization processing, so as to improve the contrast of the grayscale image.

[0065] In some embodiments, a relatively moderate threshold value can be used to binarize the grayscale image, that is, the pixel of the pixel point with a pixel value lower than the first threshold value in the grayscale image is set to 0, and the pixel of the pixel point with a pixel value higher than the first threshold value in the grayscale image is set to 255, so as to finally obtain a black and white image. The binarization processing can further reduce the data amount of the grayscale image on the one hand, and can highlight the region of interest on the other hand. Since the light spot often presents a high-luminance region on the card image, and the center of the region has the highest luminance, the luminance gradually decreases towards the edge, so the binarization processing with a moderate threshold value can highlight the contour region of the light spot.

[0066] In some embodiments, the grayscale image subjected to the binarization processing based on the first threshold value can also be subjected to an opening operation processing. By performing a first corrosion and then a second expansion operation of the target object in the grayscale image, the boundary of the target object can be smoothed.

[0067] S104, the grayscale image is subjected to a binarization processing based on a second threshold value to obtain a light spot core image, and the second threshold value is greater than the first threshold value.

[0068] Considering that the light spot region has the characteristic that the core has the highest luminance, in some embodiments, a high threshold value can be selected to binarize the grayscale image to highlight the position of the light spot core.

[0069] In some embodiments, an opening operation can also be performed on the light spot core image. By performing the operation of first erosion and then expansion on the target object in the grayscale image, the boundary of the target object can be smoothed.

[0070] S106, based on the light spot core image, filtering the light spot profile without core from the first light spot profile image to obtain a second light spot profile image.

[0071] Considering that there can be some non-light spot regions with high brightness in the card image, such as some icons, etc., it is necessary to filter the first light spot profile image obtained in step S102 to remove the non-light spot image regions.

[0072] In some embodiments, the non-light spot regions can be filtered in combination with the feature that the light spot region usually has a high-brightness core. Specifically, the following method can be used:

[0073] The first light spot profile image extracted in step S102 is positionally matched with the light spot core image extracted in step S104. If there is a first light spot profile image that does not have a matching core image, the first light spot profile image is a non-light spot profile image. After determining all non-light spot profile images, the non-light spot profile images are removed from the first light spot profile image to obtain a second light spot profile image.

[0074] S108, based on the light spot core image and the second light spot profile image, determining a light spot image.

[0075] After removing the non-light spot profile image, all the remaining light spot profiles in the second light spot image are light spot profiles. At this time, the second light spot image can be combined with the light spot core image to obtain a light spot image. In the light spot image, there are multiple light spot regions with both profiles and cores.

[0076] S110, filtering the light spot image from the target image.

[0077] After determining the light spot image, the light spot image can be directly filtered from the target image.

[0078] In some embodiments, the grayscale image can be subtracted from the light spot image, and then the difference image can be restored to an RGB color image to obtain the processed card image.

[0079] In some embodiments, the light spot image can also be filtered based on a neural network. A light spot filtering model based on a neural network can be constructed, and the following method can be used to train the light spot filtering model:

[0080] The sample card image is obtained, and the card image processing method is used to obtain a light spot image of the sample card image.

[0081] The sample card image and the corresponding light spot image are subtracted to obtain a difference image, and the difference image is used as a sample label of the sample card image.

[0082] The sample card image and the corresponding difference image are input into a pre-built light spot filtering model, and the light spot filtering model is trained to minimize the difference between the predicted difference image and the actual difference image.

[0083] After the light spot filtering model is trained, the gray image of the card image can be input into the light spot filtering model to obtain the difference image after removing the light spot image.

[0084] Compared with directly constructing the label of the light spot image, the difference image used in the embodiment is easier to obtain.

[0085] As can be seen, Figure 1 In the card light spot processing method shown in the embodiment, a double-threshold image segmentation technique is used to detect a light spot core image and a first light spot contour image from a target image. Non-light spot images can be filtered out based on the core image and the first light spot contour image to obtain a second light spot contour image. Finally, the light spot image is determined based on the second light spot contour image and the light spot core image, and the light spot image can be filtered from the target image to obtain a card image with higher quality.

[0086] In a possible scenario, considering the light factor, the card material factor and the card color factor, there may be a case where the contrast between the light spot and the card background is not high enough. The following describes the application of a card image processing method provided in the embodiment in a first image processing scenario, combined with Figure 2 The card image processing method provided in the embodiment is further described.

[0087] Please refer to Figure 2 The card image processing method in this scenario includes the following steps:

[0088] S200, obtaining a card image.

[0089] S202, preprocessing the obtained card image to obtain a first gray image.

[0090] S204, performing CLAHE adaptive equalization processing on the first gray image to obtain a second gray image.

[0091] S206, sequentially performing a medium threshold binarization processing and an opening operation processing on the second gray image to obtain a first light spot contour image.

[0092] S208, sequentially performing high threshold binarization processing and open operation processing on the second gray scale image to obtain a light spot core image.

[0093] S210, matching the light spot core image with the first light spot outline image, removing the light spot outline that is not matched to the light spot core from the first light spot outline image to obtain a second light spot outline image.

[0094] S212, merging the second light spot outline image with the light spot core image to obtain a light spot image.

[0095] S214, filtering the light spot image from the gray scale image, and restoring the filtered image to an RGB color image.

[0096] In Figure 2 the first gray scale image is subjected to CLAHE adaptive equalization processing to improve the contrast of the gray scale image. Further, the images after the medium threshold binarization processing and the high threshold binarization processing can be subjected to open operation processing respectively to eliminate small block-shaped objects in the image and smooth the target image region boundary.

[0097] It should be noted that in Figure 2 the selection of the medium threshold and the high threshold is related to the material and color of the card itself, and can be adaptively selected according to these factors.

[0098] In the second possible scenario, during the preprocessing of the card image and the CLAHE adaptive equalization processing of the first gray scale image, the originally high exposure area in the card image can be weakened, resulting in light spot missing in the subsequent processing.

[0099] Considering the above problems, in some embodiments, the super-exposed image can be used to make up for this defect. The following takes the application of a card image processing method provided in the embodiment in the second image processing scenario as an example, and combines Figure 3 to further illustrate the card image processing method provided in the embodiment.

[0100] Please refer to Figure 3 , the card image processing method in this scenario includes the following steps:

[0101] S300, obtaining a card image.

[0102] S302, preprocessing the obtained card image to obtain a first gray scale image.

[0103] S304, performing CLAHE adaptive equalization processing on the first gray scale image to obtain a second gray scale image.

[0104] S306, sequentially performing binarization processing based on the first threshold value and open operation processing on the second gray-scale image to obtain a first light spot contour image.

[0105] S308, sequentially performing binarization processing based on the second threshold value and open operation processing on the second gray-scale image to obtain a light spot core image; the second threshold value is greater than the first threshold value.

[0106] S310, performing binarization processing based on a third threshold value on the second gray-scale image to obtain an overexposure image.

[0107] S312, matching the light spot core image with the first light spot contour image, and removing the light spot contour that is not matched to the light spot core from the first light spot contour image to obtain a second light spot contour image.

[0108] S314, determining a light spot distribution area image according to the second light spot contour image and the light spot core image, merging the light spot distribution area with the overexposure image to obtain a light spot image.

[0109] S316, filtering the light spot image from the gray-scale image, and restoring the filtered image to an RGB color image.

[0110] It should be noted that, in the Figure 3 In the scheme shown, the selection of the first threshold value, the second threshold value and the third threshold value is related to the material and color of the card itself, and can be adaptively selected according to these factors. For example, the first threshold value < the third threshold value < the second threshold value can be set.

[0111] In a third possible scenario, considering that in the card processing flow shown in Figure 2 Based on this, in some embodiments, a light spot foreground image can be used to further confirm the light spot image.

[0112] The following takes the application of a card image processing method provided in the embodiment in a third image processing scenario as an example, and combines Figure 4 to further illustrate the card image processing method provided in the embodiment.

[0113] Please refer to Figure 4 In this scenario, the card image processing method includes the following steps:

[0114] S400, obtaining a card image.

[0115] S402, preprocessing the obtained card image to obtain a first gray-scale image.

[0116] S404, performing CLAHE adaptive equalization processing on the first gray-scale image to obtain a second gray-scale image.

[0117] S406, sequentially performing binarization processing based on the first threshold value and open operation processing on the second gray-scale image to obtain a first light spot contour image.

[0118] S408, sequentially performing binarization processing based on the second threshold value and open operation processing on the second gray-scale image to obtain a light spot core image; the second threshold value is greater than the first threshold value.

[0119] S410, obtaining a light spot foreground image based on the gray-scale image.

[0120] In some embodiments, a median filtering processing based on a preset neighborhood window can be performed on each pixel in the gray-scale image to obtain a background gray-scale image and a foreground image. Here, a large kernel median filtering can be used, that is, the size of the field window is set to k*k, and k can take a large value, for example, k can be set to 100.

[0121] A difference image of the background gray-scale image and the foreground image is determined, binarization processing based on a fourth threshold value is performed on the difference image, and based on the result of the binarization processing, a light spot foreground image is obtained.

[0122] S412, matching the light spot core image with the first light spot contour image, and removing the light spot contour that is not matched to the light spot core from the first light spot contour image to obtain a second light spot contour image.

[0123] S414, determining a light spot distribution area image according to the second light spot contour image and the light spot core image, calculating the intersection of the light spot distribution area and the light spot foreground image to obtain a light spot image.

[0124] S416, filtering the light spot image from the gray-scale image, and restoring the filtered image to an RGB color image.

[0125] It should be noted that, in the scheme shown in Figure 4 The selection of the first threshold value, the second threshold value and the fourth threshold value is related to the material and color of the card itself, and can be adaptively selected according to these factors.

[0126] In the fourth scenario, the light spot missed detection and the misjudgment of the image area with a lighter color in the card can also be considered comprehensively. Based on this, the overexposure image and the light spot foreground image can be used to optimize the light spot image extraction. The following takes the application of a card image processing method provided in the embodiment in the fourth image processing scenario as an example, and combines the Figure 5 , the card image processing method provided in the embodiment is further described.

[0127] Please refer to Figure 5 , the card image processing method in this scenario includes the following steps:

[0128] S500, acquiring a card image.

[0129] S502, pre-process the acquired card image to obtain a first gray-scale image.

[0130] S504, perform CLAHE adaptive equalization processing on the first gray-scale image to obtain a second gray-scale image.

[0131] S506, sequentially perform binarization processing based on a first threshold value and open operation processing on the second gray-scale image to obtain a first light spot contour image.

[0132] S508, sequentially perform binarization processing based on a second threshold value and open operation processing on the second gray-scale image to obtain a light spot core image; the second threshold value is greater than the first threshold value.

[0133] S510, obtain a light spot foreground image based on the gray-scale image.

[0134] In some embodiments, each pixel in the gray-scale image can be subjected to median filtering processing based on a preset neighborhood window to obtain a background gray-scale image and a foreground image. Here, a large kernel median filtering can be used, that is, the size of the field window is set to k*k, and k can take a large value, for example, k can be set to 100. The difference image of the background gray-scale image and the foreground image is determined, the binarization processing based on a fourth threshold value is performed on the difference image, and the light spot foreground image is obtained based on the result of the binarization processing.

[0135] S512, perform binarization processing based on a third threshold value on the second gray-scale image to obtain an overexposure image.

[0136] S514, match the light spot core image with the first light spot contour image, and remove the light spot contour that is not matched to the light spot core from the first light spot contour image to obtain a second light spot contour image.

[0137] S516, determine a light spot distribution area image according to the second light spot contour image and the light spot core image, calculate the intersection image of the light spot distribution area and the light spot foreground image, and then take the union image of the intersection image and the overexposure image as the light spot image.

[0138] S518, filter the light spot image from the gray-scale image, and restore the filtered image to an RGB color image.

[0139] It should be noted that, in the scheme shown in Figure 5 The selection of the first threshold value, the second threshold value, the third threshold value and the fourth threshold value is related to the material and color of the card itself, and can be adaptively selected according to these factors.

[0140] Corresponding to the card image processing method described above, the present embodiment also provides a card image processing device and an electronic equipment. Please refer toFigure 6 , Figure 6 is an exemplary embodiment of a card image processing device shown in the hardware structure diagram of an electronic device. At the hardware level, the device includes a processor 601, a non-volatile readable storage medium 602, a memory 603, a network interface 604, and of course, other hardware required by the business. One or more embodiments of the present specification can be implemented in a software manner, such as reading a corresponding computer program from the non-volatile readable storage medium 602 into the memory 603 by the processor 601 and then running. Of course, in addition to the software implementation, one or more embodiments of the present specification do not exclude other implementation manners, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0141] Please refer to Figure 7 , Figure 7 is an exemplary embodiment of a card image processing device shown in the hardware structure diagram of an electronic device. At the hardware level, the device includes a processor 601, a non-volatile readable storage medium 602, a memory 603, a network interface 604, and of course, other hardware required by the business. One or more embodiments of the present specification can be implemented in a software manner, such as reading a corresponding computer program from the non-volatile readable storage medium 602 into the memory 603 by the processor 601 and then running. Of course, in addition to the software implementation, one or more embodiments of the present specification do not exclude other implementation manners, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices. Figure 6

[0142] The image acquisition module 701 is configured to acquire a target image in response to a card image recognition request.

[0143] The image preprocessing module 702 is configured to preprocess the target image to obtain a grayscale image.

[0144] The light spot identification module 703 is configured to perform a binarization processing based on a first threshold value on the grayscale image to obtain a first light spot contour image, perform a binarization processing based on a second threshold value on the grayscale image to obtain a light spot core image, and the first threshold value is less than the second threshold value; and filter the light spot contour without a core from the first light spot contour image based on the light spot core image to obtain a second light spot contour image, and determine a light spot image based on the light spot core image and the second light spot contour image.

[0145] The light spot filtering module 704 is configured to filter the light spot image from the target image.

[0146] In some embodiments, the image preprocessing module is specifically configured to perform a grayscale processing on the target image; and at least one of the following processing manners is performed on the image after the grayscale processing: a closing operation processing; and a median filter processing.

[0147] In some embodiments, the light spot identification module is specifically further configured to perform an adaptive histogram equalization processing on the grayscale image before performing the binarization processing based on the first threshold value and the second threshold value on the grayscale image, respectively.​

[0148] In some embodiments, the light spot identification module is specifically further configured to, after performing the first threshold-based binarization processing and the second threshold-based binarization processing on the gray-scale image respectively, perform an opening operation on the two obtained binarization images respectively to obtain the first light spot contour image and the light spot core image.

[0149] In some embodiments, the light spot identification module is specifically further configured to, based on the gray-scale image, obtain an overexposure image; based on the light spot core image and the second light spot contour image, determine a light spot distribution region image; and take a union image of the overexposure image and the light spot distribution region image as the light spot image.

[0150] Specifically, the light spot identification module obtains the overexposure image in the following manner: performing third threshold-based binarization processing on the gray-scale image, and determining the overexposure image based on a result of the binarization processing.

[0151] In some embodiments, the light spot identification module is specifically further configured to, based on the gray-scale image, obtain a light spot foreground image; based on the light spot core image and the second light spot contour image, determine a light spot distribution region image; and take an intersection of the light spot foreground image and the light spot distribution region image as the light spot image.

[0152] Specifically, the light spot identification module obtains the light spot foreground image in the following manner: performing median filter processing based on a preset neighborhood window on each pixel in the gray-scale image to obtain a background gray-scale image and a foreground image; determining a difference image of the background gray-scale image and the foreground image, performing fourth threshold-based binarization processing on the difference image, and obtaining the light spot foreground image based on a result of the binarization processing.

[0153] In some embodiments, the light spot identification module is specifically configured to, based on the gray-scale image, obtain a light spot foreground image and an overexposure image respectively; based on the light spot core image and the second light spot contour image, determine a light spot distribution region image; determine an intersection image of the light spot foreground image and the light spot distribution region image; and take a union image of the intersection image and the overexposure image as the light spot image.

[0154] Those skilled in the art should understand that the modules or steps of the present application described above can be implemented by a general-purpose computing device, which can be centralized on a single computing device or distributed on a network composed of multiple computing devices, and can be alternatively implemented by program codes executable by a computing device, so that they can be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described can be executed in different orders, or some of them can be made into individual integrated circuit modules, or some of them or all of them can be made into a single integrated circuit module. Thus, the present application is not limited to any particular combination of hardware and software.

[0155] One embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the card image processing method.

[0156] In one typical configuration, a computer includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0157] The memory can include non-persistent memory in computer readable media, random access memory (RAM), and / or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM), etc. The memory is an example of computer readable media.

[0158] Computer readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology for storing information. The information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, disk storage, quantum memory, graphene-based storage medium or other magnetic storage device, or any other non-transmission medium that can be used to store information accessible by a computing device. According to the definition herein, computer readable media does not include transitory media, such as modulated data signals and carriers.

[0159] It is also important to note that the term "comprising" or "including" or any other variation thereof is intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises a... " does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0160] The above description of certain examples of the application has been presented for the purposes of illustration and description. Other examples are within the scope and range of equivalents of the claims. In some cases, acts or steps can be performed in an order different from that of the examples provided and still accomplish the desired outcome. Additionally, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous.

[0161] The terminology used in this description of one or more embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the application. As used in this description of one or more embodiments of the application and the accompanying claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term "and / or," as used herein, refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0162] It will be understood that, although the terms first, second, third, etc. can be used herein to describe various information, these terms are used only to distinguish one piece of information from another, but do not imply a relationship between the information. For example, without departing from the scope of one or more embodiments of the application, a first piece of information could be termed a second piece of information, and a second piece of information could be termed a first piece of information. The term "if can be construed to mean "when" or "upon" or "in response to determining" depending on the context.

[0163] It should be noted that the above-mentioned embodiments illustrate rather than limit the application, and that those skilled in the art will be able to design many alternative embodiments without departing from the scope of the appended claims. Accordingly, the legal scope of the application is defined only by the appended claims.

Claims

1. A card / certificate image processing method, comprising: The target image is preprocessed to obtain a grayscale image; The grayscale image is binarized based on a first threshold to obtain a first spot contour image; The grayscale image is binarized based on a second threshold to obtain a core image of the light spot, wherein the first threshold is less than the second threshold; Based on the core image of the light spot, the coreless light spot contours are filtered from the first light spot contour image to obtain the second light spot contour image; Determining the spot image based on the spot core image and the second spot contour image specifically includes: Based on the grayscale image, an overexposed image is obtained; based on the core image of the light spot and the second light spot contour image, a light spot distribution area image is determined; the union image of the overexposed image and the light spot distribution area image is taken as the light spot image. Alternatively, based on the grayscale image, a foreground image of the light spot and the overexposed image are obtained respectively; based on the core image of the light spot and the second outline image of the light spot, a light spot distribution area image is determined; the intersection image of the foreground image of the light spot and the light spot distribution area image is determined; and the union image of the intersection image and the overexposed image is taken as the light spot image. Filter the spot image from the target image.

2. The method as described in claim 1, wherein the preprocessing of the target image to obtain a grayscale image specifically includes: The target image is converted to grayscale; for the grayscale image, at least one of the following processing methods is performed: Closing operation processing; as well as Median filtering processing.

3. The method as described in claim 1, wherein before performing binarization processing on the grayscale image based on the first threshold and the second threshold respectively, adaptive histogram equalization processing is further performed on the grayscale image.

4. The method as described in claim 1, after performing binarization processing on the grayscale image based on a first threshold and a second threshold respectively, further performing opening operation processing on the two obtained binarized images to obtain the first spot contour image and the spot core image.

5. The method as described in claim 1, wherein obtaining an overexposed image based on the grayscale image specifically includes: The grayscale image is binarized based on a third threshold, and the overexposed image is determined based on the result of the binarization.

6. A card image processing device, comprising: The image acquisition module is configured to acquire the target image in response to a card image recognition request; The image preprocessing module is configured to preprocess the target image to obtain a grayscale image; The spot recognition module is configured to perform binarization processing on the grayscale image based on a first threshold to obtain a first spot contour image, perform binarization processing on the grayscale image based on a second threshold to obtain a spot core image, wherein the first threshold is less than the second threshold; and filter spot contours without cores from the first spot contour image based on the spot core image to obtain a second spot contour image. The spot recognition module is further configured to obtain an overexposed image based on the grayscale image; determine a spot distribution area image based on the spot core image and the second spot contour image; and take the union image of the overexposed image and the spot distribution area image as the spot image. Alternatively, the spot recognition module is further configured to obtain a spot foreground image and the overexposed image based on the grayscale image; determine a spot distribution area image based on the spot core image and the second spot contour image; determine the intersection image of the spot foreground image and the spot distribution area image; and take the union image of the intersection image and the overexposed image as the spot image. A spot filtering module is configured to filter the spot image from the target image.

7. A computer-readable storage medium having a computer program stored thereon, the computer program, when executed by a processor, implementing the method as claimed in any one of claims 1 to 5.

8. An electronic device, comprising: One or more processors; and a memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Card image reflective detection method and device

    CN106228168A

  • Image processing method for obtaining corneal vertexes

    CN111462156A