Image processing method and device, electronic device and computer readable storage medium
By obtaining continuous multi-frame image attitude data and feature point deviations when shooting with smart devices, the target image is generated, which solves the problem of poor imaging effects caused by jitter when shooting with smart devices, and achieves better anti-shake effects.
Patent Information
- Application Number
- CN202111416688.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-19
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-11-19
AI Technical Summary
When shooting with smart devices, the imaging effect is poor due to the weight of the device and the shaking of the human body, and it is difficult to effectively stabilize the image with existing technology.
By acquiring the posture data of multiple consecutive frames of images to be processed, multiple first processed images are generated, and the images to be processed are further processed based on the deviation between the feature points of the same acquisition point to generate a target image to achieve better anti-shake effect. .
It effectively prevents the influence of posture data errors, improves the anti-shake effect of the image, and ensures that the final generated target image has good anti-shake effect and no distortion.
Smart Images

Figure CN114071019B
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and more specifically, to an image processing method, an image processing device, an electronic device, and a non-volatile computer-readable storage medium. Background Art
[0002] At present, smart devices (such as smart phones, smart watches, tablet computers, etc.) have become people's daily necessities. However, when users take photos or videos through smart terminal devices, due to the weight of the device and the inevitable shaking of the human body, the shooting system of the electronic device will shake to a certain extent, resulting in poor imaging effects of the final photos and videos. Summary of the invention
[0003] Embodiments of the present application provide an image processing method, an image processing device, an electronic device, and a non-volatile computer-readable storage medium.
[0004] The image processing method of the embodiment of the present application includes acquiring posture data of multiple consecutive frames of images to be processed; processing the multiple consecutive frames of images to be processed according to the posture data to generate multiple first processed images; processing the first processed image corresponding to the current image to be processed according to the deviation between feature points corresponding to the same acquisition point in the multiple first processed images to generate a target image, wherein the acquisition point is any part of the shooting scene.
[0005] The image processing device of the embodiment of the present application includes an acquisition module, a first generation module and a second generation module. The acquisition module is used to acquire the posture data of multiple consecutive frames of images to be processed. The first generation module is used to process multiple consecutive frames of the images to be processed according to the posture data to generate multiple first processed images. And the second generation module is used to process the first processed image corresponding to the current image to be processed according to the deviation between the feature points corresponding to the same acquisition point in the multiple first processed images to generate a target image, and the acquisition point is any part of the shooting scene.
[0006] The electronic device of the embodiment of the present application includes a processor. The processor is used to obtain posture data of multiple consecutive frames of images to be processed; process the multiple consecutive frames of images to be processed according to the posture data to generate multiple first processed images; and process the first processed image corresponding to the current image to be processed according to the deviation between feature points corresponding to the same acquisition point in the multiple first processed images to generate a target image, wherein the acquisition point is any part of the shooting scene.
[0007] The non-volatile computer-readable storage medium of the embodiment of the present application includes a computer program. When the computer program is executed by one or more processors, the processors perform the following image processing method: obtaining posture data of multiple consecutive frames of images to be processed; processing multiple consecutive frames of images to be processed according to the posture data to generate multiple first processed images; processing the first processed image corresponding to the current image to be processed according to the deviation between feature points corresponding to the same acquisition point in the multiple first processed images to generate a target image, where the acquisition point is any part of the shooting scene.
[0008] The image processing method, image processing device, electronic device and non-volatile computer-readable storage medium of the embodiments of the present application process the image to be processed into a first processed image through posture data, which can ensure that the posture data in the first processed image are all the same posture data, thereby achieving anti-shake of the image to be processed through the posture data, and then further anti-shake processing is performed on the first processed image corresponding to the current image to be processed through the deviation between the feature points in multiple first processed images processed by the posture data, so as to prevent the influence of the error of the posture data on the anti-shake effect, thereby further improving the anti-shake effect of the image.
[0009] Additional aspects and advantages of the embodiments of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0011] Figure 1 is a flowchart of an image processing method of certain embodiments of the present application;
[0012] Figure 2 is a schematic diagram of an image processing device in some embodiments of the present application;
[0013] Figure 3 is a schematic plan view of an electronic device according to some embodiments of the present application;
[0014] Figure 4 This is a scene diagram of an image processing method of some embodiments of the present application.
[0015] Figure 5 and Figure 6 is a flowchart of an image processing method of certain embodiments of the present application;
[0016] Figure 7 is a schematic diagram of a scene of an image processing method in some embodiments of the present application;
[0017] Figure 8 and Fig. 9 is a flowchart of an image processing method of certain embodiments of the present application;
[0018] Fig.10 is a schematic diagram of a scene of an image processing method in some embodiments of the present application;
[0019] Fig.11 is a flowchart of an image processing method of certain embodiments of the present application;
[0020] Fig.12 is a schematic diagram of a scene of an image processing method in some embodiments of the present application;
[0021] Fig.13 is a flowchart of an image processing method of certain embodiments of the present application;
[0022] Fig.14 It is a schematic diagram of the connection status of a non-volatile computer-readable storage medium and a processor in certain embodiments of the present application. DETAILED DESCRIPTION
[0023] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions from beginning to end. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the embodiments of the present application, and cannot be understood as limiting the embodiments of the present application.
[0024] See also Figure 1 The present application provides an image processing method. The image processing method comprises the steps of:
[0025] 01: Get the posture data of multiple consecutive frames of images to be processed;
[0026] 03: Processing a plurality of consecutive frames of images to be processed according to the posture data to generate a plurality of first processed images; and
[0027] 05: According to the deviations between the feature points corresponding to the same acquisition point in the plurality of first processed images, the first processed image corresponding to the current image to be processed is processed to generate a target image, wherein the acquisition point is any part of the shooting scene.
[0028] See also Figure 2, an embodiment of the present application provides an image processing device 10. The image processing device 10 includes an acquisition module 11, a first generation module 12 and a second generation module 13. The image processing method of the embodiment of the present application can be applied to the image processing device 10. Among them, the acquisition module 11 is used to execute step 01, the first generation module 12 is used to execute step 03, and the second generation module 13 is used to execute step 05. That is, the acquisition module 11 is used to acquire the posture data of multiple consecutive frames of images to be processed. The first generation module 12 is used to process multiple consecutive frames of images to be processed according to the posture data to generate multiple first processed images. The second generation module 13 is used to process the first processed image corresponding to the current image to be processed according to the deviation between the feature points corresponding to the same acquisition point in the multiple first processed images to generate a target image, and the acquisition point is any part of the shooting scene.
[0029] See also Figure 3 , the embodiment of the present application also provides an electronic device 100. The electronic device 100 includes a processor 20. The image processing method of the embodiment of the present application can be applied to the electronic device 100. The processor 20 is used to execute step 01, step 03 and step 05. That is, the processor 20 is used to obtain posture data of a plurality of consecutive frames of images to be processed; process the plurality of consecutive frames of images to be processed according to the posture data to generate a plurality of first processed images; and process the first processed image corresponding to the current image to be processed according to the deviation between the feature points corresponding to the same acquisition point in the plurality of first processed images to generate a target image, and the acquisition point is any part of the shooting scene.
[0030] The electronic device 100 includes a housing 30. The electronic device 100 may be a mobile phone, a tablet computer, a display device, a laptop computer, a teller machine, a gate machine, a smart watch, a head-mounted display device, a game console, etc. Figure 3 As shown, the embodiment of the present application is described by taking the electronic device 100 as a mobile phone as an example. It can be understood that the specific form of the electronic device 100 is not limited to a mobile phone. The housing 30 can also be used to install functional modules such as a display device, an imaging device, a power supply device, and a communication device of the electronic device 100, so that the housing 30 provides dustproof, drop-proof, waterproof and other protections for the functional modules.
[0031] Specifically, the electronic device 100 also includes a camera 40, which can be used to shoot multiple consecutive frames of images to be processed, and the processor 20 can obtain the posture data of the multiple consecutive frames of images to be processed by acquiring the multiple consecutive frames of images to be processed. Each frame of the image to be processed includes corresponding posture data, and the posture data can reflect the position information of the photographed object in the image to be processed. When the image is shot by the camera 40 of the electronic device 100, if the electronic device 100 or the camera 40 shakes, the posture data of the multiple frames of images to be processed acquired by the processor 20 will change.
[0032] In order to ensure that the final generated target image has a good anti-shake effect, after the processor 20 obtains the posture data of multiple frames of images to be processed, the processor 20 can first obtain the target posture data through the posture data of multiple frames of images to be processed. The target posture data is the posture data with anti-shake effect obtained by the processor 20 through calculation based on the posture data of multiple frames of images to be processed.
[0033] In this way, the processor 20 can process multiple frames of images to be processed in sequence according to the target posture data, that is, transform the posture data in the multiple frames of images to be processed into the target posture data to obtain multiple first processed images. It can be understood that the multiple first processor 20 images are already images with a certain anti-shake effect.
[0034] More specifically, the processor 20 may first divide the image to be processed into a plurality of grids (eg Fig.12 As shown in FIG. 1 , the processor can obtain the grid points of multiple grids in the image to be processed. When the processor 20 processes multiple frames of the image to be processed according to the target posture data, the processor can transform the posture data of the grid points of each grid in the image to be processed into the target posture data, that is, process the image to be processed line by line into the first processed image. In this way, the consistency of the first processed image can be guaranteed.
[0035] However, although the first processed image has a certain anti-shake effect, if the target posture data is used to process multiple frames of images to be processed line by line, there will still be certain errors when the first processed image is directly used as the target image if there are errors in the posture data. When the target posture data is used to process multiple frames of images to be processed pixel by pixel, the posture difference between each pixel will lead to different degrees of transformation between each pixel, that is, when the image to be processed is transformed into the first processed image, its degree of transformation is relatively far, which may cause the first processed image to be distorted and twisted.
[0036] Therefore, for the above technical problems, the image processing method of the embodiment of the present application processes multiple frames of images to be processed line by line through the posture data to obtain multiple first processed images, and the processor 20 also processes the first processed image corresponding to the current image to be processed according to the deviation between the feature points corresponding to the same acquisition point in the multiple first processed images, so as to generate a target image. Among them, the acquisition point is any part of the shooting scene, that is, the acquisition point is any point in the image to be processed, and the same acquisition point in the multiple first processed images corresponds to the position in the multiple frames of the image to be processed.
[0037] Specifically, take the case where the camera 40 takes a total of 2 frames of images to be processed as an example. Figure 4As shown, the processor 20 will generate two first processed images, namely the first processed image A and the first processed image B. Then the processor 20 can search for the feature points of the same acquisition point in the first processed image A and the first processed image B, namely point a and point b. Then the processor 20 can calculate the deviation between the feature points in the first processed images of adjacent frames, that is, the deviation M1 between point b and point a. Among them, the deviation between the feature points of the same acquisition point is the position coordinate deviation between the feature points.
[0038] Next, the processor 20 can process the first processed image corresponding to the current image to be processed according to the deviation M1, so as to generate a target image, so as to ensure that the target image finally generated has a good anti-shake effect and will not be distorted.
[0039] In one embodiment, taking the first processed image corresponding to the current image to be processed as the first processed image B as an example, the deviation M1 between point b and point a can directly reflect the offset, that is, the error value, of the first processed image B relative to the first processed image A. Therefore, when generating the target image, the processor 20 needs to compensate the offset to the first processed image to eliminate the error of the first processed image B, and further ensure the anti-shake effect of the target image generated according to the first processed image B.
[0040] The image processing method and image processing device 10 of the embodiment of the present application process the image to be processed into a first processed image through posture data, which can ensure that the posture data in the first processed images are all the same posture data, thereby achieving anti-shake of the image to be processed through the posture data, and then further anti-shake processing is performed on the first processed image corresponding to the current image to be processed through the deviation between the feature points in the multiple first processed images processed by the posture data, so as to prevent the error of the posture data from affecting the anti-shake effect, thereby further improving the anti-shake effect of the image.
[0041] See also Figure 2 , Figure 3 and Figure 5 In some embodiments, step 03: processing a plurality of consecutive frames of images to be processed according to the posture data to generate a plurality of first processed images comprises the steps of:
[0042] 031: Calculating target posture data based on a preset first function according to multiple frames of posture data corresponding to a plurality of consecutive frames of images to be processed, where the plurality of consecutive frames of images to be processed include the current image to be processed; and
[0043] 032: Process each frame of the image to be processed according to the posture data corresponding to each frame of the image to be processed and the target posture data, so as to generate a first processed image corresponding to each frame of the image to be processed.
[0044] In some embodiments, the first generating module 12 is further used to execute step 031 and step 032. That is, the first generating module 12 is used to calculate the target posture data based on the preset first function according to the posture data corresponding to the continuous multiple frames of the images to be processed, and the continuous multiple frames of the images to be processed include the current image to be processed; and process each frame of the image to be processed according to the posture data corresponding to each frame of the image to be processed and the target posture data, so as to generate a first processed image corresponding to each frame of the image to be processed.
[0045] In some embodiments, the processor 20 is further configured to execute step 031 and step 032. That is, the processor 20 is configured to calculate target posture data based on a preset first function according to multiple frames of posture data corresponding to a plurality of consecutive frames of images to be processed, wherein the plurality of consecutive frames of images to be processed include the current image to be processed; and to process each frame of the image to be processed according to the posture data corresponding to each frame of the image to be processed and the target posture data, so as to generate a first processed image corresponding to each frame of the image to be processed.
[0046] Specifically, before the processor 20 processes the continuous multiple frames of to-be-processed images according to the posture data to generate multiple first processed images, the processor 20 may first calculate the target posture data based on the preset first function and the posture data corresponding to the continuous multiple frames of to-be-processed images. The preset first function is shown in the following formula (1).
[0047]
[0048] Among them, PP r is the target posture data, r is the frame number corresponding to the current image to be processed, P(t) is the posture data corresponding to the t-th frame of the image to be processed, and f(x) is the Gaussian distribution weight. x changes from 0 to k, and y changes from 1 to k, then represents the product of the posture data of the first k frames of the t-th frame to be processed and the weight of the Gaussian distribution, and accumulates them, while It represents the product of the posture data of the k frames after the t-th frame to be processed and the weight of the Gaussian distribution, and the data are accumulated.
[0049] More specifically, the Gaussian distribution weight is shown in the following formula (II).
[0050]
[0051] Among them, σ represents the variance of the Gaussian distribution, and μ represents the mean of the Gaussian distribution.
[0052] Therefore, according to the above formulas (1) and (2), the processor 20 can respectively obtain the target posture data corresponding to each frame of the image to be processed. Then, after determining the posture data and the target posture data of each frame of the image to be processed, the processor 20 can process each frame of the image to be processed, thereby generating multiple first processed images.
[0053] See also Figure 2 , Figure 3 and Figure 6 In some embodiments, step 032: processing each frame of the image to be processed according to the posture data and the target posture data corresponding to each frame of the image to be processed to generate a first processed image corresponding to each frame of the image to be processed, further comprising the steps of:
[0054] 0321: Based on a preset second function, mapping the first image coordinates of each pixel of each frame of the image to be processed into three-dimensional position coordinates;
[0055] 0322: Generate three-dimensional position coordinates corresponding to the target posture data according to the posture data corresponding to each frame of the image to be processed, the target posture data, and the three-dimensional position coordinates;
[0056] 0323: Based on the second function, the three-dimensional position coordinates corresponding to the target posture data are mapped into second image coordinates, and the second image coordinates correspond to the first image coordinates one by one; and
[0057] 0324: Adjust the pixels corresponding to the first image coordinates to the second image coordinates to generate a first processed image.
[0058] In some embodiments, the first generation module 12 is used to perform step 0321, step 0322, step 0323, and step 0324. That is, the first generation module 12 is used to map the first image coordinates of each pixel of each frame of the image to be processed to the three-dimensional position coordinates based on the preset second function; generate the three-dimensional position coordinates corresponding to the target posture data according to the posture data, target posture data, and three-dimensional position coordinates corresponding to each frame of the image to be processed; based on the second function, map the three-dimensional position coordinates corresponding to the target posture data to the second image coordinates, the second image coordinates and the first image coordinates correspond one to one; and adjust the pixels corresponding to the first image coordinates to the second image coordinates to generate the first processed image.
[0059] In some embodiments, the processor 20 is used to perform step 0321, step 0322, step 0323, and step 0324. That is, the processor 20 is used to map the first image coordinates of each pixel of each frame of the image to be processed to the three-dimensional position coordinates based on the preset second function; generate the three-dimensional position coordinates corresponding to the target posture data according to the posture data, target posture data, and three-dimensional position coordinates corresponding to each frame of the image to be processed; based on the second function, map the three-dimensional position coordinates corresponding to the target posture data to the second image coordinates, the second image coordinates and the first image coordinates one-to-one correspondence; and adjust the pixels corresponding to the first image coordinates to the second image coordinates to generate the first processed image.
[0060] Specifically, when the processor 20 processes each frame of the image to be processed according to the posture data and target posture data corresponding to each frame of the image to be processed, the processor 20 may first map each pixel coordinate of each frame of the image to be processed to a three-dimensional position coordinate according to a preset second function. The preset second function is shown in the following formula (3).
[0061] Please combine Figure 7 , Figure 7 4 is an imaging principle diagram of the camera 40 . A point U (X, Y, Z) in a three-dimensional space can be transformed into a point u (x, y) in a two-dimensional space through a preset second function.
[0062] x=F x kX x y=F y kY y (3)
[0063] in, α=atan2(R,Z)k=LUTF(α)
[0064] Specifically, R represents the radial distance between point U and the optical center of the camera 40, which can be obtained by the X and Y values of the coordinates of the above point U. α is the angle between point U and the optical center of the camera 40, which can be obtained by the above inverse tangent function and the coordinates (R, Z). LUTF represents the distortion table of the camera, K is the distortion coefficient, and for each angle α, a corresponding k value can be found in LUTF, F x 、F y is the focal length of the camera.
[0065] Therefore, according to the above formula, the processor 20 can map the first image coordinates of each pixel in each frame of the image to be processed to the corresponding three-dimensional position coordinates. That is, the three-dimensional coordinates corresponding to the first image coordinates of each pixel can be inferred by inversely deriving the above formula (3).
[0066] Next, since the posture data corresponding to each frame of the image to be processed can be associated with its corresponding three-dimensional coordinates, the processor 20 can obtain the three-dimensional position coordinates corresponding to the target posture data based on the relationship between the posture data corresponding to each frame of the image to be processed and its corresponding three-dimensional coordinates.
[0067] In this way, after obtaining the three-dimensional position coordinates corresponding to the target posture data, the processor 20 can also map the three-dimensional position coordinates corresponding to the target posture data into second image coordinates based on the second function. It can be understood that the second image coordinates correspond to the first image coordinates, and are actually the second image coordinates obtained by converting the first image coordinates through the target posture data, that is, the second image coordinates are obtained by converting the first image coordinates of each pixel in the image to be processed.
[0068] Finally, the processor 20 may adjust the first image coordinates of each pixel in the image to be processed to the corresponding second image coordinates according to the position of the second image coordinates, thereby generating a first processed image.
[0069] See also Figure 2 , Figure 3 and Figure 8 In some embodiments, step 05: processing the first processed image corresponding to the current image to be processed according to the deviation between the feature points corresponding to the same acquisition point in the plurality of first processed images to generate a target image, comprising the steps of:
[0070] 051: Determine image offset according to deviations of image coordinates between multiple groups of feature points corresponding to the same acquisition point in multiple first processed images; and
[0071] 052: Transform the image coordinates of the first processed image corresponding to the current image to be processed according to the image offset to generate a target image.
[0072] In some embodiments, the second generating module 13 is used to perform step 51 and step 52. That is, the second generating module 13 is used to determine the image offset according to the deviation of the image coordinates between the multiple groups of feature points corresponding to the same acquisition point in the multiple first processed images; and transform the image coordinates of the first processed image corresponding to the current image to be processed according to the image offset to generate the target image.
[0073] In some embodiments, the processor 20 is used to perform step 51 and step 52. That is, the processor 20 is used to determine the image offset according to the deviation of the image coordinates between multiple groups of feature points corresponding to the same acquisition point in multiple first processed images; and transform the image coordinates of the first processed image corresponding to the current image to be processed according to the image offset to generate the target image.
[0074] Specifically, after the processor 20 generates multiple first processed images corresponding to multiple frames of images to be processed, the processor 20 can determine the image offset according to the deviation of image coordinates between multiple groups of feature points corresponding to the same acquisition point in the multiple first processed images.
[0075] More specifically, after obtaining multiple first processed images, the processor 20 may find a feature point in each first processed image. For example, if there are 10 first processed images, there may be 10 feature points, and each feature point corresponds to the same acquisition point.
[0076] Therefore, the processor 20 can use the feature points of the current image to be processed as a reference to obtain the coordinate difference between the feature points of the current image to be processed and the feature points of other non-current images to be processed. If there are 10 first processed images, there are 9 corresponding non-current images to be processed, so there are 9 coordinate differences between the feature points of the current image to be processed and the feature points of other non-current images to be processed. Therefore, the processor 20 can determine the image offset based on the average value of the sum of the absolute values of these 9 coordinate differences.
[0077] Finally, when the processor 20 transforms the image coordinates of the first processed image corresponding to the current image to be processed according to the image offset, the average value of the sum of the absolute values of all the above coordinate differences can be compensated to the first processed image, thereby generating a target image.
[0078] See also Figure 2 , Figure 3 and Fig. 9 In some embodiments, step 051: determining the image offset according to the deviation of the image coordinates between multiple groups of feature points corresponding to the same acquisition point in multiple first processed images, comprises the steps of:
[0079] 0511: Acquire a first feature point and a second feature point corresponding to the same acquisition point in the first image to be processed and the second image to be processed, wherein the first feature point is located in the first image to be processed, and the second feature point is located in the second image to be processed;
[0080] 0512: Obtaining a third feature point corresponding to the first feature point in the first processed image corresponding to the first image to be processed, and obtaining a fourth feature point corresponding to the second feature point in the first processed image corresponding to the second image to be processed; and
[0081] 0513: Determine the image offset according to the deviation of the image coordinates of the third feature point and the fourth feature point.
[0082] In some embodiments, the second generation module 13 is used to execute step 0511, step 0512, and step 0513. That is, the second generation module 13 is used to obtain the first feature point and the second feature point corresponding to the same acquisition point in the first image to be processed and the second image to be processed, the first feature point is located in the first image to be processed, and the second feature point is located in the second image to be processed; obtain the third feature point corresponding to the first feature point in the first processed image corresponding to the first image to be processed, and obtain the fourth feature point corresponding to the second feature point in the first processed image corresponding to the second image to be processed; and determine the image offset according to the deviation of the image coordinates of the third feature point and the fourth feature point.
[0083] In some embodiments, the processor 20 is used to perform step 0511, step 0512, and step 0513. That is, the processor 20 is used to obtain a first feature point and a second feature point corresponding to the same acquisition point in the first image to be processed and the second image to be processed, the first feature point is located in the first image to be processed, and the second feature point is located in the second image to be processed; obtain a third feature point corresponding to the first feature point in the first processed image corresponding to the first image to be processed, and obtain a fourth feature point corresponding to the second feature point in the first processed image corresponding to the second image to be processed; and determine the image offset according to the deviation of the image coordinates of the third feature point and the fourth feature point.
[0084] Specifically, Fig.10 As shown, taking the case where there are two frames of images to be processed, namely the first image to be processed P1 and the second image to be processed P2, the processor 20 can obtain the first feature point T1 in the first image to be processed P1 and the second feature point T2 in the second image to be processed P2. Since the first feature point and the second feature point are the same acquisition point, the position of the first feature point in the first image to be processed P1 corresponds to the position of the second feature point T2 in the second image to be processed P2.
[0085] Next, the processor 20 can find the third feature point T3 of the first processed image P3 corresponding to the first image to be processed P1 and the fourth feature point T4 of the first processed image P4 corresponding to the second image to be processed P2 according to the first feature point T1 and the second feature point T2.
[0086] Then, the processor 20 can determine the image offset between the first processed image P3 and the first processed image P4 according to the deviation of the image coordinates of the third feature point T3 and the fourth feature point T4. For example, the image coordinates of the third feature point T3 are (1, 1), and the image coordinates of the fourth feature point T4 are (2, 2). Then the deviation of the image coordinates of the third feature point T3 and the fourth feature point T4 is (1, 1), which means that the first processed image P4 is offset by one unit in the positive direction of the X-axis and the Y-axis relative to the first processed image P3.
[0087] See also Figure 2 , Figure 3 and Fig.11 In some embodiments, step 0512: obtaining a third feature point corresponding to the first feature point in the first processed image corresponding to the first image to be processed, and obtaining a fourth feature point corresponding to the second feature point in the first processed image corresponding to the second image to be processed, comprises the steps of:
[0088] 05121: establishing a first grid and a second grid in the first image to be processed and the second image to be processed respectively, wherein the first grid and the second grid are both composed of a plurality of rectangular image regions;
[0089] 05122: Acquire a first image region where a first feature point is located, and a second image region where a second feature point is located;
[0090] 05123: interpolating a third feature point according to the image coordinates of the corner point of the first image area in the first processed image corresponding to the first image to be processed; and
[0091] 05124: Obtain a fourth feature point by interpolation according to the image coordinates of the corner points of the second image area in the first processed image corresponding to the second image to be processed.
[0092] In some embodiments, the second generation module 13 is used to perform step 05121, step 05122, step 05123 and step 05124. That is, the second generation module 13 is used to establish a first grid and a second grid in the first image to be processed and the second image to be processed, respectively, and the first grid and the second grid are composed of a plurality of rectangular image regions; obtain the first image region where the first feature point is located, and the second image region where the second feature point is located; interpolate the third feature point according to the image coordinates of the corner point of the first image region in the first processed image corresponding to the first image to be processed; and interpolate the fourth feature point according to the image coordinates of the corner point of the second image region in the first processed image corresponding to the second image to be processed.
[0093] In some embodiments, the processor 20 is used for step 05121, step 05122, step 05123 and step 05124. That is, the processor 20 is used to establish a first grid and a second grid in the first image to be processed and the second image to be processed, respectively, and the first grid and the second grid are composed of a plurality of rectangular image regions; obtain the first image region where the first feature point is located, and the second image region where the second feature point is located; interpolate the third feature point according to the image coordinates of the corner point of the first image region in the first processed image corresponding to the first image to be processed; and interpolate the fourth feature point according to the image coordinates of the corner point of the second image region in the first processed image corresponding to the second image to be processed.
[0094] Specifically, before the processor 20 obtains the third feature point corresponding to the first feature point and the fourth feature point corresponding to the second feature point, the processor 20 may also establish a first grid and a second grid in the first image to be processed and the second image to be processed, respectively. The first grid and the second grid are both composed of a plurality of rectangular image regions.
[0095] like Fig.12 As shown, the first image to be processed Q1 for establishing the first grid includes multiple first image regions R, and the second image to be processed Q2 for establishing the second grid includes multiple second image regions S. The processor 20 can obtain the first image region R1 where the first feature point T5 is located, and the second image region S1 where the second feature point T6 is located.
[0096] Next, the processor 20 can determine the third feature point T7 by corresponding the corner points of the first image area R1 to the image coordinates in the first processed image Q3. Similarly, the processor 20 can also determine the fourth feature point T8 by corresponding the corner points of the second image area S1 to the image coordinates in the first processed image Q4.
[0097] Specifically, when acquiring the third feature point T7, the processor 20 may first acquire the coordinates of the four corner points r1, r2, r3 and r4 of the first image region R1. For example, the processor 20 establishes a coordinate system with the corner point at the lower left corner of the first image to be processed as the origin. The coordinates of the corner point r1 are (1, 1), the coordinates of the corner point r2 are (2, 1), the coordinates of the corner point r3 are (2, 2), and the coordinates of the corner point r4 are (1, 2). The corresponding coordinates of the corner points r1, r2, r3 and r4 in the first processed image are (1.2, 1.5), (2.2, 1.5), (2.2, 2.5) and (1.2, 2.5), respectively. Thus, the processor 20 may obtain the offset of the first processed image relative to the first image to be processed in the first image region R. That is, the offset of the X coordinate is the average value of the coordinate difference between the four corner points and the image coordinates corresponding to the first processed image, and the offset of the Y coordinate is the average value of the coordinate difference between the four corner points and the image coordinates corresponding to the first processed image. By calculation, it can be obtained that the offset of the X coordinate is 0.2, and the offset of the Y coordinate is 0.5.
[0098] Finally, the processor 20 may interpolate the first feature point T5 by using the coordinates of the first feature point T5 and the offset calculated above to obtain the coordinates of the third feature point T7 in the first processed image Q3. For example, if the coordinates of the first feature point T5 are (1.5, 1.5) and the offset is (0.2, 0.5), the coordinates of the third feature point T7 are (1.7, 2).
[0099] Similarly, when acquiring the fourth feature point T8, the processor 20 may also, as described above, calculate the coordinates of the four corner points s1, s2, s3 and s4 of the second image area S1 and the offset values of the image coordinates of these four corner points in the first processed image Q4 corresponding to the second image to be processed Q2, thereby interpolating the second feature point T6 through the offset value to obtain the coordinates of the fourth feature point T8.
[0100] See also Figure 2 , Figure 3 and Fig.13 In some embodiments, step 05123: interpolating the third feature point according to the image coordinates of the corner point of the first image area in the first processed image corresponding to the first image to be processed, comprises the steps of:
[0101] 05125: Obtain a third feature point by interpolation based on the relative positional relationship between the first feature point and the corner point of the first image region, and the image coordinates of the corner point of the first image region in the first processed image corresponding to the first image to be processed.
[0102] Step 05124: interpolating the image coordinates of the corner points of the second image area in the first processed image corresponding to the second image to be processed to obtain the fourth feature point, including the steps of:
[0103] 05126: A fourth feature point is obtained by interpolation based on the relative positional relationship between the second feature point and the corner point of the second image area, and the image coordinates of the corner point of the second image area in the first processed image corresponding to the second image to be processed.
[0104] In some embodiments, the second generating module 13 is used to perform step 05125 and step 05126. That is, the second generating module 13 is used to interpolate the third feature point according to the relative position relationship between the first feature point and the corner point of the first image area, and the image coordinates of the corner point of the first image area in the first processed image corresponding to the first image to be processed; and interpolate the fourth feature point according to the relative position relationship between the second feature point and the corner point of the second image area, and the image coordinates of the corner point of the second image area in the first processed image corresponding to the second image to be processed.
[0105] In some embodiments, the processor 20 is used to perform step 05125 and step 05126. That is, the processor 20 is used to interpolate the third feature point according to the relative position relationship between the first feature point and the corner point of the first image area, and the image coordinates of the corner point of the first image area in the first processed image corresponding to the first image to be processed; and interpolate the fourth feature point according to the relative position relationship between the second feature point and the corner point of the second image area, and the image coordinates of the corner point of the second image area in the first processed image corresponding to the second image to be processed.
[0106] Please combine Fig.12 The third feature point T7 can also be calculated by the processor 20 through the relative position relationship between the first feature point T5 and the four corner points of the first image region R1, and the image coordinates of the corner points of the first image region R1 in the first processed image Q3 corresponding to the first image to be processed Q1.
[0107] Specifically, Fig.12 As shown, the four corner points of the first image region R1 are corner point r1, corner point r2, corner point r3 and corner point r4, and their coordinates are (1, 1), (2, 1), (2, 2) and (1, 2), respectively, and the coordinate of the first feature point T5 is (1.5, 1.5). The image coordinates of the four corner points of the first image region R1 in the first processed image Q3 corresponding to the first image to be processed Q1 are (2, 2), (3, 2), (3, 3) and (2, 3), respectively.
[0108] First, the processor 20 can calculate the relative position relationship between the first feature point T5 and the four corner points of the first image area R1 through the coordinates of the first feature point T5 and the coordinates of the four corner points. For example, the relative position relationship between the first feature point T5 and the corner point r1 can be obtained by the coordinate difference between the first feature point T5 and the corner point r1, that is, (0.5, 0.5). The relative position relationship between the first feature point T5 and the corner point r2 can be obtained by the coordinate difference between the first feature point T5 and the corner point r2, that is, (-0.5, 0.5). By analogy, the processor 20 can obtain the relative position relationship between the first feature point T5 and the four corner points.
[0109] Next, the processor 20 may interpolate the first feature point T5 according to the relative position relationship between the first feature point T5 and the four corner points of the first image region R1 , thereby obtaining the coordinates of the third feature point T7 in the first processed image.
[0110] More specifically, the processor 20 may assign corresponding weights according to the relative positional relationship between the first feature point T5 and the four corner points of the first image region R1, thereby obtaining the offset value of the first feature point T5 interpolated to the third feature point T7 by multiplying the weight by the coordinate difference. For example, when the relative positional relationship is larger, it means that the distance between the first feature point T5 and the corner point is farther, and the processor 20 assigns a smaller weight to the coordinate difference between the first feature point T5 and the corner point. For another example, when the relative positional relationship is smaller, it means that the distance between the first feature point T5 and the corner point is closer, and the processor 20 assigns a larger weight to the coordinate difference between the first feature point T5 and the corner point.
[0111] For example, the coordinate difference between the first feature point T5 and the corner point r1 is (x1, y1), the coordinate difference between the first feature point T5 and the corner point r2 is (x2, y2), the coordinate difference between the first feature point T5 and the corner point r3 is (x3, y3), and the coordinate difference between the first feature point T5 and the corner point r4 is (x4, y4). The processor 20 can assign corresponding weights according to the relative position relationship between the first feature point T5 and the four corner points r1, r2, r3 and r4. If the coordinate of the first feature point T5 is (x0, y0), then the X-axis coordinate x5 of the third feature point T7 is x0+(a*x1+b*x2+c*x3+d*x4), and the Y-axis coordinate y5 is y0+(a*y1+b*y2+c*y3+d*y4). In this way, the coordinate of the third feature point T7 can be determined.
[0112] Similarly, the fourth feature point T8 can also be calculated by the relative position relationship between the second feature point T6 and the focus of the second image area S1, and the image coordinates of the focus of the second image area S1 in the first processed image Q4 corresponding to the second image to be processed Q2. The specific calculation method is the same as the method for calculating the third feature point T7, which will not be repeated here.
[0113] See also Fig.14 The present application also provides a non-volatile computer-readable storage medium 200 including a computer program 201. When the computer program 201 is executed by one or more processors 20, the one or more processors 20 execute the image processing method of any of the above embodiments.
[0114] For example, when the computer program 201 is executed by one or more processors 20, the processor 20 performs the following image processing method:
[0115] 01: Get the posture data of multiple consecutive frames of images to be processed;
[0116] 03: Processing a plurality of consecutive frames of images to be processed according to the posture data to generate a plurality of first processed images; and
[0117] 05: According to the deviations between the feature points corresponding to the same acquisition point in the plurality of first processed images, the first processed image corresponding to the current image to be processed is processed to generate a target image, wherein the acquisition point is any part of the shooting scene.
[0118] For another example, when the computer program 201 is executed by one or more processors 20, the processor 20 performs the following image processing method:
[0119] 031: Calculating target posture data based on a preset first function according to multiple frames of posture data corresponding to a plurality of consecutive frames of images to be processed, where the plurality of consecutive frames of images to be processed include the current image to be processed; and
[0120] 032: Process each frame of the image to be processed according to the posture data corresponding to each frame of the image to be processed and the target posture data, so as to generate a first processed image corresponding to each frame of the image to be processed.
[0121] For another example, when the computer program 201 is executed by one or more processors 20, the processor 20 performs the following image processing method:
[0122] 0321: Based on a preset second function, mapping the first image coordinates of each pixel of each frame of the image to be processed into three-dimensional position coordinates;
[0123] 0322: Generate three-dimensional position coordinates corresponding to the target posture data according to the posture data corresponding to each frame of the image to be processed, the target posture data, and the three-dimensional position coordinates;
[0124] 0323: Based on the second function, the three-dimensional position coordinates corresponding to the target posture data are mapped into second image coordinates, and the second image coordinates correspond to the first image coordinates one by one; and
[0125] 0324: Adjust the pixels corresponding to the first image coordinates to the second image coordinates to generate a first processed image.
[0126] In the description of this specification, the descriptions with reference to the terms "certain embodiments", "in an example", "exemplarily", etc., mean that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0127] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0128] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. An image processing method, characterized in that: include: Obtaining posture data of multiple consecutive frames of images to be processed; Processing a plurality of consecutive frames of the to-be-processed images according to the posture data to generate a plurality of first processed images; Processing the first processed image corresponding to the current image to be processed according to deviations between feature points corresponding to the same acquisition point in the plurality of first processed images to generate a target image, wherein the acquisition point is any part of the shooting scene; The step of processing a plurality of consecutive frames of the to-be-processed images according to the posture data to generate a plurality of first processed images includes: Based on a preset first function, the target posture data is calculated according to the posture data of multiple frames corresponding to the consecutive multiple frames of the images to be processed, wherein the consecutive multiple frames of the images to be processed include the current image to be processed; Each frame of the image to be processed is processed according to the posture data and the target posture data corresponding to each frame of the image to be processed, so as to generate the first processed image corresponding to each frame of the image to be processed.
2. The image processing method according to claim 1, characterized in that: The step of processing each frame of the image to be processed according to the posture data corresponding to each frame of the image to be processed and the target posture data to generate the first processed image corresponding to each frame of the image to be processed includes: Based on a preset second function, mapping the first image coordinates of each pixel of each frame of the image to be processed into three-dimensional position coordinates; Generate the three-dimensional position coordinates corresponding to the target posture data according to the posture data corresponding to each frame of the image to be processed, the target posture data, and the three-dimensional position coordinates; Based on the second function, mapping the three-dimensional position coordinates corresponding to the target posture data into second image coordinates, where the second image coordinates correspond to the first image coordinates one-to-one; The pixels corresponding to the first image coordinates are adjusted to the second image coordinates to generate the first processed image.
3. The image processing method according to claim 1, characterized in that: The step of processing the first processed image corresponding to the current image to be processed according to the deviations between the feature points corresponding to the same acquisition point in the plurality of first processed images to generate a target image comprises: Determining an image offset according to deviations of image coordinates between multiple groups of feature points corresponding to the same acquisition point in the multiple first processed images; The image coordinates of the first processed image corresponding to the current image to be processed are transformed according to the image offset to generate a target image.
4. The image processing method according to claim 3, characterized in that: The continuous multiple frames of the to-be-processed images include a first to-be-processed image and a second to-be-processed image, and the determining of the image offset according to the deviation of the image coordinates between multiple groups of feature points corresponding to the same acquisition point in the multiple first processed images includes: Acquire a first feature point and a second feature point corresponding to the same acquisition point in the first image to be processed and the second image to be processed, wherein the first feature point is located in the first image to be processed, and the second feature point is located in the second image to be processed; Acquire a third feature point corresponding to the first feature point in the first processed image corresponding to the first image to be processed, and acquire a fourth feature point corresponding to the second feature point in the first processed image corresponding to the second image to be processed; The image offset is determined according to a deviation between the image coordinates of the third feature point and the fourth feature point.
5. The image processing method according to claim 4, characterized in that: The obtaining of a third feature point corresponding to the first feature point in the first processed image corresponding to the first image to be processed, and obtaining of a fourth feature point corresponding to the second feature point in the first processed image corresponding to the second image to be processed, include: Establishing a first grid and a second grid on the first image to be processed and the second image to be processed respectively, wherein the first grid and the second grid are both composed of a plurality of rectangular image regions; Acquire a first image region where the first feature point is located, and a second image region where the second feature point is located; interpolating the third feature point according to the image coordinates of the corner point of the first image area in the first processed image corresponding to the first image to be processed; The fourth feature point is obtained by interpolation according to the image coordinates of the corner points of the second image area in the first processed image corresponding to the second image to be processed.
6. The image processing method according to claim 5, characterized in that: The interpolating the third feature point according to the image coordinates of the corner point of the first image area in the first processed image corresponding to the first image to be processed includes: interpolating the third feature point according to the relative positional relationship between the first feature point and the corner point of the first image region, and the image coordinates of the corner point of the first image region in the first processed image corresponding to the first image to be processed; The interpolating the fourth feature point according to the image coordinates of the corner point of the second image area in the first processed image corresponding to the second image to be processed includes: The fourth feature point is obtained by interpolation based on the relative positional relationship between the second feature point and the corner point of the second image area, and the image coordinates of the corner point of the second image area in the first processed image corresponding to the second image to be processed.
7. An image processing device, characterized in that: include: An acquisition module, the acquisition module is used to acquire posture data of multiple consecutive frames of images to be processed; A first generating module, the first generating module is used to process a plurality of consecutive frames of the to-be-processed images according to the posture data to generate a plurality of first processed images; and a second generating module, the second generating module being used to process the first processed image corresponding to the current image to be processed according to deviations between feature points corresponding to the same acquisition point in a plurality of the first processed images, so as to generate a target image, wherein the acquisition point is any part of the shooting scene; The first generating module is further used to calculate the target posture data based on a preset first function according to the posture data of multiple frames corresponding to the continuous multiple frames of the images to be processed, and the continuous multiple frames of the images to be processed include the current image to be processed; Each frame of the image to be processed is processed according to the posture data and the target posture data corresponding to each frame of the image to be processed, so as to generate the first processed image corresponding to each frame of the image to be processed.
8. An electronic device, characterized in that: comprising a processor configured to: Obtaining posture data of multiple consecutive frames of images to be processed; Processing a plurality of consecutive frames of the to-be-processed images according to the posture data to generate a plurality of first processed images; Processing the first processed image corresponding to the current image to be processed according to deviations between feature points corresponding to the same acquisition point in the plurality of first processed images to generate a target image, wherein the acquisition point is any part of the shooting scene; The processor is used to calculate the target posture data based on a preset first function according to the posture data of multiple frames corresponding to the continuous multiple frames of the images to be processed, and the continuous multiple frames of the images to be processed include the current image to be processed; Each frame of the image to be processed is processed according to the posture data and the target posture data corresponding to each frame of the image to be processed, so as to generate the first processed image corresponding to each frame of the image to be processed.
9. A non-volatile computer-readable storage medium comprising a computer program, wherein when the computer program is executed by a processor, the processor executes the image processing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Anti-jitter processing method and apparatus for space photography
CN106251317A
Method and device for preventing jitter of video
CN108600622A
Method and apparatus for video Anti-shaking optimization and electronic device
WO2021102893A1
