CN113538252A - Image correction method and device - Google Patents

Image correction method and device Download PDF

Info

Publication number
CN113538252A
CN113538252A CN202010307251.XA CN202010307251A CN113538252A CN 113538252 A CN113538252 A CN 113538252A CN 202010307251 A CN202010307251 A CN 202010307251A CN 113538252 A CN113538252 A CN 113538252A
Authority
CN
China
Prior art keywords
corrected
coordinate values
predicted
feature points
coordinate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010307251.XA
Other languages
Chinese (zh)
Other versions
CN113538252B (en
Inventor
蒲朝飞
张楠赓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canaan Bright Sight Co Ltd
Original Assignee
Canaan Bright Sight Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canaan Bright Sight Co Ltd filed Critical Canaan Bright Sight Co Ltd
Priority to CN202010307251.XA priority Critical patent/CN113538252B/en
Priority to PCT/CN2020/118676 priority patent/WO2021208369A1/en
Publication of CN113538252A publication Critical patent/CN113538252A/en
Application granted granted Critical
Publication of CN113538252B publication Critical patent/CN113538252B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/80Geometric correction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/60Image enhancement or restoration using machine learning, e.g. neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/24Aligning, centring, orientation detection or correction of the image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/32Normalisation of the pattern dimensions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/46Descriptors for shape, contour or point-related descriptors, e.g. scale invariant feature transform [SIFT] or bags of words [BoW]; Salient regional features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

The application discloses an image correction method and device. The specific implementation scheme is as follows: acquiring configuration information of a region to be corrected in the image before correction, wherein the configuration information comprises coordinate values and offset of initial characteristic points; obtaining coordinate values of the predicted feature points according to the coordinate values and the offset of the initial feature points, taking the coordinate values of the predicted points as the coordinate values of the initial feature points, and returning to execute the predicting step; calculating the coordinate value of the corrected feature point according to the coordinate value of the predicted feature point; and under the condition of stopping prediction, generating a corrected image according to the coordinate values of all corrected feature points obtained by calculation. The image correction method avoids calculating the coordinate values of all the feature points in the image before correction, reduces the calculation amount, reduces the power consumption of hardware, improves the efficiency and the accuracy of image correction, and ensures that the corrected image is closer to a real front image.

Description

Image correction method and device
Technical Field
The present application relates to the field of image processing, and more particularly, to the field of image correction.
Background
In the field of computer vision, detecting and identifying objects are widely used, and the detected or identified objects may have angular distortions, resulting in poor accuracy of detection and identification. In order to improve the accuracy of detection and recognition, the distorted object needs to be restored to a front perspective picture. At present, a common method is to convert data such as a distortion angle and a pose parameter into a transformation matrix, such as a rotation angle matrix, a translation matrix, and a scaling matrix, and multiply coordinates of a distorted area in an image by the transformation matrix to obtain a corrected image. However, the conventional image rectification method has the disadvantages of large calculation amount, low efficiency and large hardware power consumption.
Disclosure of Invention
The embodiment of the application provides an image correction method and device, which are used for solving the problems in the related technology and have the following technical scheme:
in a first aspect, an embodiment of the present application provides an image rectification method, including:
acquiring configuration information of a region to be corrected in the image before correction, wherein the configuration information comprises coordinate values and offset of initial characteristic points;
obtaining coordinate values of the predicted feature points according to the coordinate values and the offset of the initial feature points, taking the coordinate values of the predicted points as the coordinate values of the initial feature points, and returning to execute the predicting step;
calculating the coordinate value of the corrected feature point according to the coordinate value of the predicted feature point;
and under the condition of stopping prediction, generating a corrected image according to the coordinate values of all corrected feature points obtained by calculation.
In one embodiment, calculating the coordinate values of the corrected feature points based on the coordinate values of the predicted feature points includes:
when the coordinate values of the predicted feature points are integers, the coordinate values of the predicted feature points are set as the coordinate values of the corrected feature points.
In one embodiment, calculating the coordinate values of the corrected feature points based on the coordinate values of the predicted feature points includes:
under the condition that the coordinate values of the predicted feature points are not completely integers, selecting the coordinate values of a plurality of adjacent feature points surrounding the predicted feature points according to the coordinate values of the predicted feature points, wherein the coordinate values of the adjacent feature points are integers;
determining a weight ratio according to the distance between each adjacent characteristic point and the predicted characteristic point;
acquiring a corresponding pixel value according to the coordinate value of each adjacent characteristic point, and calculating the pixel value of the corrected characteristic point according to the pixel value and the weight ratio of each adjacent characteristic point;
and converting the pixel value of the corrected feature point into a coordinate value of the corrected feature point.
In one embodiment, the method further comprises:
detecting a plurality of feature points in an area to be corrected by using a neural network model;
calculating a distortion angle and an attitude parameter according to the coordinate values of the plurality of feature points;
and obtaining the offset according to the distortion angle and the attitude parameter.
In one embodiment, the configuration information further includes a preset size parameter of the rectified image, and the condition for stopping prediction is generated according to the preset size parameter of the rectified image.
In a second aspect, an embodiment of the present application provides an image rectification apparatus, including:
the configuration information acquisition module is used for acquiring configuration information of a region to be corrected in the image before correction, wherein the configuration information comprises coordinate values and offset of the initial characteristic points;
the coordinate value calculation module of the predicted characteristic point is used for obtaining the coordinate value of the predicted characteristic point according to the coordinate value and the offset of the initial characteristic point;
the calculation triggering module is used for taking the coordinate value of the predicted point as the coordinate value of the initial characteristic point and indicating the coordinate value calculation module of the predicted characteristic point to execute the prediction step;
the coordinate value calculation module of the corrected feature point is used for calculating the coordinate value of the corrected feature point according to the coordinate value of the predicted feature point;
and the corrected image generation module is used for generating a corrected image according to the coordinate values of all the corrected feature points obtained by calculation under the condition of stopping prediction.
In one embodiment, the module for calculating coordinate values of corrected feature points includes:
and the first calculation submodule is used for taking the coordinate value of the predicted characteristic point as the coordinate value of the corrected characteristic point under the condition that the coordinate value of the predicted characteristic point is an integer.
In one embodiment, the module for calculating coordinate values of corrected feature points includes:
the adjacent characteristic point selection submodule is used for selecting the coordinate values of a plurality of adjacent characteristic points around the predicted characteristic point according to the coordinate values of the predicted characteristic point under the condition that the coordinate values of the predicted characteristic point are not completely integers, wherein the coordinate values of the adjacent characteristic points are integers;
the weight ratio calculation submodule is used for determining the weight ratio according to the distance between each adjacent characteristic point and the predicted characteristic point;
the second calculation submodule is used for acquiring corresponding pixel values according to the coordinate values of all the adjacent characteristic points and calculating the pixel values of the corrected characteristic points according to the pixel values and the weight ratios of all the adjacent characteristic points;
and the coordinate value conversion submodule is used for converting the pixel value of the corrected characteristic point into the coordinate value of the corrected characteristic point.
In one embodiment, the method further comprises:
the characteristic point detection module is used for detecting a plurality of characteristic points in the area to be corrected by utilizing the neural network model;
the parameter calculation module is used for calculating distortion angles and attitude parameters according to the coordinate values of the plurality of feature points;
and the offset calculation module is used for obtaining the offset according to the distortion angle and the attitude parameter.
In one embodiment, the configuration information further includes a preset size parameter of the rectified image, and the condition for stopping prediction is generated according to the preset size parameter of the rectified image.
In a third aspect, an electronic device is provided, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of the above.
In a fourth aspect, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions, wherein the computer instructions are for causing a computer to perform the method of any of the above.
One embodiment in the above application has the following advantages or benefits: and calculating the coordinate value of the predicted feature point by using the coordinate value and the offset of the initial feature point in the region to be corrected, calculating the coordinate value of the corrected feature point based on the coordinate value of the predicted feature point, continuously calculating the coordinate value of the next predicted feature point by using the coordinate value and the offset of the current predicted feature point, further obtaining the coordinate value of the next corrected feature point, and obtaining the corrected image according to the coordinate values of all corrected feature points until the prediction is stopped. The coordinate values of the feature points in the corrected image are predicted one by adopting the original data such as the offset corresponding to the image before correction, so that the operation of the coordinate values of all the feature points in the image before correction is avoided, the technical problems of large calculation amount, low efficiency and large hardware power consumption are solved, the calculation amount is reduced, the hardware power consumption is reduced, the image correction efficiency and accuracy are improved, and the technical effect that the corrected image is closer to a real front image is ensured.
Other effects of the above-described alternative will be described below with reference to specific embodiments.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
FIG. 1 is a schematic diagram of an image rectification method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an image rectification method according to another embodiment of the present application;
FIG. 3 is a diagram of a hardware scenario for implementing an image rectification method according to another embodiment of the present application;
FIG. 4 is a schematic diagram illustrating a calculation process of predicting coordinate values of feature points according to another embodiment of the present application;
FIG. 5 is a diagram illustrating a process of calculating pixel values of corrected feature points according to another embodiment of the present application;
FIG. 6 is a schematic view of an image rectification apparatus according to an embodiment of the present application;
FIG. 7 is a schematic view of an image rectification apparatus according to another embodiment of the present application;
fig. 8 is a block diagram of an electronic device for implementing an image rectification method according to an embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
As shown in fig. 1, the present embodiment provides an image correction method including the steps of:
s110: acquiring configuration information of a region to be corrected in the image before correction, wherein the configuration information comprises coordinate values and offset of initial characteristic points;
s120: obtaining coordinate values of the predicted feature points according to the coordinate values and the offset of the initial feature points, taking the coordinate values of the predicted points as the coordinate values of the initial feature points, and returning to execute the predicting step;
s130: calculating the coordinate value of the corrected feature point according to the coordinate value of the predicted feature point;
s140: and under the condition of stopping prediction, generating a corrected image according to the coordinate values of all corrected feature points obtained by calculation.
In an example, in a scene of image detection and recognition, there is a possibility that the detected object has angular distortion, a change in posture, and the like, resulting in poor accuracy of detecting and recognizing the object. In order to correct a distorted object to obtain a front perspective image, the present embodiment provides an image correction method. The pre-rectified image may include pedestrians, obstacles, various icons, buildings, and other surrounding environments. The size of the pre-rectified image may reach 256 × 256. In the image before correction, a rectangular frame can be used to mark the specific object to be corrected and the surrounding environment as the area to be corrected. For example, the first area to be corrected includes a side face of a pedestrian, and the side face is corrected to obtain a front face to recognize the face of the pedestrian. The second zone to be corrected comprises a notice board of 'construction ahead, no passage'. The notice board is distorted, so that the fonts cannot be accurately identified. The distorted notice board is corrected to obtain a notice board with a front display, so that the recognition rate is improved.
And acquiring configuration information of a region to be corrected in the image before correction. The configuration information includes coordinate values of the initial feature points and an offset amount. In the plane coordinate system in the image before correction, the coordinate value of the vertex of the upper left corner of the region to be corrected may be used as the coordinate value of the initial feature point. For example, the coordinate value of the initial feature point may be (x, y) ═ 0, 0. And calculating the offset according to the distortion angle and the posture parameter of the area to be corrected, wherein the offset can be represented by a vector. And calculating the coordinate value of the first predicted characteristic point according to the coordinate value and the offset of the initial characteristic point. To ensure that the pixel values corresponding to the coordinate values can be acquired, the coordinate values should be integers. Because the coordinate value of the first predicted feature point may not be an integer, in order to take the coordinate value of the integer, one or more adjacent feature points corresponding to the periphery of the first predicted feature point are obtained, the coordinate value of each adjacent feature point is an integer, and the pixel value corresponding to the coordinate value of each adjacent feature point is obtained. Meanwhile, the weight ratio may be determined according to the distance between each adjacent feature point and the first predicted feature point. And then, according to the pixel value and the weight ratio corresponding to the coordinate value of each adjacent feature point, calculating to obtain a final pixel value as the pixel value of the first corrected feature point, and converting the pixel value of the first corrected feature point into the coordinate value of the first corrected feature point.
And calculating the coordinate value of a second predicted characteristic point according to the coordinate value and the offset of the first predicted characteristic point, and executing subsequent steps to obtain the coordinate value of a second corrected characteristic point. And obtaining the coordinate value of the N (N is more than or equal to 1) th corrected feature point under the condition of stopping prediction. The value of the ordinate y in the coordinate values of the corrected feature points is usually 0, which indicates that N corrected feature points may be arranged according to the coordinate values of the first to nth corrected feature points to obtain a corrected image.
In this embodiment, the coordinate values of the predicted feature points are calculated by using the coordinate values and the offset of the initial feature points in the region to be corrected, the coordinate values of the corrected feature points are calculated based on the coordinate values of the predicted feature points, the coordinate values of the next predicted feature points are calculated by using the coordinate values and the offset of the current predicted feature points, and the coordinate values of the next corrected feature points are further obtained until the prediction is stopped, and the corrected image is obtained according to the coordinate values of all the corrected feature points. The coordinate values of the feature points in the corrected image are predicted one by adopting the original data such as the offset corresponding to the image before correction, so that the operation of the coordinate values of all the feature points in the image before correction is avoided, the calculation amount is reduced, the power consumption of hardware is reduced, the image correction efficiency and accuracy are improved, and the corrected image is ensured to be closer to a real front image.
In one embodiment, as shown in fig. 2, S130 includes:
s131: when the coordinate values of the predicted feature points are integers, the coordinate values of the predicted feature points are set as the coordinate values of the corrected feature points.
In one example, the coordinate values of the predicted feature point are (a, b), and in the case where the abscissa value a and the ordinate value b are both integers, the coordinate values of the predicted feature point are taken as the coordinate values of the corrected feature point. The calculation amount is obviously reduced, the image correction efficiency is improved, and the power consumption of hardware is reduced.
In one embodiment, as shown in fig. 2, S130: the method comprises the following steps:
s132: under the condition that the coordinate values of the predicted feature points are not completely integers, selecting the coordinate values of a plurality of adjacent feature points surrounding the predicted feature points according to the coordinate values of the predicted feature points, wherein the coordinate values of the adjacent feature points are integers;
s133: determining a weight ratio according to the distance between each adjacent characteristic point and the predicted characteristic point;
s134: acquiring a corresponding pixel value according to the coordinate value of each adjacent characteristic point, and calculating the pixel value of the corrected characteristic point according to the pixel value and the weight ratio of each adjacent characteristic point;
s135: and converting the pixel value of the corrected feature point into a coordinate value of the corrected feature point.
In one example, the coordinate values of the predicted feature points are not necessarily integers, and adjacent feature points whose surrounding coordinate values are integers are selected. For example, the coordinate values of the predicted feature point are (a, b), adjacent feature points located at the upper left, upper right, lower left and lower right are obtained according to the coordinate values (a, b) of the predicted feature point, the coordinate values of the four adjacent feature points are respectively a first coordinate value (a1, b1), a second coordinate value (a2, b2), a third coordinate value (a3, b3) and a fourth coordinate value (a4, b4), and the horizontal and vertical coordinates of the coordinate values of the four adjacent feature points are integers. In the case where the abscissa value a of the predicted feature point is an integer and the ordinate value b is not an integer, or in the case where the abscissa value a is not an integer and the ordinate value b is an integer, the coordinate values of arbitrary two adjacent feature points may be selected. For example, a combination of the first coordinate value (a1, b1) and the second coordinate value (a2, b2) may be selected, and the obtained pixel values are X1 and X2. Alternatively, a combination of the second coordinate value (a2, b2) and the third coordinate value (a3, b3) may be selected, and the obtained pixel values are X2 and X3. When the abscissa value a of the predicted feature point is not an integer and the ordinate value b is not an integer, a combination of the first coordinate value (a1, b1), the second coordinate value (a2, b2), the third coordinate value (a3, b3), and the fourth coordinate value (a4, b4) is selected, and the obtained pixel values are X1, X2, X3, and X4.
And determining the weight ratio between the selected adjacent characteristic points according to the distance between each adjacent characteristic point and the predicted characteristic point. For example, the weight ratio of the first coordinate value (a1, b1) and the second coordinate value (a2, b2) is w 1: w2 is 2:3, or the weight ratio of the second coordinate value (a2, b2) and the third coordinate value (a3, b3) is w 2: w3 is 4:5, or the weight ratio w1 of the first coordinate value (a1, b1), the second coordinate value (a2, b2), the third coordinate value (a3, b3) and the fourth coordinate value (a4, b 4): w 2: w 3: w4 is 1:5:2: 3. And obtaining the pixel value of the corrected feature point according to the pixel value and the weight ratio of each adjacent feature point. And finally, converting the pixel value of the corrected feature point into a coordinate value of the corrected feature point.
In this embodiment, each time the coordinate value of a predicted feature point is obtained through calculation, since the coordinate value of the predicted feature point may not be an integer and the corresponding pixel value cannot be directly obtained, adjacent feature points surrounding the predicted feature point and having the coordinate value as an integer are selected so as to obtain the pixel values of the adjacent feature points, and the pixel values of the corrected feature points are obtained by calculating the pixel values of the adjacent feature points, so as to obtain the coordinate values of the corrected feature points. The accuracy of the coordinate values of the corrected feature points is improved, and the corrected image formed by arranging the coordinate values of the corrected feature points is closer to a real front image.
In one embodiment, as shown in fig. 2, the method further includes:
s101: detecting a plurality of feature points in an area to be corrected by using a neural network model;
s102: calculating a distortion angle and an attitude parameter according to the coordinate values of the plurality of feature points;
s103: and obtaining the offset according to the distortion angle and the attitude parameter.
In one example, in a scene of face keypoint detection, a neural network model can be used to detect a plurality of feature points of a side face in a face image, and the region to be corrected includes the side face. The plurality of feature points may include feature points of positions of eyebrows, eyes, a nose, a mouth, a face contour, and the like. The neural network model may include a multitask Cascaded Convolutional neural network (MTCNN), and the like. And in the plane coordinate system, obtaining coordinate values of a plurality of detected feature points, and calculating the distortion angle and the attitude parameter according to the coordinate values of the feature points. For example, the twist angle and attitude parameters are derived by affine transformation formula.
In one embodiment, the configuration information further includes a preset size parameter of the corrected region, and the condition for stopping prediction is generated according to the preset size parameter of the corrected region.
In one example, the condition for stopping prediction is reached when the coordinate value of the nth corrected feature point is the same as the preset size parameter. Assuming that the preset size parameters of the rectified image include 100 pixels in width and 50 pixels in height, there are 100 predicted feature points in each row in the horizontal direction, and there are 50 rows in total.
In one embodiment, a process is provided for implementing an image rectification method at a hardware level. Fig. 3 is a diagram illustrating a hardware scenario for implementing an image rectification method according to an embodiment.
And sending the configuration information to a prediction calculation module (correlation _ alu), and calculating the coordinate values of the predicted feature points by the prediction calculation module (correlation _ alu) according to the coordinate values and the offset of the initial feature points in the configuration information.
On the one hand, the prediction calculation module (correlation _ alu) sends the coordinate values of the predicted feature points to the address acquisition module (fetch). And the address acquisition module (fetch) is used for reading the coordinate values of a plurality of adjacent characteristic points from the memory according to the coordinate values of the predicted characteristic points and acquiring the corresponding register addresses (mem). The register address is a full image of the physical memory and can be used to access the physical memory. The address fetch module (fetch) sends a plurality of register addresses (mem) to the data fetch module (biu in). The data acquisition module (biu in) inquires the coordinate values of the predicted characteristic points or the pixel values corresponding to the coordinate values of the adjacent characteristic points from the memory according to the register addresses (mem), and transmits a plurality of inquired pixel values back to the data acquisition module (biu in) by utilizing an advanced extensible Interface (AXI). AXI is a high performance, high bandwidth, low latency on-chip bus. The memory includes, but is not limited to, DDR (Double Data Rate, Double Data synchronous dynamic random access memory) and the like. The data acquisition module (biu in) sends the plurality of pixel values to the first buffer memory module (alu _ buf). On the other hand, the prediction calculation module (correlation _ alu) transmits the coordinate values of the predicted feature point or the coordinate values of a plurality of adjacent feature points to the weight calculation module (cmd _ fifo, command prompt, first input first output, first in first out memory). The weight calculation module (cmd _ fifo) is used for determining the weight ratio according to the distance between each adjacent characteristic point and the predicted characteristic point. For example, w 0: w 1: w 2: w3, and sends the weight ratio to the first buffer memory module (alu _ buf).
The first buffer storage module (alu _ buf) stores pixel values and weight ratios of a plurality of adjacent feature points. The first buffer storage module (alu _ buf) sends the pixel values and the weight ratios of the plurality of neighboring feature points to the correction calculation module (alu). And the correction calculation module (alu) is used for obtaining the pixel value of the corrected characteristic point according to the pixel value and the weight ratio of each adjacent characteristic point. Fig. 4 shows the effective pixel values P0, P1, P2, P3 and the corresponding weight ratios w0 according to four neighboring feature points: w 1: w 2: w3, a process of calculating pixel values of corrected feature points. P0 w0 ═ P0_ w, P1 w1 ═ P1_ w, w2 [ (P0_ w + P1_ w)/1000000] ═ P0_1_ w; p2 w0 ═ P2_ w, P3 w1 ═ P3_ w, w3 [ (P2_ w + P3_ w)/1000000] ═ P2_3_ w; (P0_1_ w + P2_3_ w)/1000000 represents the pixel value of the corrected feature point. And the correction calculation module (alu) sends the calculated pixel values of the corrected feature points to a second buffer storage module (wb _ buf) for temporary storage. The second buffer storage module (wb _ buf) converts the pixel values of the corrected feature points into coordinate values of the corrected feature points and sends the coordinate values to the data output module (biu out). And the data output module (biu out) inputs the coordinate values of the corrected feature points into the memory through the bus AXI.
Fig. 5 shows a calculation process of obtaining the coordinate values of the predicted feature points by the prediction calculation module (correlation _ alu) according to the coordinate values (x, y) of the initial feature points and the offset.
First, the offset amount may be decomposed in the horizontal direction and the vertical direction, resulting in a first offset amount h _ delta and a second offset amount v _ delta, respectively. h _ delta includes two components of an abscissa axis h _ delta _ x and an ordinate axis h _ delta _ y, and v _ delta includes two components of an abscissa axis v _ delta _ x and an ordinate axis v _ delta _ y.
In the horizontal direction, the abscissa values x of the initial feature points in the first row are accumulated by h _ delta _ x to obtain the abscissa value of the first predicted feature point. For example, if the abscissa value x of the initial feature point is 0, the abscissa value of the first predicted feature point is h _ delta _ x. And h _ delta _ x needs to be corrected before calculating the abscissa value of the second predicted feature point, wherein the correction mode is that h _ delta _ x is accumulated with h _ delta _ acc _ x to obtain the corrected h _ delta _ x. Wherein, h _ delta _ acc _ x is a correction value of the offset in the horizontal direction, and the function is to allow the nonlinear value h _ delta _ x to have a certain change. And by analogy, accumulating the abscissa values of the first predicted feature point by h _ delta _ x to obtain the abscissa value of the second predicted feature point, and revising each time the abscissa value of one predicted feature point is calculated, and repeating the steps until the end of the first row. If the ordinate value y of the initial feature point is 0, the ordinate value of the first predicted feature point is h _ delta _ y. The correction of h _ delta _ y is in accordance with the above-described correction.
In the vertical direction, the abscissa values x of the initial feature points of the first row are added up by v _ delta _ x as the abscissa values of the initial feature points of the second row. For example, if the abscissa value x of the initial feature point of the first row is 0, the abscissa value of the initial feature point of the second row is v _ delta _ x. And accumulating v _ change _ delta on the abscissa value of the first predicted feature point in the first row to obtain the abscissa value of the first predicted feature point in the second row. v _ change _ delta is the first correction of the vertical offset. After accumulating v _ change _ delta in the abscissa value of the first predicted feature point in the first row, the correction is continued, that is, the second correction value v _ change _ acc of the offset in the horizontal direction is accumulated again, so as to obtain the corrected coordinate value of the first predicted feature point in the second row. And the second line calculates the coordinate values of the plurality of predicted characteristic points according to the same rule as the first line, and the steps are repeated until the second line is finished. And so on until the end of line N (N is greater than or equal to 1).
The computing module (correlation _ alu) also selects a plurality of neighboring feature points around for each coordinate value of the predicted feature point, for example, four neighboring feature points are usually selected, and are respectively located at the upper left, upper right, lower left and lower right of the predicted feature point. And obtaining coordinate values of four adjacent characteristic points, wherein the coordinate values of the four adjacent characteristic points are all integers, and only the integers have corresponding pixel values.
In one example, an image rectification apparatus in a hardware device receives configuration information, and parameters included in the configuration information are shown in table 1.
Configuration information Configuring content Description of the invention
dst_width 5 Preset size parameter width of corrected image
dst_height 8 Preset size parameter height of rectified image
start_x 3 Coordinate values of initial feature points
start_y 2 Coordinate values of initial feature points
init_h_delta_x 1.1 Initial horizontal x offset
init_h_delta_y 0.2 Initial horizontal y offset
h_delta_acc_x 0.001 Correction of horizontal x offset
h_delta_acc_y 0.002 Correction of horizontal y-offset
v_change_delta_x 0.01 Correction of horizontal x-offset when line changes
v_change_delta_y 0.03 Correction of horizontal y-offset when line changes
v_change_acc_x 0.0001 Quadratic correction of horizontal x-offset when line changes
v_change_acc_y 0.0003 Second correction of horizontal y offset when line changes
v_delta_x 0.3 Offset x in vertical direction
v_delta_y 1.3 Offset y in vertical direction
v_delta_acc_x 0.0002 Correction of vertical x offset
v_delta_acc_y 0.0004 Correction of vertical x offset
TABLE 1
(1) Calculating a pixel value corresponding to the coordinate (x, y) ═ 0, 0 of the corrected feature point, and the specific process comprises the following steps:
1.1, the prediction calculation module (cordinate _ alu) extracts the coordinate values (3, 2) of the initial feature points of the region to be corrected from the configuration information, and sends the coordinate values (3, 2) of the initial feature points of the region to be corrected to the address acquisition module (fetch) and the weight calculation module (cmd _ fifo).
After receiving the coordinate values (3, 2) of the initial feature point, the address obtaining module (fetch) 1.2 reads a plurality of adjacent feature point coordinate values from the memory, including a first coordinate value (a1, b1) ═ 3, 2), (a2, b2) ═ 4, 2), (a3, b3) ═ 3, and a fourth coordinate value (a4, b4) ═ 4, 3, and queries the pixel values of the four adjacent feature points from the memory according to the register address.
After receiving the coordinate values (3, 2) of the initial feature point, the weight calculation module (cmd _ fifo) 1.3 calculates four weights w0, w1, w2, and w3 as 1, respectively.
1.4 the correction calculation module (alu) calculates the pixel values of the corrected feature points according to the pixel values of the four neighboring feature points and the four weights w0, w1, w2, w3, and w0, and writes the pixel values of the corrected feature points into the second buffer storage module (wb _ buf). And w1 and w3 are both equal to 0, and the actual equivalence is that the pixel value corresponding to the coordinate value (3, 2) of the initial feature point is directly selected as the pixel value of the corrected feature point.
1.5, writing the pixel value of the corrected feature point in the second buffer storage module (wb _ buf) into a position corresponding to the (0, 0) point where the coordinate (x, y) of the corrected feature point in the corrected image is (0, 0).
(2) Calculating the pixel value corresponding to the coordinate (x, y) ═ 1, 0 of the corrected feature point, and the specific process comprises the following steps:
2.1, the prediction calculation module (cordinate _ alu) calculates a coordinate value (3+ init _ h _ delta _ x, 2+ init _ h _ delta _ y) of a first predicted feature point according to the coordinate value (3, 2) of the initial feature point of the region to be corrected and the offset, where init _ h _ delta _ x is 1.1 and init _ h _ delta _ y is 0.2, that is, the coordinate value (4.1, 2.2) of the first predicted feature point is obtained, and sends the coordinate value (4.1, 2.2) of the first predicted feature point to the address acquisition module (fetch) and the weight calculation module (cmd _ fifo).
When the address obtaining module (fetch) 2.2 receives the coordinate values (4.1, 2.2) of the first predicted feature point, it reads the coordinate values of a plurality of adjacent feature points from the memory, including the first coordinate value (a1, b1) ═ 4, 2, the second coordinate value (a2, b2) ═ 5, 2, the third coordinate value (a3, b3) ═ 4, 3 and the fourth coordinate value (a4, b4) ═ 5, 3, and queries the pixel values of the four adjacent feature points from the memory according to the register address.
When the weight calculation module (cmd _ fifo) receives the coordinate values (4.1, 2.2) of the first predicted feature point, the weight calculation module (cmd _ fifo) calculates four weights w0, w1, w2, w 398, and w3, which are 0.9, 0.1, and 0.2, respectively.
2.4 the correction calculation module (alu) calculates the pixel values of the corrected feature points according to the pixel values of the four neighboring feature points and the four weights w 0-0.9, w 1-0.1, w 2-0.8, and w 3-0.2, and writes the pixel values of the corrected feature points into the second buffer storage module (wb _ buf).
And 2.5, writing the pixel value of the corrected feature point in the second buffer storage module (wb _ buf) into a position corresponding to the (1, 0) point, where the coordinate (x, y) of the corrected feature point in the corrected image corresponds to.
2.6 update init _ h _ delta _ x, init _ h _ delta _ y. After updating, h _ delta _ x, init _ h _ delta _ x, h _ delta _ acc _ x, 1.1+0.001, and h _ delta _ y, init _ h _ delta _ y, h _ delta _ acc _ y, 0.2+0.002, 0.202 are obtained as the offset of the first updating.
(3) Calculating the pixel value corresponding to the coordinate (x, y) ═ 2, 0 of the corrected feature point, and the specific process comprises the following steps:
3.1 the prediction calculation module (coordinate _ alu) calculates a coordinate value (4.1+ h _ delta _ x, 2.2+ h _ delta _ y) of the second predicted feature point according to the coordinate value (4.1, 2.2) of the first predicted feature point and the offset updated for the first time, where h _ delta _ x is 1.101 and h _ delta _ y is 0.202, that is, the coordinate value (5.201, 2.402) of the second predicted feature point is obtained, and sends the coordinate value (5.201, 2.402) of the second predicted feature point to the address acquisition module (fetch) and the weight calculation module (d _ fifo).
After receiving the coordinate values (5.201, 2.402) of the second predicted feature point, the address obtaining module (fetch) 3.2 reads coordinate values of a plurality of adjacent feature points from the memory, where the coordinate values include a first coordinate value (a1, b1) ═ 5, 2), a second coordinate value (a2, b2) ═ 6, 2, a third coordinate value (a3, b3) ═ 5, 3, and a fourth coordinate value (a4, b4) ═ 6, 3, and the pixel values of the four adjacent feature points are queried from the memory according to the register address.
When the weight calculation module (cmd _ fifo) receives the coordinate value (5.201, 2.402) of the second predicted feature point, the 3.3 weight calculation module calculates four weights w0 ═ 0.799, w1 ═ 0.201, w2 ═ 0.598, and w3 ═ 0.402.
The 3.4 rectification calculation module (alu) calculates the pixel values of the rectified feature points according to the pixel values of the four neighboring feature points and the four weights w 0-0.799, w 1-0.201, w 2-0.598, and w 3-0.402, and writes the pixel values of the rectified feature points into the second buffer storage module (wb _ buf).
And 3.5, writing the pixel value of the corrected feature point in the second buffer storage module (wb _ buf) into a position corresponding to the (2, 0) point, wherein the (x, y) coordinate of the corrected feature point in the corrected image is (x, y).
3.6 update h _ delta _ x, h _ delta _ y. The new h _ delta _ x is set as h _ delta _ x, h _ delta _ acc _ x is 1.101+ 0.001-1.102, the new h _ delta _ y is set as h _ delta _ y, h _ delta _ y + h _ delta _ acc _ y is 0.202+ 0.002-0.204, and the new h _ delta _ x and the new h _ delta _ y are set as the offset of the second update.
4) Calculating the pixel value corresponding to the coordinate (x, y) ═ 3, 0 of the corrected image, and the specific process comprises the following steps:
4.1 the prediction calculation module (cordinate _ alu) calculates a coordinate value (5.201+ h _ delta _ x, 2.402+ h _ delta _ y) of a third predicted feature point according to the coordinate value (5.201, 2.402) of the second predicted feature point and the offset updated for the second time, wherein h _ delta _ x is 1.102, and h _ delta _ y is 0.204, that is, the coordinate value (6.303, 2.606) of the third predicted feature point is obtained, and sends the coordinate value (6.303, 2.606) of the third predicted feature point to the address obtaining module (tch) and the weight calculation module (cmd _ fifo).
After receiving the coordinate values (6.303, 2.606) of the third predicted feature point, the 4.2 address obtaining module (fetch) reads the coordinate values of a plurality of adjacent feature points from the memory, where the coordinate values include the first coordinate value (a1, b1) ═ 6, 2), the second coordinate value (a2, b2) ═ 7, 2, the third coordinate value (a3, b3) ═ 6, 3, and the fourth coordinate value (a4, b4) ═ 7, 3, and queries the pixel values of the four adjacent feature points from the memory according to the register address.
After receiving the coordinates (6.303, 2.606) of the third predicted feature point, the 4.3 weight calculation module (cmd _ fifo) calculates four weights w0 ═ 0.697, w1 ═ 0.303, w2 ═ 0.394, and w3 ═ 0.606.
4.4 the rectification calculation module (alu) calculates the pixel values of the rectified feature points according to the pixel values of the four neighboring feature points and the four weights w 0-0.697, w 1-0.303, w 2-0.394, and w 3-0.606, and writes the pixel values of the rectified feature points into the second buffer storage module (wb _ buf).
And 4.5, writing the pixel value of the corrected feature point in the second buffer storage module (wb _ buf) into a position corresponding to the (3, 0) point, where the coordinate (x, y) of the corrected feature point in the corrected image corresponds to.
4.6 update h _ delta _ x, h _ delta _ y. The new h _ delta _ x is set as h _ delta _ x + h _ delta _ acc _ x, 1.102+0.001 ═ 1.103, the new h _ delta _ y is set as h _ delta _ y, the new h _ delta _ y + h _ delta _ acc _ y is set as h _ delta _ y, and the new h _ delta _ x and the new h _ delta _ y are set as offsets of the second update.
5) Calculating the pixel value corresponding to the coordinate (x, y) ═ 4, 0 of the corrected image, and the point is the last point of the 0 th row of the corrected image, and the specific process comprises the following steps:
5.1 the prediction calculation module (cordinate _ alu) calculates the coordinate value (6.303+ h _ delta _ x, 2.606+ h _ delta _ y) of the fourth predicted feature point according to the coordinate value (6.303, 2.606) of the third predicted feature point and the offset updated for the second time, wherein h _ delta _ x is 1.103, h _ delta _ y is 0.206, that is, the coordinate value of the fourth predicted feature point is (7.406, 2.812), and sends the coordinate value (7.406, 2.812) of the fourth predicted feature point to the address acquisition module (tchfe) and the weight calculation module (cmd _ fifo).
When the address obtaining module (fetch) 5.2 receives the coordinate values (7.406, 2.812) of the fourth predicted feature point, it reads the coordinate values of a plurality of neighboring feature points from the memory, including the first coordinate value (a1, b1) ═ 7, 2), the second coordinate value (a2, b2) ═ 8, 2, the third coordinate value (a3, b3) ═ 7, 3, and the fourth coordinate value (a4, b4) ═ 8, 3, and queries the pixel values of the four neighboring feature points from the memory according to the register address.
The 5.3 weight calculation module (cmd _ fifo) receives the coordinate values (7.406, 2.812) of the fourth predicted feature point, and calculates four weights w0 ═ 0.594, w1 ═ 0.406, w2 ═ 0.188, and w3 ═ 0.812.
5.4 the correction calculation module (alu) calculates the pixel values of the corrected feature points according to the pixel values of the four neighboring feature points and the four weights w 0-0.594, w 1-0.406, w 2-0.188, and w 3-0.812, and writes the pixel values of the corrected feature points into the second buffer storage module (wb _ buf).
And 5.5, writing the pixel value of the corrected feature point in the second buffer storage module (wb _ buf) into a position corresponding to the (4, 0) point, where the coordinate (x, y) of the corrected feature point in the corrected image corresponds to.
5.6 the update of the offset is different from the previous update since the line is to be wrapped at this time. Init _ h _ delta _ x and init _ h _ delta _ y are updated. After updating, h _ delta _ x is init _ h _ delta _ x + v _ change _ delta _ x is 1.1+0.01, 1.11h _ delta _ y is init _ h _ delta _ y + v _ change _ delta _ y is 0.2+0.03, 0.23. H _ delta _ acc _ x, h _ delta _ acc _ y are updated. New h _ delta _ acc _ x is set as h _ delta _ acc _ x, and new h _ delta _ acc _ y is set as h _ delta _ acc _ x, where h _ delta _ acc _ y + v _ change _ acc _ y is set as h _ delta _ acc _ y, and 0.002+0.0003 is set as h _ delta _ acc _ y.
(6) Calculating a pixel value corresponding to (0, 1) when the coordinates (x, y) of the corrected image are (x, y), wherein the point is a first point on the 1 st row, and the specific process comprises the following steps:
6.1 the prediction calculation module (cordinate _ alu) calculates, according to the coordinate value (3, 2) of the initial feature point of the region to be corrected and the offset, that the coordinate value of the first predicted feature point (the fifth predicted feature point) in the second row is (3+ v _ delta _ x, 2+ v _ delta _ y), where v _ delta _ x is 0.3 and v _ delta _ y is 1.3 (see table 1), that is, the coordinate value of the fifth predicted feature point is (3.3 ), and sends the coordinate value (3.3 ) of the fifth predicted feature point to the address acquisition module (fetch) and the weight calculation module (cmd _ fifo).
After receiving the coordinate values (3.3 ) of the fifth predicted feature point, the address obtaining module (fetch) 6.2 reads a plurality of adjacent feature point coordinate values from the memory, including a first coordinate value (a1, b1) ═ 3, a second coordinate value (a2, b2) ═ 4, 3, a third coordinate value (a3, b3) ═ 3, 4, and a fourth coordinate value (a4, b4) ═ 4, and queries the pixel values of the four adjacent feature points from the memory according to the register address.
When the weight calculation module (cmd _ fifo) receives the coordinate values (3.3 ) of the fifth predicted feature point, the weight calculation module (cmd _ fifo) calculates four weights w0, w1, w2 and w3, which are respectively equal to 0.7 and 0.3, respectively.
6.4 the correction calculation module (alu) calculates the pixel values of the corrected feature points according to the pixel values of the four neighboring feature points and the four weights w 0-0.7, w 1-0.3, w 2-0.7, and w 3-0.3, and writes the pixel values of the corrected feature points into the second buffer storage module (wb _ buf).
6.5, writing the pixel value of the corrected feature point in the second buffer storage module (wb _ buf) into a position corresponding to the (0, 1) point where the coordinate (x, y) of the corrected feature point in the corrected image is (0, 1).
6.6 update v _ delta _ x, v _ delta _ y. V _ delta _ x + v _ delta _ acc _ x is set as new v _ delta _ x, 0.3+ 0.0002-0.3002, and v _ delta _ y + v _ delta _ acc _ y is set as new v _ delta _ y, 1.3+ 0.0004-1.3004.
(7) The pixel value corresponding to (1, 1) is calculated as the coordinate (x, y) of the corrected image.
The process is the same as (2).
(8) The pixel value corresponding to (2, 1) is calculated as the coordinate (x, y) of the corrected image.
The process is the same as (3).
(9) The pixel value corresponding to the coordinate (x, y) of the corrected image (3, 1) is calculated.
The process is the same as (4).
(10) The coordinates (x, y) of the corrected image are calculated as the pixel value corresponding to (4, 1), and this process is the same as (5).
(11) The pixel value corresponding to (0, 2) is calculated as the coordinates (x, y) of the corrected image, and this process is the same as (6).
As shown in fig. 6, the embodiment provides an image rectification apparatus including:
a configuration information obtaining module 110, configured to obtain configuration information of a region to be corrected in the image before correction, where the configuration information includes coordinate values of the initial feature points and an offset;
a coordinate value calculation module 120 for predicting the feature point, configured to obtain a coordinate value of the predicted feature point according to the coordinate value and the offset of the initial feature point;
a calculation triggering module 130, configured to use the coordinate values of the predicted points as coordinate values of the initial feature points, and instruct the coordinate value calculation module 120 of the predicted feature points to perform the above prediction steps;
a coordinate value calculation module 140 for the corrected feature point, configured to calculate a coordinate value of the corrected feature point according to the coordinate value of the predicted feature point;
and a corrected image generation module 150, configured to generate a corrected image according to the calculated coordinate values of all corrected feature points under the condition that prediction is stopped.
In one embodiment, as shown in fig. 7, the module 140 for calculating coordinate values of corrected feature points includes:
the first calculating submodule 141 is configured to select coordinate values of at least one adjacent feature point around the predicted feature point, where the coordinate values of the adjacent feature points are integers;
in one embodiment, as shown in fig. 7, the module 140 for calculating coordinate values of corrected feature points includes:
an adjacent feature point selecting submodule 142 configured to select, when the coordinate values of the predicted feature points are not completely integers, coordinate values of a plurality of adjacent feature points around the predicted feature points according to the coordinate values of the predicted feature points, where the coordinate values of the adjacent feature points are integers;
the weight ratio calculation submodule 143 is configured to determine a weight ratio according to a distance between each adjacent feature point and the predicted feature point;
the second calculating submodule 144 is configured to obtain a corresponding pixel value according to the coordinate value of each adjacent feature point, and calculate a pixel value of the corrected feature point according to the pixel value and the weight ratio of each adjacent feature point;
and the coordinate value conversion submodule 145 is used for converting the pixel value of the corrected feature point into the coordinate value of the corrected feature point.
In one embodiment, as shown in fig. 7, the method further includes:
a feature point detection module 100, configured to detect a plurality of feature points in an area to be corrected by using a neural network model;
a parameter calculation module 101, configured to calculate a distortion angle and an attitude parameter according to coordinate values of the plurality of feature points;
and the offset calculation module 102 is configured to obtain an offset according to the distortion angle and the attitude parameter.
In one embodiment, the configuration information further includes a preset size parameter of the rectified image, and the condition for stopping prediction is generated according to the preset size parameter of the rectified image.
The functions of each module in each apparatus in the embodiment of the present application may refer to corresponding descriptions in the above method, and are not described herein again.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
Fig. 8 is a block diagram of an electronic device according to an embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 8, the electronic apparatus includes: one or more processors 801, memory 802, and interfaces for connecting the various components, including a high speed interface and a low speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display Graphical information for a Graphical User Interface (GUI) on an external input/output device, such as a display device coupled to the Interface. In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). Fig. 8 illustrates an example of a processor 801.
The memory 802 is a non-transitory computer readable storage medium as provided herein. The memory stores instructions executable by the at least one processor to cause the at least one processor to perform an image rectification method provided by the present application. The non-transitory computer-readable storage medium of the present application stores computer instructions for causing a computer to execute an image rectification method provided by the present application.
The memory 802 is a non-transitory computer readable storage medium, and can be used for storing non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to an image rectification method in the embodiment of the present application (for example, the configuration information acquisition module 110, the first calculation module 120, the calculation trigger module 130, the second calculation module 140, and the rectified image generation module 150 shown in fig. 6). The processor 801 executes various functional applications of the server and data processing by running non-transitory software programs, instructions, and modules stored in the memory 802, so as to implement one of the image rectification methods in the above-described method embodiments.
The memory 802 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created by use of the electronic apparatus according to an image rectification method, and the like. Further, the memory 802 may include high speed random access memory and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 802 optionally includes memory located remotely from the processor 801, which may be connected to the electronic devices via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device may further include: an input device 803 and an output device 804. The processor 801, the memory 802, the input device 803, and the output device 804 may be connected by a bus or other means, and are exemplified by a bus in fig. 8.
The input device 803 may receive input numeric or character information and generate key signal inputs related to user settings and function controls of the electronic apparatus described above, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, or other input devices. The output devices 804 may include a display device, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibrating motors), among others. The display device may include, but is not limited to, a Liquid Crystal Display (LCD) such as a Liquid crystal Cr8 star display 8, a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, Integrated circuitry, Application Specific Integrated Circuits (ASICs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (Cathode Ray Tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present application can be achieved, and the present invention is not limited herein.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (12)

1. An image rectification method, comprising:
acquiring configuration information of a region to be corrected in an image before correction, wherein the configuration information comprises coordinate values and offset of initial feature points;
obtaining coordinate values of predicted feature points according to the coordinate values of the initial feature points and the offset, taking the coordinate values of the predicted points as the coordinate values of the initial feature points, and returning to execute the predicting step;
calculating the coordinate value of the corrected feature point according to the coordinate value of the predicted feature point;
and under the condition of stopping prediction, generating a corrected image according to the coordinate values of all corrected feature points obtained by calculation.
2. The method according to claim 1, wherein calculating coordinate values of corrected feature points based on the coordinate values of the predicted feature points comprises:
and when the coordinate value of the predicted feature point is an integer, taking the coordinate value of the predicted feature point as the coordinate value of the corrected feature point.
3. The method according to claim 1, wherein calculating coordinate values of corrected feature points based on the coordinate values of the predicted feature points comprises:
under the condition that the coordinate values of the predicted feature points are not completely integers, selecting the coordinate values of a plurality of adjacent feature points surrounding the predicted feature points according to the coordinate values of the predicted feature points, wherein the coordinate values of the adjacent feature points are integers;
determining a weight ratio according to the distance between each adjacent feature point and the predicted feature point;
acquiring a corresponding pixel value according to the coordinate value of each adjacent characteristic point, and calculating the pixel value of the corrected characteristic point according to the pixel value of each adjacent characteristic point and the weight ratio;
and converting the pixel value of the corrected feature point into a coordinate value of the corrected feature point.
4. The method of claim 1, further comprising:
detecting a plurality of feature points in the area to be corrected by using a neural network model;
calculating a distortion angle and an attitude parameter according to the coordinate values of the plurality of feature points;
and obtaining the offset according to the distortion angle and the attitude parameter.
5. The method according to claim 1, wherein the configuration information further includes a preset size parameter of the rectified image, and the condition for stopping prediction is generated according to the preset size parameter of the rectified image.
6. An image rectification apparatus, characterized by comprising:
the device comprises a configuration information acquisition module, a correction module and a correction module, wherein the configuration information acquisition module is used for acquiring configuration information of a region to be corrected in an image before correction, and the configuration information comprises coordinate values and offset of initial characteristic points;
the coordinate value calculation module of the predicted characteristic point is used for obtaining the coordinate value of the predicted characteristic point according to the coordinate value of the initial characteristic point and the offset;
a calculation triggering module, configured to use the coordinate value of the predicted point as the coordinate value of the initial feature point, and instruct the coordinate value calculation module of the predicted feature point to perform the prediction step;
the coordinate value calculation module of the corrected feature point is used for calculating the coordinate value of the corrected feature point according to the coordinate value of the predicted feature point;
and the corrected image generation module is used for generating a corrected image according to the coordinate values of all the corrected feature points obtained by calculation under the condition of stopping prediction.
7. The apparatus according to claim 6, wherein the module for calculating coordinate values of the corrected feature points comprises:
and the first calculation submodule is used for taking the coordinate value of the predicted characteristic point as the coordinate value of the corrected characteristic point under the condition that the coordinate value of the predicted characteristic point is an integer.
8. The apparatus according to claim 6, wherein the module for calculating coordinate values of the corrected feature points comprises:
the adjacent characteristic point selection submodule is used for selecting the coordinate values of a plurality of adjacent characteristic points surrounding the periphery of the predicted characteristic point according to the coordinate values of the predicted characteristic point under the condition that the coordinate values of the predicted characteristic point are not completely integers, wherein the coordinate values of the adjacent characteristic points are integers;
the weight ratio calculation submodule is used for determining the weight ratio according to the distance between each adjacent characteristic point and the predicted characteristic point;
the second calculation submodule is used for acquiring a corresponding pixel value according to the coordinate value of each adjacent characteristic point and calculating the pixel value of the corrected characteristic point according to the pixel value of each adjacent characteristic point and the weight ratio;
and the coordinate value conversion submodule is used for converting the pixel value of the corrected characteristic point into a coordinate value of the corrected characteristic point.
9. The apparatus of claim 6, further comprising:
the characteristic point detection module is used for detecting a plurality of characteristic points in the area to be corrected by utilizing a neural network model;
the parameter calculation module is used for calculating distortion angles and attitude parameters according to the coordinate values of the plurality of feature points;
and the offset calculation module is used for obtaining the offset according to the distortion angle and the attitude parameter.
10. The apparatus according to claim 6, wherein the configuration information further includes a preset size parameter of the rectified image, and the condition for stopping prediction is generated according to the preset size parameter of the rectified image.
11. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.
12. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-5.
CN202010307251.XA 2020-04-17 2020-04-17 Image correction method and device Active CN113538252B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010307251.XA CN113538252B (en) 2020-04-17 2020-04-17 Image correction method and device
PCT/CN2020/118676 WO2021208369A1 (en) 2020-04-17 2020-09-29 Image correction method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010307251.XA CN113538252B (en) 2020-04-17 2020-04-17 Image correction method and device

Publications (2)

Publication Number Publication Date
CN113538252A true CN113538252A (en) 2021-10-22
CN113538252B CN113538252B (en) 2024-03-26

Family

ID=78084730

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010307251.XA Active CN113538252B (en) 2020-04-17 2020-04-17 Image correction method and device

Country Status (2)

Country Link
CN (1) CN113538252B (en)
WO (1) WO2021208369A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115797198A (en) * 2022-10-24 2023-03-14 北京华益精点生物技术有限公司 Image mark correction method and related equipment

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114494686A (en) * 2022-01-28 2022-05-13 北京百度网讯科技有限公司 Text image correction method, text image correction device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107945113A (en) * 2017-11-17 2018-04-20 北京天睿空间科技股份有限公司 The antidote of topography's splicing dislocation
CN108198219A (en) * 2017-11-21 2018-06-22 合肥工业大学 Error compensation method for camera calibration parameters for photogrammetry
CN108391050A (en) * 2018-02-12 2018-08-10 维沃移动通信有限公司 A kind of image processing method and mobile terminal
US20190236755A1 (en) * 2018-01-31 2019-08-01 Google Llc Image transformation for machine learning
CN110400266A (en) * 2019-06-13 2019-11-01 北京小米移动软件有限公司 A kind of method and device of image flame detection, storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102663413B (en) * 2012-03-09 2013-11-27 中盾信安科技(江苏)有限公司 Multi-gesture and cross-age oriented face image authentication method
US10796480B2 (en) * 2015-08-14 2020-10-06 Metail Limited Methods of generating personalized 3D head models or 3D body models
CN106600640B (en) * 2016-12-12 2020-03-20 杭州视氪科技有限公司 Face recognition auxiliary glasses based on RGB-D camera

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107945113A (en) * 2017-11-17 2018-04-20 北京天睿空间科技股份有限公司 The antidote of topography's splicing dislocation
CN108198219A (en) * 2017-11-21 2018-06-22 合肥工业大学 Error compensation method for camera calibration parameters for photogrammetry
US20190236755A1 (en) * 2018-01-31 2019-08-01 Google Llc Image transformation for machine learning
CN108391050A (en) * 2018-02-12 2018-08-10 维沃移动通信有限公司 A kind of image processing method and mobile terminal
CN110400266A (en) * 2019-06-13 2019-11-01 北京小米移动软件有限公司 A kind of method and device of image flame detection, storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115797198A (en) * 2022-10-24 2023-03-14 北京华益精点生物技术有限公司 Image mark correction method and related equipment
CN115797198B (en) * 2022-10-24 2023-05-23 北京华益精点生物技术有限公司 Image mark correction method and related equipment

Also Published As

Publication number Publication date
WO2021208369A1 (en) 2021-10-21
CN113538252B (en) 2024-03-26

Similar Documents

Publication Publication Date Title
CN111523468B (en) Human body key point identification method and device
CN112785674A (en) Texture map generation method, rendering method, device, equipment and storage medium
CN111722245B (en) Positioning method, positioning device and electronic equipment
CN112150551A (en) Object pose acquisition method and device and electronic equipment
KR20210038486A (en) Image adjustment method and apparatus, electronic device, storage medium, and program
CN111738072A (en) Training method and device of target detection model and electronic equipment
CN110675635B (en) Method and device for acquiring external parameters of camera, electronic equipment and storage medium
CN113538252B (en) Image correction method and device
US20210374977A1 (en) Method for indoor localization and electronic device
US11574414B2 (en) Edge-based three-dimensional tracking and registration method and apparatus for augmented reality, and storage medium
CN112907496A (en) Image fusion method and device
CN111191619B (en) Method, device and equipment for detecting virtual line segment of lane line and readable storage medium
CN112509058B (en) External parameter calculating method, device, electronic equipment and storage medium
CN113628239A (en) Display optimization method, related device and computer program product
CN113205090A (en) Picture rectification method and device, electronic equipment and computer readable storage medium
CN110798681B (en) Monitoring method and device of imaging equipment and computer equipment
CN112085814A (en) Electronic map display method, device, equipment and readable storage medium
CN111696134A (en) Target detection method and device and electronic equipment
CN111915642A (en) Image sample generation method, device, equipment and readable storage medium
CN111833391A (en) Method and device for estimating image depth information
CN115187995B (en) Document correction method, device, electronic equipment and storage medium
CN114565777A (en) Data processing method and device
CN113780045A (en) Method and apparatus for training distance prediction model
CN112651983A (en) Mosaic image identification method and device, electronic equipment and storage medium
CN110910312A (en) Image processing method and device, automatic driving vehicle and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant