Image correction method, device and computer-readable storage medium
By calculating the perspective transformation matrix and performing perspective transformation correction on the picture, the problem that the product in the picture cannot be recognized is solved, and effective picture correction effect is achieved.
Patent Information
- Application Number
- CN202111243556.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-25
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2041-10-25
AI Technical Summary
Due to factors such as shooting angle, direction, and height, the distortion of the shelves in the picture makes the product unrecognizable.
By obtaining the corner coordinates of the picture, the perspective transformation matrix is calculated, and the distorted picture is subject to perspective transformation correction. If the initial correction fails, a secondary correction is performed.
Effectively correct distortions in pictures to ensure that the product can be recognized in the corrected pictures.
Smart Images

Figure CN114078095B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image correction, and particularly to an image correction method, apparatus, and computer-readable storage medium. Background Art
[0002] For the fast-moving consumer goods industry, brand enterprises need to understand the in-store data of offline stores in a timely manner to understand the implementation performance and indicator achievement of their own marketing activities.
[0003] Brand enterprises can observe the market objectively, truly, and comprehensively through the pictures taken by stores and the recorded audio and video.
[0004] Due to the influence of shooting angle, direction, height, etc., the shelves in some of the captured pictures are distorted, resulting in the products in the pictures being unrecognizable. Summary of the Invention
[0005] The main purpose of the present invention is to provide an image correction method, apparatus, and computer-readable storage medium, aiming to solve the problem that products in pictures cannot be recognized.
[0006] To achieve the above object, the present invention provides an image correction method, which includes the following steps:
[0007] Obtain a corrected first picture, where the first picture is obtained by correcting a distorted second picture according to a first perspective transformation matrix, and the first perspective transformation matrix is obtained according to each first corner point of the second picture;
[0008] Determine that the first picture is not corrected successfully;
[0009] When the first picture is not corrected successfully, obtain each second corner point of the input second picture, and determine a second perspective transformation matrix according to the first coordinates of each second corner point and a preset perspective transformation matrix;
[0010] Perform perspective transformation on the second picture according to the second perspective transformation matrix.
[0011] In one embodiment, the step of obtaining the corrected first picture includes:
[0012] Obtain a distorted second picture;
[0013] Determine the second coordinates of each first corner point of the second picture;
[0014] Determine a first perspective transformation matrix according to each second coordinate and the preset perspective transformation matrix;
[0015] Perform a perspective transformation on the second picture according to the first perspective transformation matrix and the coordinates of each pixel point of the second picture to obtain a corrected first picture.
[0016] In one embodiment, the step of determining the second coordinates of each first corner point of the second picture includes:
[0017] Determine the target line corresponding to each side of the second picture;
[0018] Determine the intersection points of the target lines as the first corner points of the second picture, and obtain the second coordinates of each first corner point.
[0019] In one embodiment, the step of determining the target line corresponding to each side of the second picture:
[0020] Determine two or more target edge points among the first edge points of the side, where the coordinates of the target edge points satisfy a preset relationship with the target distance and the target angle, the target distance is the distance from the origin in the coordinate system to the perpendicular line of the straight line formed by each target edge point, and the target angle is the azimuth angle of the perpendicular line in the coordinate system;
[0021] Determine target pixel points among the pixel points of the second picture, where the distance from the origin to the perpendicular line of the straight line formed by the target pixel point and the target edge point is the target distance, and the azimuth angle of the perpendicular line from the origin to the straight line formed by the target pixel point and the target edge point in the coordinate system is the target angle;
[0022] Determine candidate lines according to the target pixel points and the target edge points;
[0023] When the length of the candidate line is greater than or equal to the preset length, determine the candidate line as the target line corresponding to the side.
[0024] In one embodiment, after the step of determining candidate lines according to the target pixel points and the target edge points, it further includes:
[0025] When the length of the candidate line is less than the preset length, re-determine two or more target edge points among the second edge points of the side, where the second edge points are the first edge points that have not been determined as target edge points;
[0026] Return to execute the step of determining target pixel points among the pixel points of the second picture.
[0027] In one embodiment, the step of determining that the first picture is not successfully corrected includes:
[0028] Input the first picture into an identification model to obtain identification information of the target object in the first picture by the identification model;
[0029] Determine whether the obtained identification information is the same as the preset identification information corresponding to the target object;
[0030] When the obtained identification information is different from the preset identification information, determine that the first picture has not been successfully corrected.
[0031] In one embodiment, the step of determining that the first picture has not been successfully corrected includes:
[0032] Display a confirmation interface, and the confirmation interface displays the first picture;
[0033] When a confirmation operation on the first picture on the confirmation interface is detected, according to the button corresponding to the confirmation operation on the confirmation interface, wherein the confirmation interface is provided with a button for successful correction and a button for unsuccessful correction;
[0034] When the button is the button for unsuccessful correction, determine that the first picture has not been successfully corrected.
[0035] In one embodiment, the step of obtaining each second corner point of the input second picture includes:
[0036] Output a marking interface, wherein the marking interface displays the second picture;
[0037] When a click operation on the marking interface is detected, obtain the second corner point of the input second picture according to the click operation.
[0038] To achieve the above object, the present invention further provides a picture correction device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it realizes each step of the picture correction method as described above.
[0039] To achieve the above object, the present invention further provides a computer-readable storage medium, which stores computer execution instructions. When the computer execution instructions are executed by a processor, they are used to realize each step of the picture correction method as described above.
[0040] The picture correction method, device, and computer-readable storage medium provided by the present invention. The picture correction device obtains the first picture corrected from the distorted second picture. If the second picture fails to be corrected successfully, it obtains each first corner point of the input second picture, determines the second perspective transformation matrix according to the coordinates of each second corner point and a preset perspective transformation matrix, and finally performs perspective transformation on the second picture according to each coordinate and the second perspective transformation matrix to obtain the corrected picture. In the present invention, the picture correction device first determines each first corner point of the distorted second picture, corrects the second picture based on the first perspective transformation matrix determined by each first corner point to obtain the first picture. If the first picture fails to be corrected, it obtains each second corner point of the input second picture, and finally corrects the second picture again based on the perspective transformation matrix determined by each second corner point. That is, the picture correction device corrects the distorted picture through secondary correction, so as to ensure that the product in the corrected picture can be recognized. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is a schematic hardware structure diagram of the picture correction device according to an embodiment of the present invention;
[0042] Figure 2 It is a schematic flowchart of the first embodiment of the picture correction method of the present invention;
[0043] Figure 3 It is a schematic detailed flowchart of step S10 in the second embodiment of the picture correction method of the present invention;
[0044] Figure 4 It is a schematic detailed flowchart of step S12 in the third embodiment of the picture correction method of the present invention.
[0045] The realization, functional features, and advantages of the object of the present invention will be further described in conjunction with the embodiments with reference to the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0046] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0047] The main solution of the embodiment of the present invention is as follows: Obtain the corrected first picture, where the first picture is obtained by correcting the distorted second picture according to the first perspective transformation matrix, and the first perspective transformation matrix is obtained according to each first corner point of the second picture determined by the picture correction device; Determine that the first picture is not successfully corrected; When the first picture is not successfully corrected, obtain each second corner point of the input second picture, and determine the second perspective transformation matrix according to the first coordinates of each second corner point and the preset perspective transformation matrix; Perform perspective transformation on the second picture according to the second perspective transformation matrix.
[0048] In the present invention, the picture correction device first determines each first corner point of the distorted second picture, and corrects the second picture based on the first perspective transformation matrix determined by each first corner point to obtain the first picture. If the first picture is not corrected, each second corner point of the input second picture is obtained, and finally, the second picture is corrected again based on the perspective transformation matrix determined by each second corner point. That is, the picture correction device corrects the distorted picture through secondary correction, so as to ensure that the product in the corrected picture can be recognized.
[0049] As Figure 1 shown, Figure 1 FIG. is a schematic hardware structure diagram of the picture correction device involved in the embodiment of the present invention. The picture correction device includes a processor 101, such as a CPU, a communication bus 102, and a memory 103. Among them, the communication bus 102 is used to realize the connection and communication between these components. Those skilled in the art can understand that Figure 1 the structure shown in
[0050] does not constitute a limitation on the picture correction device, and may include more or fewer components than shown in the figure, or combine some components, or arrange different components. Figure 1 As
[0051] shown in Figure 1 the device, the processor 101 can be used to call the computer program stored in the memory 103 and perform the following operations:
[0052] Obtain the corrected first picture, where the first picture is obtained by correcting the distorted second picture according to the first perspective transformation matrix, and the first perspective transformation matrix is obtained according to each first corner point of the second picture determined by the picture correction device;
[0053] Determine that the first picture is not successfully corrected;
[0054] If the first picture fails to be corrected successfully, obtain each second corner point of the input second picture, and determine a second perspective transformation matrix according to the first coordinates of each second corner point and a preset perspective transformation matrix;
[0055] Perform perspective transformation on the second picture according to the second perspective transformation matrix.
[0056] In one embodiment, the processor 101 may call a computer program stored in the picture correction device and further perform the following operations:
[0057] Obtain a distorted second picture;
[0058] Determine the second coordinates of each first corner point of the second picture;
[0059] Determine a first perspective transformation matrix according to each second coordinate and the preset perspective transformation matrix;
[0060] Perform perspective transformation on the second picture according to the first perspective transformation matrix and the coordinates of each pixel point of the second picture to obtain a corrected first picture.
[0061] In one embodiment, the processor 101 may call a computer program stored in the picture correction device and further perform the following operations:
[0062] Determine a target straight line corresponding to each side of the second picture;
[0063] Determine the intersection points of each target straight line as each first corner point of the second picture, and obtain the second coordinates of each first corner point.
[0064] In one embodiment, the processor 101 may call a computer program stored in the picture correction device and further perform the following operations:
[0065] Determine two or more target edge points among each first edge point of the side, where the coordinates of the target edge point satisfy a preset relationship with a target distance and a target angle, the target distance is the distance from the origin in the coordinate system to the perpendicular line of the straight line formed by each target edge point, and the target angle is the azimuth angle of the perpendicular line in the coordinate system;
[0066] Determine target pixel points among each pixel point of the second picture, where the distance from the origin to the perpendicular line of the straight line formed by the target pixel point and the target edge point is the target distance, and the azimuth angle of the perpendicular line of the straight line formed by the target pixel point and the target edge point in the coordinate system is the target angle;
[0067] Determine candidate straight lines according to each target pixel point and each target edge point;
[0068] When the length of the candidate straight line is greater than or equal to a preset length, determine the candidate straight line as the target straight line corresponding to the side.
[0069] In one embodiment, the processor 101 may call a computer program stored in the picture correction device and further perform the following operations:
[0070] When the length of the candidate straight line is less than the preset length, re-determine two or more target edge points among the respective second edge points of the side, where the second edge point is a first edge point that has not been determined as a target edge point;
[0071] Return to execute the step of determining target pixel points among the respective pixel points of the second picture.
[0072] In one embodiment, the processor 101 may call a computer program stored in the picture correction device and further perform the following operations:
[0073] Input the first picture into the recognition model to obtain recognition information of the target item in the first picture by the recognition model;
[0074] Determine whether the obtained recognition information is the same as the preset recognition information corresponding to the target item;
[0075] When the obtained recognition information is different from the preset recognition information, determine that the first picture has not been successfully corrected.
[0076] In one embodiment, the processor 101 may call a computer program stored in the picture correction device and further perform the following operations:
[0077] Display a confirmation interface, and the confirmation interface displays the first picture;
[0078] When a confirmation operation on the first picture on the confirmation interface is detected, according to the button corresponding to the confirmation operation on the confirmation interface, where the confirmation interface is provided with a button for successful correction and a button for unsuccessful correction;
[0079] When the button is the button for unsuccessful correction, determine that the first picture has not been successfully corrected.
[0080] In one embodiment, the processor 101 may call a computer program stored in the picture correction device and further perform the following operations:
[0081] Output a marking interface, where the marking interface displays the second picture;
[0082] When a click operation on the annotation interface is detected, obtain the second corner points of the input second picture according to the click operation.
[0083] In this embodiment, according to the above solution, the picture correction device obtains the first picture after correcting the distorted second picture. If the second picture fails to be corrected successfully, obtain each first corner point of the input second picture, and determine the second perspective transformation matrix according to the coordinates of each second corner point and the preset perspective transformation matrix. Finally, perform perspective transformation on the second picture according to each coordinate and the second perspective transformation matrix to obtain the corrected picture. In the present invention, the picture correction device first determines each first corner point of the distorted second picture, and corrects the second picture based on the first perspective transformation matrix determined by each first corner point to obtain the first picture. If the first picture fails to be corrected, obtain each second corner point of the input second picture, and finally re-correct the second picture based on the perspective transformation matrix determined by each second corner point, that is, the picture correction device corrects the distorted picture through secondary correction, so as to ensure that the products in the corrected picture can be recognized.
[0084] Based on the above hardware architecture of the picture correction device, an embodiment of the picture correction method of the present invention is proposed.
[0085] Refer to Figure 2 , Figure 2 This is the first embodiment of the picture correction method of the present invention. The picture correction method includes the following steps:
[0086] Step S10, obtain the corrected first picture, where the first picture is obtained by correcting the distorted second picture according to the first perspective transformation matrix, and the first perspective transformation matrix is obtained according to each first corner point of the second picture determined by the picture correction device.
[0087] In this embodiment, the execution subject is the picture correction device. For the convenience of description, the device is hereinafter used to refer to the picture correction device.
[0088] After taking pictures, the distorted pictures will be imported into the device. The distorted pictures are defined as the second pictures. The device will correct each second picture to obtain the corrected first picture.
[0089] Specifically, the device detects the sides of the second picture and determines the corner points of the second picture through each side. Since the picture is a quadrilateral, the second picture has four corner points, and the device can determine the four corner points of the second picture. In this embodiment, the corner points of the second picture are defined as the first corner points. The device can obtain the first perspective transformation matrix corresponding to the second picture through the coordinates of each first corner point and the preset perspective transformation matrix, and then the device performs perspective transformation on the coordinates of each pixel point of the second picture through the first perspective transformation matrix, so as to obtain the corrected first picture.
[0090] Step S20, determine that the first picture is not corrected successfully.
[0091] After obtaining the first picture, the device will verify whether the correction of the first picture is successful, that is, confirm whether the items in the first picture can be recognized. The device can display the first picture, and it can be determined whether the first picture is corrected successfully through the operation of the operator. For example, if the operation is a negative operation, it can be determined that the first picture is not corrected successfully. If the operation is a confirmation operation, it can be determined that the first picture is corrected successfully. The corrected first picture is saved as overwriting the second picture, and the first picture is stored in the database.
[0092] Step S30, when the first picture is not corrected successfully, obtain each second corner point of the input second picture, and determine the second perspective transformation matrix according to the first coordinates of each second corner point and the preset perspective transformation matrix.
[0093] The first picture that is not corrected successfully does not need to be saved. The device needs to perform secondary correction on the second picture corresponding to the first picture. Specifically, the device can output a prompt message to prompt the operator that the distorted second picture is not corrected successfully. The operator can input each second corner point of the second picture on the device. For example, the operator can click on the second picture, and the device marks the clicked position, and the marked points are the second corner points of the second picture. It should be noted that the second corner points refer to the corner points of the second picture input manually, while the first corner points are obtained by the device detecting the second picture.
[0094] The device obtains each second corner point of the input second picture, and re-obtains the perspective transformation matrix according to the first coordinates of each second corner point and the preset perspective transformation matrix. The re-obtained perspective transformation matrix is defined as the second perspective transformation matrix.
[0095] Step S40, perform perspective transformation on the second picture according to the second perspective transformation matrix.
[0096] After determining the second perspective transformation matrix, the device performs perspective transformation on the coordinates of each pixel point of the second picture based on the second perspective transformation matrix, and then the corrected picture can be obtained.
[0097] In the technical solution provided in this embodiment, the image correction device obtains the first image corrected from the distorted second image. If the second image fails to be corrected successfully, each first corner point of the input second image is obtained, and the second perspective transformation matrix is determined according to the coordinates of each second corner point and the preset perspective transformation matrix. Finally, the second image is perspectively transformed according to each coordinate and the second perspective transformation matrix to obtain the corrected image. In the present invention, the image correction device first determines each first corner point of the distorted second image, and corrects the second image based on the first perspective transformation matrix determined by each first corner point to obtain the first image. If the first image fails to be corrected, each second corner point of the input second image is obtained, and finally, the second image is corrected again based on the perspective transformation matrix determined by each second corner point, that is, the image correction device corrects the distorted image through secondary correction, so as to ensure that the product in the corrected image can be recognized.
[0098] Refer to Figure 3 , Figure 3 This is the second embodiment of the image correction method of the present invention. Based on the first embodiment, the step S10 includes:
[0099] Step S11, obtaining the distorted second image.
[0100] In this embodiment, the captured image is imported into the device, and the device can identify the imported image to determine the distorted second image. An identification model can be stored in the device. If the identification model can successfully identify the item in the image, the image is not a distorted image. If the identification model cannot identify the item in the image or the item identified by the identification model is incorrect, the image is a distorted image. Specifically, the identification model can identify the image multiple times. If the information identified by the identification model for the item in the same image is the same, the image is not a distorted image; if the information identified by the identification model for the item in the same image is different, the image is the distorted second image. The device stores the images that have not been distorted and screens out the distorted second images for correction. Of course, the imported images can be viewed manually. If an image is clicked as a distorted image, the image is placed in a preset folder waiting for correction by the device; if the image is clicked as a normal image, the image is stored in the database.
[0101] Step S12, determining the second coordinates of each first corner point of the second image.
[0102] After the device determines the second picture, it performs a straight-line detection on the sides of the second picture to obtain the straight line corresponding to each side, and the intersection point of each straight line is each first corner point of the second picture. The device then obtains the second coordinates of each first corner point. It should be noted that the first picture and the second picture are located in a coordinate system, so each pixel point of the first picture and the second picture has a corresponding coordinate in the coordinate system.
[0103] Step S13, determine the first perspective transformation matrix according to each of the second coordinates and the preset perspective transformation matrix.
[0104] The preset perspective transformation matrix is stored in the device, and (u, v) is the coordinate of the pixel point of the original picture, and the coordinate of the pixel after perspective transformation is Thus, it can be seen that and given the coordinates (u, v) of four corner points, a 11 、a 12 、a 13 、…a 33 can be solved, so as to obtain the first perspective transformation matrix.
[0105] Step S14, perform perspective transformation on the second picture according to the first perspective transformation matrix and the coordinates of each pixel point of the second picture to obtain the corrected first picture.
[0106] After determining the first perspective transformation matrix, the device inputs the coordinates of each pixel point in the second picture into , and the coordinates (x, y) of the pixel point after perspective transformation can be obtained. After each pixel point in the second picture is subjected to perspective transformation, the corrected first picture can be obtained.
[0107] In the technical solution provided in this embodiment, the device obtains the distorted second picture, determines the second coordinates of each corner point of the second picture, thereby determines the first perspective transformation matrix according to the second coordinates and the preset perspective transformation matrix, and finally performs perspective transformation on the second picture based on the first perspective transformation matrix and the coordinates of each pixel point of the second picture to obtain the corrected first picture.
[0108] Referring to Figure 4 , Figure 4 This is the third embodiment of the picture correction method of the present invention. Based on the second embodiment, the step S12 includes:
[0109] Step S121, determine the target straight line corresponding to each side of the second picture;
[0110] Step S122, determine the intersection point of each target straight line as each first corner point of the second picture, and obtain the second coordinates of each first corner point.
[0111] In this embodiment, the device detects straight lines on the sides of the second picture, so as to obtain the target straight lines corresponding to each side. Specifically, compared with the picture without distortion, for the distorted picture, the coordinates of some pixel points of the item have a large displacement, while the coordinates of some other pixel points of the item have a small displacement or no displacement, resulting in the deformation of the item and making the item unrecognizable. It can be seen that the sides of the distorted picture are not straight lines. When correcting the distorted picture, correction needs to be based on straight lines, that is, to ensure that the displacements generated by the pixel points forming the item in the picture do not differ too much. For this reason, the device needs to determine the target straight lines corresponding to the sides based on the sides of the second picture that are not straight lines. The device can first detect the sides of the second picture, and then obtain the target straight lines corresponding to the sides by performing straight line fitting on the sides. After determining the target straight lines, the device can determine the intersection points of each target straight line as the respective first corner points in the second picture, and then obtain the second coordinates of each second corner point.
[0112] In addition, the device can also determine the target straight lines corresponding to the sides in other ways. Specifically, the device determines two or more target edge points among the respective first edge points of the side, and the coordinates of the target edge points satisfy a preset relationship with the target distance and the target angle. The target distance is the distance from the origin in the coordinate system to the perpendicular line of the straight line formed by each of the target edge points, and the target angle is the azimuth angle of the perpendicular line in the coordinate system. The device then determines the target pixel points in the second picture, where the distance from the origin to the perpendicular line of the straight line formed by the target pixel point and the target edge point is the target distance, and the azimuth angle of the perpendicular line of the straight line formed by the target pixel point and the target edge point in the coordinate system is the target angle. The device can determine the candidate straight lines according to each target pixel point and the target edge points.
[0113] The principle for determining the candidate straight lines is as follows: (p, θ) in the coordinate system represents the candidate straight line, p is the target distance from the origin to the perpendicular line on the candidate straight line, and θ is the azimuth angle of the perpendicular direction in the coordinate system, and p = xsinθ + ycosθ, that is, the preset relationship is p = xsinθ + ycosθ. According to this principle, after the device determines two or more target edge points, it can find each target pixel point in the second picture.
[0114] After all target pixel points are found, each target pixel point and target edge points are connected to obtain candidate lines. A preset length is set in the device. The device determines the length of the candidate line and judges whether the length of the candidate line is greater than or equal to the preset length. If the length of the candidate line is greater than or equal to the preset length, the candidate line is determined as the target line corresponding to the side. If the length of the candidate line is less than the preset length, two or more target edge points are re-determined among the second edge points on the side. The second edge points are the first edge points that have not been determined as target edge points. The device then returns to execute the step of determining target pixel points among the pixel points of the second picture, that is, to determine candidate lines.
[0115] In the technical solution provided in this embodiment, the device determines the target line corresponding to each side of the second picture, and determines each first corner point in the second picture according to the intersection points of each target line, so as to accurately obtain the coordinates of the second intersection point.
[0116] In one embodiment, step S20 includes:
[0117] Input the first picture into the recognition model to obtain the recognition information of the target item in the first picture by the recognition model;
[0118] Determine whether the obtained recognition information is the same as the preset recognition information corresponding to the target item;
[0119] When the obtained recognition information is different from the preset recognition information, determine that the first picture has not been successfully corrected.
[0120] In this embodiment, the device is provided with a recognition model. The device inputs the first picture into the recognition model to obtain the recognition information of the target item in the first picture by the recognition model. The preset recognition information of the target item is stored in the device. The device compares the obtained recognition information with the preset recognition information, that is, the device determines whether the obtained recognition information is the same as the preset recognition information. If it is different, it can be determined that the first picture has not been successfully corrected. The preset recognition information can be the recognition information of the target item recognized by the recognition model last time (the recognition model needs to recognize the first picture multiple times).
[0121] In one embodiment, step S20 includes:
[0122] Display a confirmation interface, and the confirmation interface displays the first picture;
[0123] When a confirmation operation on the first picture on the confirmation interface is detected, according to the button corresponding to the confirmation operation on the confirmation interface, wherein the confirmation interface is provided with a button for successful correction and a button for unsuccessful correction;
[0124] When the button is a button for which the correction is not successful, it is determined that the first picture is not successfully corrected.
[0125] In this embodiment, after obtaining the first picture, the device displays a confirmation interface. The confirmation interface displays the first picture, and the confirmation interface is provided with a button for successful correction and a button for unsuccessful correction. When an operator views the first picture, if the information of the target object in the first picture can be clearly seen, the button for successful correction is clicked; if the information of the target object in the first picture cannot be clearly obtained, the button for unsuccessful correction can be clicked. It can be understood that when the device detects a confirmation operation on the first picture on the confirmation interface, if the button corresponding to the confirmation operation is a button for unsuccessful correction, it is determined that the first picture is not corrected.
[0126] In one embodiment, the step of obtaining each second corner point of the input second picture includes:
[0127] Output a labeling interface, where the labeling interface displays the second picture;
[0128] When a click operation on the labeling interface is detected, obtain the second corner point of the input second picture according to the click operation.
[0129] In this embodiment, when the device determines that the first picture is not successfully corrected, it can output a labeling interface. The labeling interface displays the second picture, and the user can click on the second picture in the labeling interface. The clicks made by the user in the labeling interface can be used to determine the corner points of the second picture, that is, when the user clicks on the corner points of the second picture in the labeling interface, and the device detects the click operation on the labeling interface, the second corner point of the second picture can be determined based on the pixel points targeted by the click operation.
[0130] The present invention also provides a picture correction device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements each step of the picture correction method described in the above embodiments.
[0131] The present invention also provides a computer-readable storage medium, which stores computer execution instructions. When the computer execution instructions are executed by a processor, they are used to implement each step of the picture correction method described in the above embodiments.
[0132] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments.
[0133] It should be noted that in this text, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the presence of additional identical elements in the process, method, article or device comprising such element.
[0134] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described example methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium as described above (such as ROM / RAM, magnetic disk, optical disc) and includes several instructions for causing a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in various embodiments of the present invention.
[0135] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. Any equivalent structural or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present invention.
Claims
1. A method for image correction, characterized in that, The picture correction method includes the following steps: Obtain a corrected first picture, where the first picture is obtained by correcting a distorted second picture according to a first perspective transformation matrix, and the first perspective transformation matrix is obtained according to each first corner point of the second picture; Determine that the first picture is not successfully corrected; When the first picture is not successfully corrected, obtain each second corner point of the input second picture, and determine a second perspective transformation matrix according to the first coordinates of each second corner point and a preset perspective transformation matrix; Perform perspective transformation on the second picture according to the second perspective transformation matrix; The step of obtaining the corrected first picture includes: Obtain a distorted second picture; Determine the second coordinates of each first corner point of the second picture; Determine a first perspective transformation matrix according to each second coordinate and the preset perspective transformation matrix; Perform perspective transformation on the second picture according to the first perspective transformation matrix and the coordinates of each pixel point of the second picture to obtain a corrected first picture; The step of determining the second coordinates of each first corner point of the second picture includes: Determine the target line corresponding to each side of the second picture; Determine the intersection points of each target line as each first corner point of the second picture, and obtain the second coordinates of each first corner point; The step of determining the target line corresponding to each side of the second picture: Determine two or more target edge points among each first edge point of the side, where the coordinates of the target edge point satisfy a preset relationship with the target distance and the target angle, the target distance is the distance from the origin in the coordinate system to the perpendicular line of the line formed by each target edge point, and the target angle is the azimuth angle of the perpendicular line in the coordinate system; Determine target pixel points among each pixel point of the second picture, where the distance from the origin to the perpendicular line of the line formed by the target pixel point and the target edge point is the target distance, and the azimuth angle of the perpendicular line of the line formed by the target pixel point and the target edge point in the coordinate system is the target angle; Determine a candidate line according to each target pixel point and each target edge point; When the length of the candidate line is greater than or equal to a preset length, determine the candidate line as the target line corresponding to the side; After the step of determining a candidate line according to each target pixel point and each target edge point, it further includes: When the length of the candidate line is less than the preset length, re-determine two or more target edge points among each second edge point of the side, where the second edge point is the first edge point that has not been determined as a target edge point; Return to execute the step of determining target pixel points among each pixel point of the second picture; The step of determining that the first picture is not successfully corrected includes: Input the first picture into an identification model to obtain the identification information of the target item in the first picture by the identification model; Determine whether the obtained identification information is the same as the preset identification information corresponding to the target item; When the obtained identification information is different from the preset identification information, determine that the first picture has not been successfully corrected; The step of determining that the first picture has not been successfully corrected includes: Display a confirmation interface, and the confirmation interface displays the first picture; When a confirmation operation on the first picture on the confirmation interface is detected, according to the button corresponding to the confirmation operation on the confirmation interface, wherein the confirmation interface is provided with a button for successful correction and a button for unsuccessful correction; When the button is the button for unsuccessful correction, determine that the first picture has not been successfully corrected; The step of obtaining each second corner point of the input second picture includes: Output a marking interface, wherein the marking interface displays the second picture; When a click operation on the marking interface is detected, obtain the second corner point of the input second picture according to the click operation.
2. An image correction device, characterized in that, The picture correction device includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements each step of the picture correction method according to claim 1.
3. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer execution instructions, and when the computer execution instructions are executed by a processor, they are used to implement each step of the picture correction method according to claim 1.
Citation Information
Patent Citations
Fold distortion QR code correcting method
CN108629221A
Image correction method, image correction device, computer equipment and storage medium
CN111860527A
Method and device for determining target category in picture
CN111950328A