Method, device, equipment and medium for character contour detection by eliminating light influence
By performing multi-threshold binarization and contour unification processing on the target image, the impact of illumination changes on character contour detection is solved, and efficient character contour detection under different lighting conditions is achieved.
Patent Information
- Application Number
- CN202010511807.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-08
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2040-06-08
AI Technical Summary
The prior art is sensitive to illumination changes in character profile detection, resulting in inconsistent image processing effects under different lighting conditions, which may lead to incomplete or positioning errors in ticket characters.
By acquiring the target image and setting at least two binarization thresholds, the image is binarized to obtain multiple binarized images. Then, the suspected contour in each binarized image is extracted according to the contour standard, and if there is an intersection, the union processing is performed to obtain the final target contour.
This method can effectively eliminate the influence of illumination on character contour detection, process images under different lighting intensities, without secondary adjustment of binarization parameters, and improve the efficiency and accuracy of character contour detection.
Smart Images

Figure CN113255416B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of character detection, and in particular to a method, device, equipment and medium for character outline detection that eliminates light influence. Background Art
[0002] Light can affect the detection of character outlines. For example, in the process of identifying ticket numbers, since the identification environment is in the ticket box, it is necessary to use a fill light to assist the camera in shooting. However, the ticket position, camera shooting angle, and fill light intensity are not unique during the shooting process, so it is impossible to ensure that the brightness of the image collected in each ticket device remains consistent. To address this problem, the ticket number position is generally confirmed by binarizing the image.
[0003] However, most of the existing algorithms use a binary image as a pre-processing image for ticket number positioning. However, a binary parameter is often only effective for processing images with the same lighting. Since traditional binary processing methods are extremely sensitive to lighting, a slight difference in lighting may lead to positioning errors. For example, a binary parameter is effective for processing images with current lighting, and can well separate the complete ticket number. However, when the binary parameter is used to process the same target image with brighter lighting, the ticket number characters will be incomplete, and the incomplete ticket number characters cannot be used to complete subsequent ticket number positioning and recognition. Summary of the invention
[0004] Based on this, it is necessary to provide a character contour detection method, device, equipment and medium that eliminate the influence of light to address the above-mentioned problems, so as to realize character contour detection for images with different brightness.
[0005] A method for character contour detection that eliminates light influence, the method comprising:
[0006] Acquire a target image, set at least two binarization thresholds corresponding to the target image, and perform binarization processing on the target image according to the at least two binarization thresholds to obtain at least two corresponding binarized images;
[0007] Acquire a contour standard, and extract a suspected contour in each of the binary images according to the contour standard;
[0008] If there is an intersection between the extracted suspected contours, obtaining a union of the suspected contours with the intersection to obtain at least one union contour;
[0009] A union contour that meets the contour standard among the at least one union contour is used as a target contour.
[0010] In one embodiment, the acquiring of the target image, setting at least two binarization thresholds corresponding to the target image, and binarizing the target image according to the at least two binarization thresholds include:
[0011] Acquire the target image and the initial binarization threshold and the initial bias value corresponding to the target image;
[0012] Setting a modification step length, and modifying the initial bias value according to the modification step length to obtain at least one bias modification value;
[0013] The target image is binarized according to the binarization initial threshold, the bias initial value and the at least one bias modification value.
[0014] In one of the embodiments, after obtaining the corresponding at least two binary images, the method further includes:
[0015] Perform median filtering on the at least two binarized images.
[0016] In one embodiment, the contour standard includes a contour width standard and a contour height standard, and the step of obtaining the contour standard and extracting the suspected contour in each of the binary images according to the contour standard includes:
[0017] Identify the character outline of each character in the binary image, and obtain the circumscribed rectangular frame corresponding to the character outline;
[0018] The circumscribed rectangular frame is screened according to the outline width standard and the outline height standard, and the circumscribed rectangular frame that meets the outline width standard and the outline height standard is used as the suspected outline.
[0019] In one embodiment, the step of obtaining a union of suspected contours having intersections to obtain at least one union contour includes:
[0020] Acquire position information of all the suspected contours in the contour image, and integrate all the suspected contours in the at least two binary images into the target image according to the position information to generate a contour image;
[0021] The position information of all the suspected contours is judged according to the position information, and the suspected contours with overlapping position information are processed as a union, and the suspected contours located in the overlapping area are removed to obtain the at least one union contour.
[0022] In one of the embodiments, before acquiring the target image, the method further includes:
[0023] Acquire an image to be processed, identify a placement angle of the image to be processed, rotate the image to be processed according to the placement angle, and acquire a rotated image;
[0024] Acquire a valid area of the rotated image, and crop the rotated image according to the valid area to acquire a cropped image;
[0025] Performing Gaussian filtering denoising processing on the cropped image to obtain a denoised image;
[0026] Grayscale processing is performed on the denoised image to obtain the target image.
[0027] In one of the embodiments, after taking the union contour of the at least one union contour that meets the contour standard as the target contour, the method further comprises:
[0028] The target position information of the target contour is acquired, and valid information in the image to be processed is extracted according to the target position information.
[0029] A character contour detection device for eliminating light influence, the device comprising:
[0030] A binarization processing module, used for acquiring a target image, setting at least two binarization thresholds corresponding to the target image, and performing binarization processing on the target image according to the at least two binarization thresholds to obtain at least two corresponding binarized images;
[0031] A contour extraction module, used for obtaining a contour standard and extracting a suspected contour in each of the binary images according to the contour standard;
[0032] A union processing module, used for obtaining the union of the suspected contours with intersection if there is an intersection between the extracted suspected contours, and obtaining at least one union contour;
[0033] The screening module is used to take the union contour that meets the contour standard in the at least one union contour as the target contour.
[0034] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the following steps: acquiring a target image, setting at least two binarization thresholds corresponding to the target image, and binarizing the target image according to the at least two binarization thresholds to obtain at least two corresponding binarized images;
[0035] Acquire a contour standard, and extract a suspected contour in each of the binary images according to the contour standard;
[0036] If there is an intersection between the extracted suspected contours, obtaining a union of the suspected contours with the intersection to obtain at least one union contour;
[0037] A union contour that meets the contour standard among the at least one union contour is used as a target contour.
[0038] A character contour detection device for eliminating light influence comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following steps:
[0039] Acquire a target image, set at least two binarization thresholds corresponding to the target image, and perform binarization processing on the target image according to the at least two binarization thresholds to obtain at least two corresponding binarized images;
[0040] Acquire a contour standard, and extract a suspected contour in each of the binary images according to the contour standard;
[0041] If there is an intersection between the extracted suspected contours, obtaining a union of the suspected contours with the intersection to obtain at least one union contour;
[0042] A union contour that meets the contour standard among the at least one union contour is used as a target contour.
[0043] The present invention provides a method, device, equipment and medium for character contour detection that eliminates the influence of light. First, by acquiring a target image, at least two binarization thresholds corresponding to the target image are set, and the target image is binarized according to the at least two binarization thresholds to obtain at least two corresponding binarized images. Influenced by factors such as intensity, it is not known how to set the optimal binarization parameters in advance in this case. By presetting different binarization parameters for binarization, missed detection of characters can be avoided. Secondly, a contour standard is acquired, and suspected contours in each binarized image are extracted according to the contour standard. Pre-screening of suspected contours that do not meet the contour standard can eliminate the influence of some interfering contours. Finally, if there is an intersection between the extracted suspected contours, the union of the suspected contours with the intersection is acquired to obtain at least one union contour. The union contour that meets the contour standard in at least one union contour is used as the target contour. Therefore, the present invention can eliminate the influence of light on character contour detection, can process images of different brightness captured by a camera under different light intensities, does not need to perform secondary adjustment on the binarization parameters, and improves the detection efficiency and accuracy of the character contour. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] 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.
[0045] in:
[0046] Figure 1 It is a flow chart of a method for character outline detection for eliminating light influence in the first embodiment;
[0047] Figure 2 A schematic flow chart of a method for character contour detection for eliminating light influence in a second embodiment;
[0048] Figure 3 A schematic diagram of a bill to be processed image in the second embodiment;
[0049] Figure 4 is a schematic diagram of a bill target image in the second embodiment;
[0050] Figure 5 Schematic diagram of a multi-scale binary image of a bill in the second embodiment;
[0051] Figure 6 Schematic diagram of a multi-scale suspected contour image of a bill in the second embodiment;
[0052] Figure 7 is a schematic diagram of a bill outline image in the second embodiment;
[0053] Figure 8 is a schematic diagram of a bill outline union image in the second embodiment;
[0054] Fig. 9 A schematic diagram of a bill target contour image in the second embodiment;
[0055] Fig.10 It is a structural schematic diagram of a character contour detection device for eliminating light influence in one embodiment;
[0056] Fig.11 FIG. 4 is a structural block diagram of a character contour detection device for eliminating light influence in an embodiment. DETAILED DESCRIPTION
[0057] 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.
[0058] like Figure 1 As shown, Figure 1 This is a flow chart of a method for character contour detection that eliminates light effects in a first embodiment. The method for character contour detection that eliminates light effects can be specifically applied to scenarios such as bill character detection and document character detection. The steps provided in this embodiment include:
[0059] Step 102, acquiring a target image, setting at least two binarization thresholds corresponding to the target image, and binarizing the target image according to the at least two binarization thresholds to obtain at least two corresponding binarized images.
[0060] Among them, the target image can be a bill image, a certificate image, a banknote image, etc., depending on the specific application scenario. Since the difference in illumination has a great influence on the binarization of the image, in order to obtain a binarized image with a better processing effect, at least two binarization thresholds are set. The difference between the at least two binarization thresholds should be greater than a preset threshold, so that there is a more obvious difference in the binarization effect between the two binarized images. The preset threshold can be set by the user or by the device. Specifically, the binarization processing is to set the grayscale value of a certain point in the image to 255 (0) when the pixel value of a certain point in the image is greater than the binarization threshold, and to set the grayscale value of the pixel to 0 (255) when the pixel value of a certain point in the image is less than the binarization threshold.
[0061] Step 104 , obtaining a contour standard, and extracting a suspected contour in each binary image according to the contour standard.
[0062] In the process of character contour detection, interfering contours may appear. All contours are screened by contour standards to remove interfering contours and retain suspected contours. Among them, the contour standards can be contour size standards, contour position standards, etc.
[0063] In one embodiment, the contour standard is a contour position standard. Specifically, first, all contours in each binary image are extracted by the method of connecting the rectangular frame of the domain. Secondly, the position information of each contour is obtained. The position information can be the coordinate information of each point of the contour, or the coordinate information of the center point of the contour. Further, a position threshold is set and compared with the position information of each contour to determine whether the contour is within the preset position range of the suspected contour. The position threshold may include a horizontal maximum position threshold, a horizontal minimum position threshold, a vertical maximum position threshold and a vertical minimum position threshold. Finally, the contour within the preset position range is taken as a suspected contour, and the contour outside the preset position range is taken as an interference contour.
[0064] Step 106 , determining whether there is an intersection between the extracted suspected contours. If there is an intersection between the suspected contours, executing step 108 .
[0065] The existence of intersections between suspected contours can be expressed as partial overlap or complete overlap between suspected contours. For suspected contours with partial overlap, the judgment feature is that the contour lines intersect and there is partial overlap between the two contours. For suspected contours with complete overlap, the judgment feature is that one contour is completely overlapped. By identifying the above judgment features in the target image, it is determined whether there is an intersection between the extracted suspected contours.
[0066] Step 108: Obtain a union of suspected contours that have intersections, and obtain at least one union contour.
[0067] For suspected contours that partially overlap, the union of the suspected contours is achieved by taking the outermost contour line or the minimum circumscribed contour. The minimum circumscribed contour should cover all corresponding suspected contours with intersections on the image. In addition, for suspected contours that completely overlap, the union of the suspected contours can be achieved by directly removing the suspected contours in the overlapping area.
[0068] Step 110: taking a union contour that meets a contour standard in at least one union contour as a target contour.
[0069] The union contour is the contour obtained by unionizing the suspected contours that originally meet the contour standard. The union contour will be greater than or equal to any suspected contour it covers, so the union contour does not necessarily meet the contour standard. By screening the union contour, the interfering contours can be further removed.
[0070] The above-mentioned method for character contour detection that eliminates the influence of light, firstly, by acquiring a target image, setting at least two binarization thresholds corresponding to the target image, binarizing the target image according to the at least two binarization thresholds, and obtaining at least two corresponding binarized images. Affected by factors such as intensity, it is not known how to set the optimal binarization parameters in advance in this case. By presetting different binarization parameters for binarization, the omission of characters can be avoided. Secondly, the contour standard is obtained, and the suspected contours in each binarized image are extracted according to the contour standard. Pre-screening the suspected contours that do not meet the contour standard can eliminate the influence of some interfering contours. Finally, if there is an intersection between the extracted suspected contours, the union of the suspected contours with the intersection is obtained to obtain at least one union contour. The union contour that meets the contour standard in at least one union contour is used as the target contour. Therefore, the present invention can eliminate the influence of light on character contour detection, can process images of different brightness captured by the camera under different light intensities, does not need to adjust the binarization parameters twice, and improves the detection efficiency and accuracy of the character contour.
[0071] like Figure 2 As shown, Figure 2 This is a flow chart of a method for character contour detection for eliminating light influence in the second embodiment. The steps provided in this embodiment include:
[0072] Step 202, obtaining a target image and an initial binarization threshold and an initial offset value corresponding to the target image.
[0073] In one embodiment, Figure 3 As shown, Figure 3 It is a schematic diagram of the image to be processed of the bill in the second embodiment. This embodiment is specifically applied to the contour detection of bill characters. Before obtaining the target image and related binarization parameters, the image is preprocessed to facilitate the subsequent better binarization processing effect. Specifically, firstly, the image to be processed is obtained, the placement angle of the image to be processed is identified, and the image to be processed is rotated according to the placement angle to obtain a rotated image. Among them, the image to be processed can be obtained by shooting with the camera of the issuance module in the bill device. Figure 3The placement angle of the image to be processed identified in the figure is -180°. The image to be processed is rotated 180° clockwise to obtain a rotated image. Secondly, the valid area of the rotated image is obtained, and the rotated image is cropped according to the valid area to obtain a cropped image. Specifically, the valid area can be obtained by eliminating the invalid area in the rotated image, where the invalid area can include interference areas such as blank areas and background areas, or it can be cropped according to the position information of the preset valid area. Thirdly, the cropped image is subjected to Gaussian filtering and denoising to obtain a denoised image. Exemplarily, the Gaussian kernel size used in Gaussian filtering is 3×3. Finally, the denoised image is grayscaled to obtain the following: Figure 4 The target image is shown.
[0074] In this embodiment, the bias initial value refers to an initial value used to adjust the initial binarization threshold. It can be understood that the initial binarization threshold can be adjusted by further setting the bias value. Exemplarily, the bias initial value can be set to 15 or -15.
[0075] Step 204, setting a modification step length, and modifying the initial bias value according to the modification step length to obtain at least one bias modification value.
[0076] Among them, the modification step length refers to the modification value used to modify the initial value of the bias, and the modification step length further adjusts the initial threshold of binarization by modifying the initial value of the bias. In one embodiment, the modification step length is -3. If 4 bias modification values are required, the bias modification values 12, 9, 6, and 3 can be obtained respectively by modifying the initial value of the bias by modifying the modification step length. It can be understood that the modification step length can also be a positive number. The length of the modification step length and the number of bias modification values can be set according to the detection requirements. The smaller the length of the modification step length and the more the number of bias modification values, the higher the detection accuracy of the character contour.
[0077] Step 206 , binarizing the target image according to the binarization initial threshold, the bias initial value and at least one bias modification value to obtain at least two corresponding binarized images.
[0078] In one embodiment, Figure 5 As shown, Figure 5 Schematic diagram of the multi-scale binarization image of the bill in the second embodiment. In this embodiment, the binarization threshold is specifically determined by the initial binarization threshold and the initial bias value (Bias0), or by the initial binarization threshold and the bias modification value (Bias). Figure 5As shown in the figure, there are 5 binarization thresholds. Specifically, when the pixel value of a certain point in the image is greater than (binarization initial threshold + 15), the grayscale value of its pixel is set to 255 (0); when the pixel value of a certain point in the image is less than (binarization initial threshold + 15), the grayscale value of its pixel is set to 0 (255). In this way, one of the binarized images can be obtained. Similarly, the same binarization process is performed on other binarization thresholds as above, and finally the following can be obtained. Figure 5 The five binary images shown in FIG. 5 show that, among these five binary images, it can be clearly seen that when Bias=3, the effect of the binary image is the best.
[0079] In one embodiment, after obtaining at least two binary images, median filtering is performed on the at least two binary images. Median filtering is a nonlinear signal processing technology based on sorting statistics theory that can effectively suppress noise. The basic principle of median filtering is to replace the value of a point in a digital image or digital sequence with the median value of each point in a neighborhood of the point, so that the surrounding pixel values are close to the true value, thereby eliminating isolated noise points. The output of two-dimensional median filtering is:
[0080] g(x,y)=med{f(x-1,y-1),(k,1∈w)}
[0081] Where f(x, y) and g(x, y) are the original image and the processed image respectively. W is a two-dimensional template, usually a 3×3 or 5×5 area, and can also be in different shapes, such as line, circle, cross, or ring.
[0082] Step 208, identifying the character outline of each character in the binary image, and obtaining the circumscribed rectangular frame of the corresponding character outline.
[0083] In one embodiment, Figure 6 As shown, Figure 6 Schematic diagram of the multi-scale suspected contour image of the bill in the second embodiment. Specifically, firstly, the character contours in the obtained binary image are marked by the connected domain marking method and sorted by the number of connected domain pixels. Among them, the connected domain marking method can be a four-neighborhood marking algorithm or an eight-neighborhood marking algorithm. Secondly, a threshold is set for the number of connected domain pixels, and the connected domains whose number of pixels does not reach the threshold are filtered according to the threshold. Finally, the minimum circumscribed rectangular frame of each connected domain is calculated.
[0084] Step 210 , screening the circumscribed rectangular frames according to the outline width standard and the outline height standard, and taking the circumscribed rectangular frames that meet the outline width standard and the outline height standard as suspected outlines.
[0085] The outline width standard refers to the allowable range of the width of the circumscribed rectangular frame, and the outline height standard refers to the allowable range of the height of the circumscribed rectangular frame. In one embodiment, the outline width standard is limited to (5, 50), and the outline height standard is limited to (30, 100), where the units of the outline width standard and the outline height standard are both pixels. Screening the circumscribed rectangular frame can obtain the following: Figure 6 The suspected contours are further marked in the corresponding target images. In these target images, it can be seen that the detected contours are best when Bias=3, and in the case of other bias values, either the ticket number character contours are not detected or the detected ticket number character contours are incomplete.
[0086] Step 212, obtaining the position information of all the suspected contours in the contour image, and integrating all the suspected contours in at least two binary images into the target image according to the position information to generate a contour image.
[0087] In one embodiment, Figure 7 As shown, Figure 7 is a schematic diagram of a bill outline image in the second embodiment. Specifically, obtaining Figure 6 The position information of all suspected contours in the five binary images is obtained, and a target image is selected, and the suspected contours are integrated and marked in the target image according to the position information of all suspected contours. If the suspected contour is a rectangular contour, the obtained position information can be a combination of diagonal point coordinates or center point coordinates, such as a combination of diagonal point coordinates (20, 30), (50, 100) or a center point coordinate (35, 65).
[0088] Step 214, determining whether there is an intersection between the extracted suspected contours. If there is an intersection between the suspected contours, then executing step 216.
[0089] Specifically, if the suspected contour is a rectangular contour, when judging whether there is an intersection between two suspected contours, the longitudinal coordinates and the transverse coordinates of the diagonal points of one suspected contour are respectively judged to be within the coordinate range corresponding to the other suspected contour to judge whether there is an intersection. For example, if the diagonal point coordinate combination of a suspected contour is (20, 30) and (50, 100), and the diagonal point coordinate combination of another suspected contour is (60, 40) and (80, 120), by judging that the transverse coordinates (20, 50) of the first suspected contour do not coincide with the transverse coordinates (60, 80) of the second suspected contour, it can be judged that there is no intersection between the two suspected contours, and no union processing is required. In addition, if the coordinate combination of the diagonal points of a suspected contour is (20, 30), (50, 100), and the coordinate combination of the diagonal points of another suspected contour is (40, 40), (60, 120), since the horizontal coordinates (20, 50) of the first suspected contour overlap with the horizontal coordinates (40, 60) of the second suspected contour, and the vertical coordinates (30, 100) of the first suspected contour overlap with the vertical coordinates (40, 120) of the second suspected contour, there is an intersection between the two suspected contours, and a union process is required. It can be understood that for the case where there are three or more suspected contours that may have an intersection, the above method can also be used to determine the intersection.
[0090] Step 216: perform a union process on the suspected contours with overlapping position information, remove the suspected contours in the overlapping area, and obtain at least one union contour.
[0091] In one embodiment, it is achieved by taking the maximum position information contour of the suspected contours with overlapping position information. Specifically, if the diagonal point coordinate combination of a suspected contour is (20, 30), (50, 100), and the diagonal point coordinate combination of another suspected contour is (40, 40), (60, 120). Taking the maximum position information on the horizontal coordinate can obtain the minimum horizontal coordinate 20 and the maximum horizontal coordinate 60, and taking the maximum position information on the vertical coordinate can obtain the minimum vertical coordinate 30 and the maximum vertical coordinate 120. Furthermore, the above-mentioned maximum position information is integrated to obtain the diagonal point coordinate combination (20, 120), (60, 30) of the union contour. All suspected contours are processed as a union to obtain the following: Figure 8 It is understandable that, in the case where there are three or more suspected contours intersecting, the above method can also be used to perform the union process.
[0092] Step 218: taking a union contour that meets the contour standard in at least one union contour as a target contour.
[0093] In a specific implementation scenario, step 218 is basically the same as step 110 of the method for character contour detection to eliminate light effects in the first embodiment, and will not be described in detail here. Fig. 9 Target outline shown.
[0094] Step 220, obtaining target position information of the target contour, and extracting effective information in the image to be processed according to the target position information.
[0095] Specifically, character recognition can be performed on the target contour of the image. Since the determined target position information has been obtained, the success rate of extracting effective information is further improved. Fig. 9 In the schematic diagram of the bill target outline image shown, the extracted information includes "savings deposit certificate" and "000035". Further, the information is screened to obtain the valid information "000035". In other embodiments, the ID card number of the ID card can also be extracted, and the serial number of the banknote can also be extracted.
[0096] The above-mentioned method for character contour detection that eliminates the influence of light preprocesses the image before obtaining the target image and related binarization parameters, so that the subsequently obtained binarized image is optimized to a certain extent. In addition, by setting the initial binarization threshold, the initial bias value and the modification step size to adjust the binarization threshold, the accuracy of character contour detection can be guaranteed. By extracting effective information at the target contour, the subsequent use of effective information can be facilitated.
[0097] In one embodiment, Fig.10 As shown, a character contour detection device for eliminating light influence is proposed, the device comprising:
[0098] A binarization processing module 1002 is used to obtain a target image, set at least two binarization thresholds corresponding to the target image, and perform binarization processing on the target image according to the at least two binarization thresholds to obtain at least two corresponding binarized images;
[0099] The contour extraction module 1004 is used to obtain a contour standard and extract the suspected contour in each binary image according to the contour standard;
[0100] A union processing module 1006 is used to obtain the union of the suspected contours with intersections if there are intersections between the extracted suspected contours, and obtain at least one union contour;
[0101] The screening module 1008 is configured to use a union contour that meets the contour standard in at least one union contour as a target contour.
[0102] The above-mentioned character contour detection device for eliminating the influence of light, by acquiring a target image, setting at least two binarization thresholds corresponding to the target image, binarizing the target image according to the at least two binarization thresholds, and obtaining at least two corresponding binarized images. Affected by factors such as intensity, it is not known how to set the optimal binarization parameters in advance in this case. By presetting different binarization parameters for binarization, the missed detection of characters can be avoided. Secondly, the contour standard is obtained, and the suspected contours in each binarized image are extracted according to the contour standard. Pre-screening the suspected contours that do not meet the contour standard can eliminate the influence of some interfering contours. Finally, if there is an intersection between the extracted suspected contours, the union of the suspected contours with the intersection is obtained to obtain at least one union contour. The union contour that meets the contour standard in at least one union contour is used as the target contour. Therefore, the present invention can eliminate the influence of light on character contour detection, can process images of different brightness captured by the camera under different light intensities, does not need to adjust the binarization parameters twice, and improves the detection efficiency and accuracy of the character contour.
[0103] In one embodiment, the binarization processing module 1002 is also specifically used to: obtain the target image and the initial binarization threshold and the initial bias value of the corresponding target image; set the modification step size, modify the initial bias value according to the modification step size, and obtain at least one bias modification value; binarize the target image according to the initial binarization threshold, the initial bias value and at least one bias modification value.
[0104] In one embodiment, the binarization processing module 1002 is further specifically configured to perform median filtering on at least two binarized images.
[0105] In one embodiment, the contour standard includes a contour width standard and a contour height standard, and the contour extraction module 1004 is also specifically used to: identify the character contour of each character in the binary image, and obtain the circumscribed rectangular frame of the corresponding character contour; filter the circumscribed rectangular frame according to the contour width standard and the contour height standard, and use the circumscribed rectangular frame that meets the contour width standard and the contour height standard as a suspected contour.
[0106] In one embodiment, the union processing module 1006 is also specifically used to: obtain the position information of all suspected contours in the contour image, integrate all suspected contours in at least two binary images into the target image according to the position information to generate a contour image; make position information judgments on all suspected contours according to the position information, perform union processing on suspected contours with overlapping position information, remove suspected contours in the overlapping area, and obtain at least one union contour.
[0107] In one embodiment, the character contour detection device for eliminating the influence of light also includes an image preprocessing module, which is used to: obtain the image to be processed, identify the placement angle of the image to be processed, rotate the image to be processed according to the placement angle, and obtain the rotated image; obtain the effective area of the rotated image, crop the rotated image according to the effective area, and obtain the cropped image; perform Gaussian filtering denoising on the cropped image to obtain a denoised image; and grayscale the denoised image to obtain a target image.
[0108] In one embodiment, the character contour detection device for eliminating light influence further includes an effective information extraction module, which is used to: obtain target position information of the target contour, and extract effective information in the image to be processed according to the target position information.
[0109] Fig.11 FIG. 2 shows an internal structure diagram of a character contour detection device for eliminating light influence in one embodiment. Fig.11 As shown, the character contour detection device for eliminating the influence of light includes a processor, a memory and a network interface connected via a system bus. Among them, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the character contour detection device for eliminating the influence of light stores an operating system and may also store a computer program. When the computer program is executed by the processor, the processor can implement a method for character contour detection that eliminates the influence of light. The internal memory may also store a computer program. When the computer program is executed by the processor, the processor can implement a method for character contour detection that eliminates the influence of light. Those skilled in the art can understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present application, and does not constitute a limitation on the character contour detection device for eliminating light effects to which the scheme of the present application is applied. The specific character contour detection device for eliminating light effects may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0110] A character contour detection device for eliminating light influence comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented: acquiring a target image, setting at least two binarization thresholds corresponding to the target image, binarizing the target image according to the at least two binarization thresholds, and obtaining at least two corresponding binarized images; acquiring a contour standard, and extracting a suspected contour in each binarized image according to the contour standard; if there is an intersection between the extracted suspected contours, acquiring the union of the suspected contours with the intersection, and obtaining at least one union contour; and taking the union contour that meets the contour standard in at least one union contour as the target contour.
[0111] In one embodiment, a target image is acquired, at least two binarization thresholds corresponding to the target image are set, and the target image is binarized according to the at least two binarization thresholds, including: acquiring the target image and an initial binarization threshold and an initial bias value corresponding to the target image; setting a modification step length, modifying the initial bias value according to the modification step length to obtain at least one bias modification value; and binarizing the target image according to the initial binarization threshold, the initial bias value and at least one bias modification value.
[0112] In one embodiment, after obtaining the corresponding at least two binary images, the method further includes: performing median filtering on the at least two binary images.
[0113] In one embodiment, the contour standard includes a contour width standard and a contour height standard, and the contour standard is obtained, and the suspected contour in each binary image is extracted according to the contour standard, including: identifying the character contour of the character in each binary image, and obtaining the circumscribed rectangular frame corresponding to the character contour; screening the circumscribed rectangular frame according to the contour width standard and the contour height standard, and taking the circumscribed rectangular frame that meets the contour width standard and the contour height standard as the suspected contour.
[0114] In one embodiment, a union of suspected contours with intersections is obtained to obtain at least one union contour, including: obtaining position information of all suspected contours in a contour image, integrating all suspected contours in at least two binary images into a target image according to the position information to generate a contour image; judging the position information of all suspected contours according to the position information, performing a union process on suspected contours with overlapping position information, removing suspected contours in the overlapping area, and obtaining at least one union contour.
[0115] In one embodiment, before acquiring the target image, it also includes: acquiring the image to be processed, identifying the placement angle of the image to be processed, rotating the image to be processed according to the placement angle, and acquiring the rotated image; acquiring the effective area of the rotated image, cropping the rotated image according to the effective area, and acquiring the cropped image; performing Gaussian filtering denoising on the cropped image to acquire a denoised image; and gray-scaling the denoised image to acquire the target image.
[0116] In one embodiment, after taking the union contour that meets the contour standard in at least one union contour as the target contour, the method includes: acquiring target position information of the target contour, and extracting valid information in the image to be processed according to the target position information.
[0117] A computer-readable storage medium stores a computer program, which implements the following steps when executed by a processor: obtaining a target image, setting at least two binarization thresholds corresponding to the target image, binarizing the target image according to the at least two binarization thresholds, and obtaining at least two corresponding binarized images; obtaining a contour standard, and extracting suspected contours in each binarized image according to the contour standard; if there is an intersection between the extracted suspected contours, obtaining the union of the suspected contours with the intersection, and obtaining at least one union contour; and using the union contour that meets the contour standard in the at least one union contour as the target contour.
[0118] In one embodiment, a target image is acquired, at least two binarization thresholds corresponding to the target image are set, and the target image is binarized according to the at least two binarization thresholds, including: acquiring the target image and an initial binarization threshold and an initial bias value corresponding to the target image; setting a modification step length, modifying the initial bias value according to the modification step length to obtain at least one bias modification value; and binarizing the target image according to the initial binarization threshold, the initial bias value and at least one bias modification value.
[0119] In one embodiment, after obtaining the corresponding at least two binary images, the method further includes: performing median filtering on the at least two binary images.
[0120] In one embodiment, the contour standard includes a contour width standard and a contour height standard, and the contour standard is obtained, and the suspected contour in each binary image is extracted according to the contour standard, including: identifying the character contour of the character in each binary image, and obtaining the circumscribed rectangular frame corresponding to the character contour; screening the circumscribed rectangular frame according to the contour width standard and the contour height standard, and taking the circumscribed rectangular frame that meets the contour width standard and the contour height standard as the suspected contour.
[0121] In one embodiment, a union of suspected contours with intersections is obtained to obtain at least one union contour, including: obtaining position information of all suspected contours in a contour image, integrating all suspected contours in at least two binary images into a target image according to the position information to generate a contour image; judging the position information of all suspected contours according to the position information, performing a union process on suspected contours with overlapping position information, removing suspected contours in the overlapping area, and obtaining at least one union contour.
[0122] In one embodiment, before acquiring the target image, it also includes: acquiring the image to be processed, identifying the placement angle of the image to be processed, rotating the image to be processed according to the placement angle, and acquiring the rotated image; acquiring the effective area of the rotated image, cropping the rotated image according to the effective area, and acquiring the cropped image; performing Gaussian filtering denoising on the cropped image to acquire a denoised image; and gray-scaling the denoised image to acquire the target image.
[0123] In one embodiment, after taking the union contour that meets the contour standard in at least one union contour as the target contour, the method includes: acquiring target position information of the target contour, and extracting valid information in the image to be processed according to the target position information.
[0124] It should be noted that the above-mentioned method, device, equipment and computer-readable storage medium for character contour detection that eliminates the influence of light belong to a general inventive concept, and the contents of the embodiments of the method, device, equipment and computer-readable storage medium for character contour detection that eliminates the influence of light are applicable to each other.
[0125] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0126] 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.
[0127] 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 character contour detection to eliminate light influence, characterized in that: The method comprises: Acquire a target image, set at least two binarization thresholds corresponding to the target image, and perform binarization processing on the target image according to the at least two binarization thresholds to obtain at least two corresponding binarized images; Acquire a contour standard, and extract a suspected contour in each of the binary images according to the contour standard; If there is an intersection between the extracted suspected contours, a union of the suspected contours with the intersection is obtained to obtain at least one union contour; the intersection between the suspected contours is manifested as partial overlap or complete overlap between the suspected contours; taking a union contour that satisfies the contour standard among the at least one union contour as a target contour; The step of obtaining a union of suspected contours having intersections to obtain at least one union contour includes: Acquire position information of all the suspected contours in the contour image, and integrate all the suspected contours in the at least two binary images into the target image according to the position information to generate a contour image; The position information of all the suspected contours is judged according to the position information, and the suspected contours with overlapping position information are processed as a union, and the suspected contours located in the overlapping area are removed to obtain the at least one union contour.
2. The method according to claim 1, characterized in that The step of acquiring a target image, setting at least two binarization thresholds corresponding to the target image, and performing binarization processing on the target image according to the at least two binarization thresholds includes: Acquire the target image and the initial binarization threshold and the initial bias value corresponding to the target image; Setting a modification step length, and modifying the initial bias value according to the modification step length to obtain at least one bias modification value; The target image is binarized according to the binarization initial threshold, the bias initial value and the at least one bias modification value.
3. The method according to claim 2, characterized in that After obtaining the corresponding at least two binary images, the method further includes: Perform median filtering on the at least two binarized images.
4. The method according to claim 1, characterized in that: The contour standard includes a contour width standard and a contour height standard. The obtaining of the contour standard, extracting the suspected contour in each of the binary images according to the contour standard, includes: Identify the character outline of each character in the binary image, and obtain the circumscribed rectangular frame corresponding to the character outline; The circumscribed rectangular frame is screened according to the outline width standard and the outline height standard, and the circumscribed rectangular frame that meets the outline width standard and the outline height standard is used as the suspected outline.
5. The method according to claim 1, characterized in that Before acquiring the target image, the method further includes: Acquire an image to be processed, identify a placement angle of the image to be processed, rotate the image to be processed according to the placement angle, and acquire a rotated image; Acquire a valid area of the rotated image, and crop the rotated image according to the valid area to acquire a cropped image; Performing Gaussian filtering denoising processing on the cropped image to obtain a denoised image; Grayscale processing is performed on the denoised image to obtain the target image.
6. The method according to claim 5, characterized in that After taking the union contour of the at least one union contour that meets the contour standard as the target contour, the method comprises: The target position information of the target contour is acquired, and valid information in the image to be processed is extracted according to the target position information.
7. A character contour detection device for eliminating light influence, characterized in that: The device comprises: A binarization processing module, used for acquiring a target image, setting at least two binarization thresholds corresponding to the target image, and performing binarization processing on the target image according to the at least two binarization thresholds to obtain at least two corresponding binarized images; A contour extraction module, used for obtaining a contour standard and extracting a suspected contour in each of the binary images according to the contour standard; A union processing module is used for obtaining the union of the suspected contours with intersections if there is an intersection between the extracted suspected contours, and obtaining at least one union contour; the intersection between the suspected contours is manifested as partial overlap or complete overlap between the suspected contours; A screening module, configured to take a union contour that satisfies the contour standard among the at least one union contour as a target contour; The union processing module is further used to obtain the position information of all the suspected contours in the contour image, and integrate all the suspected contours in the at least two binary images into the target image according to the position information to generate a contour image; The position information of all the suspected contours is judged according to the position information, and the suspected contours with overlapping position information are processed as a union, and the suspected contours located in the overlapping area are removed to obtain the at least one union contour.
8. A computer-readable storage medium storing a computer program, wherein 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 6.
9. A character contour detection device for eliminating light influence, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method as claimed in any one of claims 1 to 6.
Citation Information
Patent Citations
Traffic sign detecting method based on self-adaptation threshold value
CN104732211A
License plate image boundary fitting method and device thereof
CN106778760A