License plate image enhancement method, device, equipment and storage medium

By calculating the perspective transformation matrix, the license plate is integrated into the real background, which solves the problem that virtual background is difficult to replace the real background in license plate recognition technology, improves the authenticity and consistency of license plate image enhancement, and improves the practical application effect of the algorithm model.

CN112967213BActive Publication Date: 2024-09-27SHENZHEN HONGDIAN TECH CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110159856.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-05
Publication Date
2024-09-27
Estimated Expiration
2041-02-05

AI Technical Summary

Technical Problem

In the existing license plate recognition technology, the data enhancement method through image synthesis has problems such as perspective distortion, the difficulty of replacing the real background with the virtual constructed background, and the difficulty in keeping the artificial license plate distortion and the distortion of the virtual constructed background consistent, resulting in high accuracy in algorithm model training but poor practical application. The effect is poor.

Method used

By obtaining the positional relationship between the vertices in the license plate to be enhanced and the background image to be fused, the perspective transformation matrix is ​​calculated, the license plate is integrated into the real background, and the enhanced license plate image is generated to ensure the matching and authenticity of the license plate and the background.

Benefits of technology

It effectively reduces the influence of perspective distortion, avoids the defects of virtual background, improves the authenticity and consistency of license plate image enhancement, and improves the practical application effect of the algorithm model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112967213B
    Figure CN112967213B
Patent Text Reader

Abstract

The present application provides a license plate image enhancement method, device, equipment and storage medium. The method includes: obtaining a first positional relationship between each vertex of the license plate to be enhanced and a second positional relationship between each vertex of the license plate position in the background image to be fused; calculating the perspective transformation matrix between the license plate to be enhanced and the background image to be fused according to the first positional relationship and the second positional relationship; fusing the license plate to be enhanced to the license plate position of the background image to be fused according to the transformation matrix to obtain an enhanced license plate image. The method effectively reduces perspective distortion by fusing the license plate with the real background image through the perspective transformation matrix, and avoids the influence of defects such as the difficulty of replacing the real background with the virtual constructed background and the difficulty of keeping the license plate distortion consistent with the virtual constructed background distortion on the enhanced image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of data processing technology, and in particular, relates to a license plate image enhancement method, device, equipment and storage medium. Background Art

[0002] Deep learning technology for big data, in order to obtain a high-precision algorithm model, the deep learning network needs to be trained with a large amount of labeled data. Supervised learning is the most important and widely used deep learning task. In supervised learning, the data sample set is the basis, and the size of the data sample set and the quality of the label directly determine the application effect of the algorithm model.

[0003] In the current license plate recognition technology, in order to improve the accuracy of the algorithm model for recognizing license plates, in addition to the more traditional data enhancement methods such as geometric transformation (such as flipping, rotation, cropping, deformation, scaling), color transformation (such as noise, blur, color transformation, erasing, filling), sample superposition (such as pixel superposition, cropping superposition), it is also proposed to achieve data enhancement through image synthesis to solve the defects of difficult sample collection, high workload, and long time consumption in traditional data enhancement methods. However, the inventors found that the existing data enhancement methods through image synthesis have defects such as perspective distortion, virtual background construction is difficult to replace the real background, and artificial license plate distortion is difficult to keep consistent with virtual background distortion, and these defects will cause the synthesized enhanced data to be too different from the actual application scenario, resulting in the problem that the algorithm model training accuracy is high but the actual application effect is poor. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a license plate image enhancement method, device, equipment and storage medium, which can effectively reduce the impact of defects such as perspective distortion, difficulty in replacing the real background with a virtual constructed background, and difficulty in maintaining consistency between artificial license plate distortion and virtual constructed background distortion on the enhanced image.

[0005] A first aspect of an embodiment of the present application provides a license plate image enhancement method, the license plate image enhancement method comprising:

[0006] Obtaining a first positional relationship between vertices of the license plate to be enhanced and a second positional relationship between vertices of the license plate position in the background image to be fused;

[0007] Calculating a perspective transformation matrix between the license plate to be enhanced and the background image to be fused according to the first position relationship and the second position relationship;

[0008] The license plate to be enhanced is fused to the license plate position of the background image to be fused according to the transformation matrix to obtain an enhanced license plate image.

[0009] In combination with the first aspect, in a first possible implementation manner of the first aspect, the step of calculating the perspective transformation matrix between the license plate to be enhanced and the background image to be fused according to the first position relationship and the second position relationship further includes:

[0010] Identify the license plate type of the license plate to be enhanced and the license plate type represented by the license plate position in the background image to be fused;

[0011] Compare the license plate type of the license plate to be enhanced with the license plate type represented by the license plate position in the background image to be fused, and determine the size difference between the license plate to be enhanced and the license plate position in the background image to be fused;

[0012] The second position relationship is subjected to difference compensation processing according to the size difference, and the perspective transformation matrix between the license plate to be enhanced and the background image to be fused is calculated according to the first position relationship and the second position relationship after difference compensation.

[0013] In combination with the first aspect, in a second possible implementation of the first aspect, before the step of obtaining a first positional relationship between vertices of the license plate to be enhanced and a second positional relationship between vertices of the license plate position in the background image to be fused, the step further includes:

[0014] Triggering a preset license plate synthesis model to generate a license plate to be enhanced, and obtaining material information used in synthesizing the license plate to be enhanced;

[0015] A background image to be fused that matches the license plate to be enhanced is selected from a preset real background image library according to the material information used when synthesizing the license plate to be enhanced.

[0016] In combination with the second possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, the preset license plate synthesis model is configured with a base material library, a text material library, a rivet library, a license plate frame material library, and a mask material library for synthesizing license plates, and the step of triggering the preset license plate synthesis model to generate the license plate to be enhanced includes:

[0017] A random function is configured for each material library in the preset license plate synthesis model, and a material for synthesizing the license plate to be enhanced is selected from each material library according to a random number generated by the random function.

[0018] In combination with the second possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, the step of selecting a background image to be fused that matches the license plate to be enhanced from a preset real background image library according to the material information used when synthesizing the license plate to be enhanced includes:

[0019] Determining the applicable vehicle model of the license plate to be enhanced according to the material information used when synthesizing the license plate to be enhanced;

[0020] According to the applicable vehicle model, a license plate background image matching the license plate to be enhanced is selected from the preset real background image library as the background image to be fused.

[0021] In combination with the second possible implementation manner of the first aspect, in a fifth possible implementation manner of the first aspect, the step of selecting a background image to be fused that matches the license plate to be enhanced from a preset real background image library according to the material information used when synthesizing the license plate to be enhanced includes:

[0022] Determining the size information of the license plate to be enhanced according to the material information used when synthesizing the license plate to be enhanced;

[0023] Acquire the license plate position size information of each license plate background image stored in the real background image library, compare the size information of the license plate to be enhanced with the license plate position size information of any license plate background image, and determine whether the size of the license plate to be enhanced is less than or equal to the license plate position size of the license plate background image for comparison;

[0024] If so, the license plate background image to be compared is selected as the background image to be fused that matches the license plate to be enhanced.

[0025] In combination with the first aspect, in a sixth possible implementation manner of the first aspect, the step of fusing the to-be-enhanced license plate to the license plate position of the to-be-fused background image according to the transformation matrix to obtain an enhanced license plate image includes:

[0026] According to the transformation matrix, the license plate to be enhanced is transformed into a shape consistent with the position of the license plate in the background image to be fused;

[0027] Creating a mask matrix according to the transformed license plate to be enhanced, wherein the mask matrix is ​​configured with a fusion weight of the license plate to be enhanced during image fusion;

[0028] The mask matrix is ​​used to weight and superimpose the transformed license plate to be enhanced onto the license plate position in the background image to be fused according to the fusion weights to obtain an enhanced license plate image.

[0029] A second aspect of an embodiment of the present application provides a license plate image enhancement device, the license plate image enhancement device comprising:

[0030] An acquisition module, used for acquiring a first position relationship between vertices of the license plate to be enhanced and a second position relationship between vertices of the license plate position in the background image to be fused;

[0031] A calculation module, used for calculating the perspective transformation matrix between the license plate to be enhanced and the background image to be fused according to the first position relationship and the second position relationship;

[0032] A fusion module is used to fuse the license plate to be enhanced to the license plate position of the background image to be fused according to the transformation matrix to obtain an enhanced license plate image.

[0033] A third aspect of an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the license plate image enhancement method as described in any one of the first aspects are implemented.

[0034] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the license plate image enhancement method as described in any one of the first aspects are implemented.

[0035] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0036] The present application obtains the first positional relationship between the vertices of the license plate to be enhanced and the second positional relationship between the vertices of the license plate position in the background image to be fused; calculates the perspective transformation matrix between the license plate to be enhanced and the background image to be fused according to the first positional relationship and the second positional relationship; fuses the license plate to be enhanced to the license plate position of the background image to be fused according to the transformation matrix to obtain an enhanced license plate image. This method effectively reduces perspective distortion by fusing the license plate with the real background image through the perspective transformation matrix, and avoids the influence of defects such as the difficulty of replacing the real background with the virtual constructed background and the difficulty of keeping the license plate distortion consistent with the virtual constructed background distortion on the enhanced image.

[0037] The present application generates the license plate to be enhanced by synthesizing the license plate through a license plate synthesis model, so that the style types of the license plate to be enhanced are rich, and the defects of manually collecting sample license plates, such as the difficulty, workload and time consumption, are overcome. In addition, the defect of few or no collection resources for special license plates such as military vehicles, embassy vehicles, and vehicles entering Hong Kong and Macao, is also overcome.

[0038] This application retains the authenticity of manually collected samples by collecting real license plate background images to replace the virtual constructed background. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application, 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0040] Figure 1 A schematic diagram of a basic method flow of a license plate image enhancement method provided in an embodiment of the present application;

[0041] Figure 2 A flow chart of a method for calculating a perspective transformation matrix in a license plate image enhancement method provided in an embodiment of the present application;

[0042] Figure 3 A schematic diagram of a license plate before and after size compensation is performed on the license plate in the license plate image enhancement method provided in an embodiment of the present application;

[0043] Figure 4 A flowchart of a method for obtaining a license plate to be enhanced and a background image to be fused in the license plate image enhancement method provided in an embodiment of the present application;

[0044] Figure 5 A flowchart of a method for selecting a background image to be fused according to an image to be enhanced in the license plate image enhancement method provided in an embodiment of the present application;

[0045] Figure 6 A schematic flow chart of another method for selecting a background image to be fused according to an image to be enhanced in the license plate image enhancement method provided in an embodiment of the present application;

[0046] Figure 7 A schematic flow chart of another method for selecting a background image to be fused according to an image to be enhanced in the license plate image enhancement method provided in an embodiment of the present application;

[0047] Figure 8 A schematic diagram of a mask matrix created in the license plate image enhancement method provided in an embodiment of the present application;

[0048] Fig. 9 A schematic diagram of the structure of a license plate image enhancement device provided in an embodiment of the present application;

[0049] Fig.10 A schematic diagram of an electronic device for implementing a license plate image enhancement method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0050] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0051] In order to illustrate the technical solution described in this application, a specific embodiment is provided below for illustration.

[0052] In some embodiments of this application, please refer to Figure 1 , Figure 1 A basic method flow chart of a license plate image enhancement method provided in an embodiment of the present application is described in detail as follows:

[0053] Step S11: obtaining a first positional relationship between the vertices of the license plate to be enhanced and a second positional relationship between the vertices of the license plate position in the background image to be fused.

[0054] In this embodiment, the license plate to be enhanced is configured as a composite license plate, which can be generated by constructing a license plate synthesis model. The composite license plate has a standard size, and its appearance is a regular rectangular shape. In this embodiment, the first positional relationship between the vertices of the license plate to be enhanced can be determined according to the two size parameters of the length and width of the license plate to be enhanced. Since the license plate to be enhanced is a regular rectangular shape, the license plate to be enhanced has four vertices, and the first positional relationship is the relative positional relationship between the four vertices of the license plate to be enhanced. The background image to be fused is an artificially collected, real license plate background image. In this embodiment, a variety of license plate background images are artificially collected in advance, and these real license plate background images are stored to obtain a real background image library. When it is necessary to perform a license plate image enhancement operation, any license plate background image can be obtained from the real background image library as the background image to be fused. For the real background image library, the license plate background images stored therein are used as the real background image materials required for performing the license plate image enhancement operation, and the license plate background images of various models (such as cars, buses, trucks, etc.), various scenes (such as roads, garages, elevated roads, etc.) and various weather conditions (such as sunny days, cloudy days, rainy days, snowy days, etc.) are covered as diversely as possible. The license plate background image contains the license plate, and because the license plate background image is affected by the perspective distortion of the lens when shooting, the shape of the license plate in the license plate background image is a general quadrilateral shape. The position of the general quadrilateral shape in the license plate background image is the license plate position. When a license plate background image is used as the background image to be fused, the second positional relationship between the four vertices of the general quadrilateral in the license plate background image and the length of each side can be obtained.

[0055] Step S12: Calculate the perspective transformation matrix between the license plate to be enhanced and the background image to be fused according to the first position relationship and the second position relationship.

[0056] In this embodiment, the four vertices of the license plate to be enhanced in the first position relationship P1 are P1 = (point1, point2, point3, point4), and the four vertices (point1, point2, point3, point4) are used as the coordinates of the license plate before perspective transformation. The four vertices of the license plate position to be fused with the background image in the second position relationship P2 are p2 = (post_point1, post_point2, post_point3, post_point4), and the four vertices (post_point1, post_point2, post_point3, post_point4) are used as the coordinates of the license plate after perspective transformation. According to the coordinates of the license plate before and after perspective transformation, the getPerspectiveTransform function in the OpenCV tool library is used to calculate the perspective transformation matrix warpMatrix between the synthesized license plate and the background image to be fused, that is, warpMatrix = getPerspectiveTransform (p1, p2).

[0057] Step S13: Fusing the license plate to be enhanced to the license plate position of the background image to be fused according to the transformation matrix to obtain an enhanced license plate image.

[0058] In this embodiment, the license plate to be enhanced is subjected to perspective transformation processing according to the perspective transformation matrix, so that the regular rectangular shape of the license plate to be enhanced can be transformed into a general quadrilateral shape consistent with the license plate position of the background image to be fused, so that the license plate to be enhanced and the license plate position of the background image to be fused can be superimposed and overlapped. Then, the license plate to be enhanced is fused to the license plate position of the background image to be fused by image superposition and fusion, so as to obtain an enhanced license plate image.

[0059] The above embodiment transforms the regular rectangular shape of the license plate to be enhanced into a general quadrilateral shape consistent with the position of the license plate in the background image to be fused through a perspective transformation matrix, and then fuses the transformed image to be enhanced into the background image to be fused by superposition fusion to obtain an enhanced license plate image. The license plate in the enhanced license plate image is a synthetic license plate with a rich variety of styles, and the background image is a real collected background image, which avoids the defects of the virtual construction background being difficult to replace the real background and the license plate distortion being difficult to keep consistent with the virtual construction background distortion, etc., which affect the enhanced image.

[0060] In this embodiment, Figure 2 This is a flow chart of a method for calculating the perspective transformation matrix in the license plate image enhancement method provided in the embodiment of the present application. The details are as follows:

[0061] Step S21: identifying the license plate type of the license plate to be enhanced and the license plate type represented by the license plate position in the background image to be fused;

[0062] Step S22: comparing the license plate type of the license plate to be enhanced with the license plate type represented by the license plate position in the background image to be fused, and determining the size difference between the license plate to be enhanced and the license plate position in the background image to be fused;

[0063] Step S23: performing difference compensation processing on the second position relationship according to the size difference, and calculating the perspective transformation matrix between the license plate to be enhanced and the background image to be fused according to the first position relationship and the second position relationship after difference compensation.

[0064] In some embodiments of the present application, when calculating the perspective transformation matrix, the influence of the size difference between different license plate types can also be considered at the same time, and the size compensation value deltaP is set according to the license plate position to be enhanced and the license plate position in the background image to be fused, and p2+deltaP is used as the coordinate after perspective transformation. Finally, the getPerspectiveTransform function in the OpenCV tool library is used to calculate the perspective transformation matrix warpMatrix between the license plate to be enhanced and the background image to be fused, that is, warpMatrix=getPerspectiveTransform(p1, p2+deltaP).

[0065] In this embodiment, the license plate type of the license plate to be enhanced and the license plate type represented by the license plate position in the background image to be fused are determined by image recognition. Different license plate types are configured with corresponding standard sizes. The size of the license plate to be enhanced is identified and the license plate type of the license plate is determined by comparing the identified size with the standard size for similarity; the size of the license plate position in the background image to be fused is identified and the license plate type represented by the license plate position is determined by comparing the identified size with the standard size for similarity. After the license plate type of the license plate to be enhanced and the license plate type represented by the license plate position in the background image to be fused are obtained, the license plate type of the license plate to be enhanced is compared with the license plate type represented by the license plate position in the background image to be fused, and the size difference between the license plate to be enhanced and the license plate position in the background image to be fused is compared, and the size difference between the license plate to be enhanced and the license plate position in the background image to be fused is determined. Furthermore, the second position relationship is difference compensated according to the size difference, and the perspective transformation matrix between the license plate to be enhanced and the background image to be fused is calculated according to the first position relationship and the second position relationship after difference compensation; thus, the transformed shape of the license plate to be enhanced obtained by the perspective transformation matrix is ​​more matched with the shape of the license plate position in the background image to be fused.

[0066] For example, please refer to Figure 3 , Figure 3 A schematic diagram of the license plate image enhancement method provided in the embodiment of the present application before and after the size compensation of the license plate. Assume that the license plate to be enhanced is a small new energy license plate with a standard size of 48cm×14cm. The size of the license plate position in the background image to be fused is 44cm×14cm (as shown in the figure, due to the perspective distortion of the lens during shooting, the license plate position in the background image to be fused is a general quadrilateral shape with an upper side length of W1 and a lower side length of W2). Figure 3 As shown, the size compensation of the license plate to be fused after perspective transformation is 1 / 2*(48-44) / 44=1 / 22 times the side length value of the side length W1 and the side length W2 at both ends.

[0067] In some embodiments of this application, please refer to Figure 4 , Figure 4 A flowchart of a method for obtaining a license plate to be enhanced and a background image to be fused in the license plate image enhancement method provided in an embodiment of the present application. Details are as follows:

[0068] Step S41: triggering a preset license plate synthesis model to generate a license plate to be enhanced, and obtaining material information used in synthesizing the image to be enhanced;

[0069] Step S42: selecting a background image to be fused that matches the license plate to be enhanced from a preset real background image library according to the material information used when synthesizing the license plate to be enhanced.

[0070] In this embodiment, a license plate synthesis model is pre-built to generate the license plate required for the enhanced image. In this embodiment, the license plate synthesis model is used to create a base material library, a text material library, a rivet library, a license plate frame library, and a mask material library for synthesizing license plates. In this embodiment, the base material library and the text material library are created by the license plate standard specified in the official public specification document. Rivet photos of different angles are obtained by real car collection or crawler, and then rivets of different angles are obtained by using PS cutout and other methods, and the rivet angle is added to the rivet picture naming rule to obtain the rivet library. Different types of license plate frames are obtained by test drive collection or crawler, and then license plate frames are extracted by using PS cutout and other methods to obtain the license plate frame material library. The mask material library is created by web crawler or self-made methods. The license plate synthesis model selects materials from each material database through random numbers generated by random functions, and then uses tools such as OpenCV to synthesize the selected materials into license plates to obtain license plates to be enhanced.

[0071] Exemplarily, by configuring a random function for each material library in the preset license plate synthesis model, the material for synthesizing the license plate to be enhanced is selected from each material library according to the random number generated by the random function. In this embodiment, when obtaining the enhanced license plate image, in combination with the needs of the user, the base material can be selected from the base material library and the text material can be selected from the text material library in accordance with the random number generated by the random function, and the selected base material and the selected text material are randomly combined to obtain a basic synthetic license plate. Furthermore, a random number r1 between 0 and 1 is generated based on the random function configured by the rivet library. If r1>0.5, two rivets with similar angles are randomly selected from the rivet library using tools such as OpenCV and superimposed on the two upper rivet positions of the basic synthetic license plate. Otherwise, four rivets with similar angles are randomly selected from the rivet library and superimposed on the four rivet positions of the basic synthetic license plate, so as to obtain a synthetic license plate after one superposition. The random function configured based on the license plate frame material library generates a random number r2 between 0 and 1. If r2>0.5, a license plate frame is randomly selected from the license plate frame material library using tools such as OpenCV and superimposed on the basic synthetic license plate or the synthetic license plate after one superposition, otherwise the superposition is empty this time, and a synthetic license plate after two superpositions is obtained. The random function configured based on the mask material library generates a random number r3 between 0 and 1, and generates a (0, 1) random number r. If r3>0.5, a mask is randomly selected from the mask library using tools such as OpenCV and superimposed on the basic synthetic license plate or the synthetic license plate after one superposition or the synthetic license plate after two superpositions, otherwise the superposition is empty this time, and a synthetic license plate after three superpositions is obtained. It can be understood that the basic synthetic license plate obtained above, the synthetic license plate after one superposition, the synthetic license plate after two superpositions, and the synthetic license plate after three superpositions can all become the license plate to be enhanced. It can be understood that the random number generated by the random function in the above embodiment is exemplary and is not a limitation of this application. The setting of the random function can be customized by the user.

[0072] In this embodiment, after obtaining the license plate to be enhanced, a background image to be fused that matches the license plate to be enhanced is selected from a preset real background image library according to the license plate to be enhanced. The license plate background images stored in the preset real background image library are diverse, covering license plate background images of various models (such as sedans, buses, trucks, etc.), various scenes (such as roads, garages, elevated roads, etc.) and various weathers (such as sunny days, cloudy days, rainy days, snowy days, etc.). In this embodiment, based on the material information used when synthesizing the image to be enhanced, the base material and license plate frame material selected by the license plate to be enhanced can be screened from the preset real background image library to select a license plate background image that matches the model, or / and the mask material selected by the license plate to be enhanced can be screened from the preset real background image library to select a license plate background image that matches the weather, thereby achieving the selection of a background image to be fused that matches the license plate to be enhanced from the preset real background image library.

[0073] In some embodiments of this application, please refer to Figure 5 , Figure 5 A flowchart of a method for selecting a background image to be fused according to an image to be enhanced in a license plate image enhancement method provided in an embodiment of the present application is as follows:

[0074] Step S51: determining the applicable vehicle model of the license plate to be enhanced according to the material information used when synthesizing the license plate to be enhanced;

[0075] Step S52: selecting a license plate background image that matches the license plate to be enhanced from the preset real background image library according to the applicable vehicle model as the background image to be fused.

[0076] In this embodiment, when determining the applicable vehicle model of the license plate to be enhanced, the applicable vehicle model of the license plate can be determined according to the license plate features by training a neural network classification model or creating a mapping relationship table between the license plate features and the applicable vehicle models. The preset real background image library stores license plate background images of various vehicle models, such as sedans, trucks, buses, etc. When removing the background image to be fused, try to select a background image that is consistent with the type of the license plate to be enhanced. For example, if the license plate to be enhanced is a special type of license plate such as a double-row yellow license plate, its applicable vehicle model is a truck. At this time, according to the applicable vehicle model, the license plate background image with the background of a truck should be selected from the preset real background image library as the background image to be fused. For another example, when the license plate to be enhanced is an ordinary single-row license plate, its applicable vehicle models are diverse, such as sedans, buses, etc. At this time, according to the applicable vehicle model, the license plate background image matching the vehicle model can be randomly selected from the preset real background image library as the background image to be fused.

[0077] In some embodiments of this application, please refer to Figure 6, Figure 6 This is a flow chart of another method for selecting a background image to be fused according to the image to be enhanced in the license plate image enhancement method provided in the embodiment of the present application. The details are as follows:

[0078] Step S61: determining the size information of the license plate to be enhanced according to the material information used when synthesizing the license plate to be enhanced;

[0079] Step S62: obtaining the license plate position size information of each license plate background image stored in the real background image library, comparing the size information of the license plate to be enhanced with the license plate position size information of any license plate background image, and determining whether the size of the license plate to be enhanced is less than or equal to the license plate position size of the license plate background image being compared;

[0080] Step S63: If yes, the license plate background image to be compared is selected as the background image to be fused that matches the license plate to be enhanced.

[0081] In this embodiment, when the license plate to be enhanced is fused with the background image to be fused, the license plate to be enhanced needs to completely cover the area range of the license plate position in the background image to be fused. Therefore, in the process of license plate image enhancement, when selecting the background image to be fused, the size information of the license plate to be enhanced can be first determined according to the material information used when synthesizing the license plate to be enhanced, and the license plate position size information of various license plate background images stored in the real background image library can be obtained. Then, by comparing the size information of the license plate to be enhanced with the license plate position size information of any license plate background image, it is determined whether the size of the license plate to be enhanced is less than or equal to the license plate position size of the license plate background image to be compared. If less than, it means that the license plate background image to be compared meets the requirement that the license plate to be enhanced completely covers the area range of the license plate position in the background image to be fused. At this time, the license plate background image to be compared can be selected as the background image to be fused that matches the license plate to be enhanced.

[0082] In some embodiments of this application, please refer to Figure 7 , Figure 7 This is a flow chart of another method for selecting a background image to be fused according to the image to be enhanced in the license plate image enhancement method provided in the embodiment of the present application. The details are as follows:

[0083] Step S71: transforming the license plate to be enhanced into a shape consistent with the position of the license plate in the background image to be fused according to the transformation matrix;

[0084] Step S72: creating a mask matrix according to the transformed license plate to be enhanced, wherein the mask matrix is ​​configured with the fusion weight of the license plate to be enhanced during image fusion;

[0085] Step S73: using the mask matrix, weighting and superimposing the transformed license plate to be enhanced onto the license plate position in the background image to be fused according to the fusion weight, to obtain an enhanced license plate image.

[0086] In this embodiment, please refer to Figure 8 , Figure 8 A schematic diagram of a mask matrix created in the license plate image enhancement method provided in the embodiment of the present application. Figure 8 As shown, with the boundary of the mask matrix as the reference, the fusion weight occupied by the license plate to be enhanced in the direction of the mask matrix is ​​gradually increased, that is, the closer to the inside of the mask matrix, the clearer the license plate to be enhanced is displayed; the fusion weight occupied by the license plate to be enhanced in the direction of the mask matrix is ​​0, that is, the background outside the license plate position only takes the background in the background image to be fused. In this embodiment, after the license plate to be enhanced is transformed into a shape consistent with the license plate position in the background image to be fused by the transformation matrix, a mask matrix frame 81 is created according to the shape of the transformed license plate to be enhanced, and then the ruler tool 82 is configured for the mask matrix according to the pre-set fusion weights The fusion weight occupied by the license plate to be enhanced during image fusion, so that the mask matrix for image fusion can be obtained. Then, using the created mask matrix, the transformed license plate to be enhanced is weighted and superimposed on the license plate position in the background image to be fused according to the fusion weights in the mask matrix, so as to obtain an enhanced license plate image.

[0087] It is understandable that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0088] In some embodiments of this application, please refer to Fig. 9 , Fig. 9 A schematic diagram of the structure of a license plate image enhancement device provided in an embodiment of the present application is described in detail as follows:

[0089] The license plate image enhancement device includes: an acquisition module 91, a calculation module 92 and a fusion module 93. The acquisition module 91 is used to obtain the first position relationship between the vertices of the license plate to be enhanced and the second position relationship between the vertices of the license plate position in the background image to be fused. The calculation module 92 is used to calculate the perspective transformation matrix between the license plate to be enhanced and the background image to be fused according to the first position relationship and the second position relationship. The fusion module 93 is used to fuse the license plate to be enhanced to the license plate position of the background image to be fused according to the transformation matrix to obtain an enhanced license plate image.

[0090] The license plate image enhancement device corresponds one-to-one to the above-mentioned license plate image enhancement method.

[0091] In some embodiments of this application, please refer to Fig.10 , Fig.10 A schematic diagram of an electronic device for implementing a license plate image enhancement method provided in an embodiment of the present application. Fig.10 As shown, the electronic device 10 of this embodiment includes: a processor 101, a memory 102, and a computer program 103 stored in the memory 102 and executable on the processor 101, such as a license plate image enhancement program. When the processor 101 executes the computer program 102, the steps in the above-mentioned license plate image enhancement method embodiments are implemented. Alternatively, when the processor 101 executes the computer program 103, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0092] Exemplarily, the computer program 103 may be divided into one or more modules / units, which are stored in the memory 102 and executed by the processor 101 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 103 in the electronic device 10. For example, the computer program 103 may be divided into:

[0093] An acquisition module, used for acquiring a first position relationship between vertices of the license plate to be enhanced and a second position relationship between vertices of the license plate position in the background image to be fused;

[0094] A calculation module, used for calculating the perspective transformation matrix between the license plate to be enhanced and the background image to be fused according to the first position relationship and the second position relationship;

[0095] A fusion module is used to fuse the license plate to be enhanced to the license plate position of the background image to be fused according to the transformation matrix to obtain an enhanced license plate image.

[0096] The electronic device may include, but is not limited to, a processor 101 and a memory 102. Those skilled in the art will appreciate that Fig.10 It is only an example of the electronic device 10 and does not constitute a limitation of the electronic device 10. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.

[0097] The processor 101 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0098] The memory 102 may be an internal storage unit of the electronic device 10, such as a hard disk or memory of the electronic device 10. The memory 102 may also be an external storage device of the electronic device 10, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 10. Further, the memory 102 may also include both an internal storage unit of the electronic device 10 and an external storage device. The memory 102 is used to store the computer program and other programs and data required by the electronic device. The memory 102 may also be used to temporarily store data that has been output or is to be output.

[0099] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0100] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0101] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0102] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0103] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0104] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0105] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. . Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0106] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A license plate image enhancement method, characterized in that: include: Obtaining a first positional relationship between vertices of the license plate to be enhanced and a second positional relationship between vertices of the license plate position in the background image to be fused; Calculating the perspective transformation matrix between the license plate to be enhanced and the background image to be fused according to the first position relationship and the second position relationship, including: identifying the license plate type of the license plate to be enhanced and the license plate type represented by the license plate position in the background image to be fused; comparing the license plate type of the license plate to be enhanced with the license plate type represented by the license plate position in the background image to be fused, and determining the size difference between the license plate to be enhanced and the license plate position in the background image to be fused; performing difference compensation processing on the second position relationship according to the size difference, and calculating the perspective transformation matrix between the license plate to be enhanced and the background image to be fused according to the first position relationship and the second position relationship after difference compensation; wherein, the license plate type of the license plate to be enhanced and the license plate type represented by the license plate position in the background image to be fused are determined by image recognition; The license plate to be enhanced is fused to the license plate position of the background image to be fused according to the transformation matrix to obtain an enhanced license plate image, including: transforming the license plate to be enhanced into a shape consistent with the license plate position in the background image to be fused according to the transformation matrix; creating a mask matrix according to the transformed license plate to be enhanced, the mask matrix being configured with a fusion weight occupied by the license plate to be enhanced during image fusion; using the mask matrix, weighting and superimposing the transformed license plate to be enhanced to the license plate position in the background image to be fused according to the fusion weight to obtain an enhanced license plate image.

2. The license plate image enhancement method according to claim 1, characterized in that: Before the step of obtaining the first positional relationship between the vertices of the license plate to be enhanced and the second positional relationship between the vertices of the license plate position in the background image to be fused, the method further includes: Triggering a preset license plate synthesis model to generate a license plate to be enhanced, and obtaining material information used in synthesizing the license plate to be enhanced; A background image to be fused that matches the license plate to be enhanced is selected from a preset real background image library according to the material information used when synthesizing the license plate to be enhanced.

3. The license plate image enhancement method according to claim 2, characterized in that: The preset license plate synthesis model is configured with a base material library, a text material library, a rivet library, a license plate frame material library and a mask material library for synthesizing license plates. The step of triggering the preset license plate synthesis model to generate the license plate to be enhanced includes: A random function is configured for each material library in the preset license plate synthesis model, and a material for synthesizing the license plate to be enhanced is selected from each material library according to a random number generated by the random function.

4. The license plate image enhancement method according to claim 2, characterized in that: The step of selecting a background image to be fused that matches the license plate to be enhanced from a preset real background image library according to the material information used when synthesizing the license plate to be enhanced includes: Determining the applicable vehicle model of the license plate to be enhanced according to the material information used when synthesizing the license plate to be enhanced; According to the applicable vehicle model, a license plate background image matching the license plate to be enhanced is selected from the preset real background image library as the background image to be fused.

5. The license plate image enhancement method according to claim 2, characterized in that: The step of selecting a background image to be fused that matches the license plate to be enhanced from a preset real background image library according to the material information used when synthesizing the license plate to be enhanced includes: Determining the size information of the license plate to be enhanced according to the material information used when synthesizing the license plate to be enhanced; Acquire the license plate position size information of each license plate background image stored in the real background image library, compare the size information of the license plate to be enhanced with the license plate position size information of any license plate background image, and determine whether the size of the license plate to be enhanced is less than or equal to the license plate position size of the license plate background image for comparison; If so, the license plate background image to be compared is selected as the background image to be fused that matches the license plate to be enhanced.

6. A license plate image enhancement device, characterized in that: The license plate image enhancement device comprises: An acquisition module, used for acquiring a first position relationship between vertices of the license plate to be enhanced and a second position relationship between vertices of the license plate position in the background image to be fused; A calculation module, used to calculate the perspective transformation matrix between the license plate to be enhanced and the background image to be fused according to the first position relationship and the second position relationship, including: identifying the license plate type of the license plate to be enhanced and the license plate type represented by the license plate position in the background image to be fused; comparing the license plate type of the license plate to be enhanced with the license plate type represented by the license plate position in the background image to be fused, and determining the size difference between the license plate to be enhanced and the license plate position in the background image to be fused; performing difference compensation processing on the second position relationship according to the size difference, and calculating the perspective transformation matrix between the license plate to be enhanced and the background image to be fused according to the first position relationship and the second position relationship after difference compensation; wherein, the license plate type of the license plate to be enhanced and the license plate type represented by the license plate position in the background image to be fused are determined by image recognition; A fusion module is used to fuse the license plate to be enhanced to the license plate position of the background image to be fused according to the transformation matrix to obtain an enhanced license plate image, including: transforming the license plate to be enhanced into a shape consistent with the license plate position in the background image to be fused according to the transformation matrix; creating a mask matrix according to the transformed license plate to be enhanced, and the mask matrix is ​​configured with a fusion weight occupied by the license plate to be enhanced during image fusion; using the mask matrix, weightedly superimposing the transformed license plate to be enhanced to the license plate position in the background image to be fused according to the fusion weight to obtain an enhanced license plate image.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the license plate image enhancement method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the license plate image enhancement method according to any one of claims 1 to 5 are implemented.