Image processing method, electronic equipment and storage medium

By pre-screening and image registration fusion of images captured by streamers, combined with downsampling and weighted superposition technology, the problems of image blur, ghosting and overexposure in streamer photography are solved, achieving fast processing and realistic long exposure effects. Improved mobile experience.

CN118632137APending Publication Date: 2024-09-10WEILAI MOBILE TECH CO LTD

Patent Information

Application Number
CN202310216169.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-07
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

Existing streamer shooting technology has problems such as insufficient image registration accuracy, background blur and ghosting, overexposure, and high computational complexity, making it impossible to quickly generate result images and previews.

Method used

By screening multiple consecutive frames of images with preset conditions, the reference frame and the frame to be processed are determined for image registration and fusion, and down-sampling and weighted superposition technology are used to optimize the streamer algorithm processing process.

Benefits of technology

It improves image processing speed, reduces blur and ghosting, and more realistically simulates long exposure effects, ensuring a smooth mobile experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118632137A
    Figure CN118632137A
Patent Text Reader

Abstract

The invention relates to the field of image processing, particularly provides an image processing method, electronic equipment and a storage medium, and aims to solve the problems of blurring, ghosting, overexposure and relatively slow processing of a shot image. Therefore, the method comprises the following steps: S1, acquiring continuous multi-frame images; s2, screening the continuous multiple frames of images frame by frame based on a preset condition, and taking an image frame meeting the preset condition as a reference frame; s3, taking other image frames after the reference frame in the continuous multi-frame image as to-be-processed image frames, and determining a current to-be-processed frame from the to-be-processed image frames; s4, performing image registration and image fusion on the reference frame and the current frame to be processed, and replacing the reference frame with the processed image frame; and S5, sequentially selecting new current to-be-processed frames from the to-be-processed image frames, and circularly executing the step S4 until image processing of all frames in the to-be-processed image frames is completed. Through the implementation mode, the problems of image blurring, ghosting, overexposure and the like are solved, and the image processing time is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to an image processing method, electronic equipment and storage medium. Background Art

[0002] Light stream shooting is one of the commonly used functions in mobile phone photography in recent years. It is to obtain a picture with a long exposure effect by aligning and fusing multiple frames of images taken continuously.

[0003] There are still many problems with existing stream light photography, including: the processed image has blurred and ghosting background due to insufficient registration accuracy; the image after fusion and superposition of multiple frames may have overexposed background areas; the traffic flow still retains a lot of detailed information of the single-frame image and cannot well simulate the traffic flow effect under long exposure conditions; the calculation complexity is too high, and in the case of long-term multi-frame shooting, the calculation cannot meet the requirements of quickly generating result images and previews.

[0004] Accordingly, the art needs a new technical solution to solve the above problems. Summary of the invention

[0005] In order to overcome the above-mentioned defects, the present invention is proposed to provide an image processing method, an electronic device and a storage medium that solve or at least partially solve the technical problems of image blur, ghosting, overexposure and slow image processing after shooting.

[0006] In a first aspect, an image processing method is provided, the method comprising:

[0007] S1, acquiring multiple continuous frames of images;

[0008] S2, screening the continuous multiple frames of images frame by frame based on a preset condition until an image frame that meets the preset condition is found, and using the image frame that meets the preset condition as a reference frame;

[0009] S3, taking other image frames after the reference frame screened out from the continuous multiple image frames as image frames to be processed, and determining a current frame to be processed from the image frames to be processed;

[0010] S4, performing image registration and image fusion on the reference frame and the current frame to be processed to obtain a processed image frame, and replacing the reference frame with the processed image frame;

[0011] S5. Select new frames to be processed from the image frames to be processed in sequence as the new current frames to be processed, and execute step S4 in a loop until image processing of all frames in the image frames to be processed is completed.

[0012] In a technical solution of the above-mentioned image processing method, screening the continuous multiple frames of images frame by frame based on preset conditions includes:

[0013] Perform clarity detection and / or exposure detection on the continuous multiple frames of images.

[0014] In a technical solution of the above-mentioned image processing method, the clarity detection of the continuous multiple frames of images includes:

[0015] Acquire a gradient map of a single frame image in the continuous multiple frame images;

[0016] Comparing the gradient average of the gradient map with a preset gradient threshold, and screening out image frames whose gradient average is greater than the preset gradient threshold;

[0017] And / or, performing exposure detection on the continuous multiple frames of images includes:

[0018] Obtaining a full-image pixel average value of the single-frame image in the continuous multiple-frame image;

[0019] The image frames whose full-image pixel average value falls within a preset exposure value interval are screened out.

[0020] In a technical solution of the above-mentioned image processing method, acquiring a plurality of consecutive frames of images comprises:

[0021] Get the single-frame exposure time corresponding to the current shooting scene;

[0022] The continuous multiple frames of images are acquired based on the single frame exposure time.

[0023] In a technical solution of the above-mentioned image processing method, performing image registration on the reference frame and the current frame to be processed includes:

[0024] Downsampling the reference frame and the current frame to be processed;

[0025] Performing feature detection and matching on the downsampled reference frame and the current frame to be processed, and upsampling the matched feature points;

[0026] Constructing a homography matrix based on the upsampled feature points;

[0027] The pixel points of the current frame to be processed are mapped based on the homography matrix to obtain the current frame to be processed after registration.

[0028] In a technical solution of the above-mentioned image processing method, the image fusion of the reference frame and the current frame to be processed includes:

[0029] For each pixel position, obtaining the similarity between the registered current frame to be processed and the reference frame;

[0030] Comparing the similarity of each pixel with a preset similarity threshold, and determining the motion area of ​​the registered current frame to be processed and the reference frame based on the comparison result;

[0031] The motion regions of the registered current frame to be processed and the reference frame are weightedly superimposed.

[0032] In a technical solution of the above-mentioned image processing method, before obtaining the similarity between the registered current frame to be processed and the reference frame for each pixel position, the method further includes:

[0033] Down-sampling the reference frame and the registered current frame to be processed;

[0034] and / or,

[0035] Before weighted superposition of the motion regions of the registered current frame to be processed and the reference frame, the method further includes up-sampling the motion regions.

[0036] In a technical solution of the above image processing method, the method further includes:

[0037] The processed image frame obtained in step S4 is previewed and displayed each time.

[0038] In a second aspect, an electronic device is provided, which includes a processor and a storage device, wherein the storage device is suitable for storing multiple program codes, and the program codes are suitable for being loaded and run by the processor to execute the image processing method described in any one of the technical solutions of the above-mentioned image processing method.

[0039] In a third aspect, a computer-readable storage medium is provided, wherein a plurality of program codes are stored therein, wherein the program codes are suitable for being loaded and run by a processor to execute the image processing method described in any one of the technical solutions of the above-mentioned image processing method.

[0040] The above one or more technical solutions of the present invention have at least one or more of the following Beneficial effects:

[0041] In the technical solution for implementing the present invention, the image processing method includes: S1, acquiring a continuous multi-frame image; S2, screening the continuous multi-frame image frame by frame based on preset conditions until an image frame that meets the preset conditions is found, and using the image frame that meets the preset conditions as a reference frame; S3, using other image frames after the reference frame in the continuous multi-frame image as image frames to be processed, and determining the current frame to be processed from the image frames to be processed; S4, performing image registration and image fusion on the reference frame and the current frame to be processed to obtain a processed image frame, and replacing the reference frame with the processed image frame; S5, selecting new frames to be processed from the image frames to be processed in turn as new current frames to be processed, and executing step S4 repeatedly until the image processing of all frames in the image frames to be processed is completed. Through the above implementation, multiple consecutive image frames can be pre-screened to use image frames that meet preset conditions as reference frames, and in the subsequent registration and fusion process, the reference frames are continuously replaced based on the registration and fusion results. By optimizing the overall image processing solution, the processing time of the streamer algorithm is greatly accelerated, and problems such as image blur, ghosting, and overexposure after shooting are solved. The long exposure effect of traffic is better simulated, ensuring a smoother mobile user experience.

[0042] Furthermore, by introducing downsampling operations in the registration process, problems such as image blur and ghosting after shooting are solved; by introducing the fusion weight design of the motion area in the fusion process, problems such as image blur and ghosting after shooting are solved, the effect of streaming light is achieved, and the residual details are avoided. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The disclosure of the present invention will become more easily understood with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present invention. In addition, similar numbers in the figures are used to represent similar components, among which:

[0044] Figure 1 is a schematic flow chart of main steps of an image processing method according to an embodiment of the present invention;

[0045] Figure 2 is a schematic flow chart of main steps of acquiring continuous multi-frame images according to one embodiment of the present invention;

[0046] Figure 3 This is a schematic flow chart of the main steps of performing clarity detection on a plurality of consecutive frames of images according to an embodiment of the present invention;

[0047] Figure 4 is a schematic flow chart of main steps of performing exposure detection on a plurality of consecutive frames of images according to an embodiment of the present invention;

[0048] Figure 5is a schematic flow chart of main steps of performing image registration between a reference frame and a current frame to be processed according to an embodiment of the present invention;

[0049] Figure 6 is a schematic flow chart of main steps of image fusion of a reference frame and a current frame to be processed according to an embodiment of the present invention;

[0050] Figure 7 It is a main structural diagram of an electronic device embodiment according to the present invention.

[0051] List of reference numerals:

[0052] 701: processor; 702: storage device. DETAILED DESCRIPTION

[0053] Some embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.

[0054] In the description of the present invention, "module" and "processor" may include hardware, software or a combination of the two. A module may include hardware circuits, various suitable sensors, communication ports, and memories, and may also include software parts, such as program codes, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, hardware, or a combination of the two. Non-temporary computer-readable storage media include any suitable medium that can store program codes, such as a magnetic disk, a hard disk, an optical disk, a flash memory, a read-only memory, a random access memory, and the like. The term "A and / or B" means all possible combinations of A and B, such as only A, only B, or A and B. The term "at least one A or B" or "at least one of A and B" has a similar meaning to "A and / or B", and may include only A, only B, or A and B. The singular terms "one" and "the" may also include plural forms.

[0055] Here we first explain some terms involved in the present invention.

[0056] Auto exposure: Auto exposure, AE. It is a kind of 3A algorithm. It is a mechanism for the camera to automatically adjust the exposure and gain according to the strength of the external light to prevent overexposure or underexposure. AE is also a relatively important module in the entire debugging module, and it is often associated with other modules. A well-debugged module must be based on a better auto exposure. The main factors affecting AE are ISO sensitivity, aperture size, and exposure time.

[0057] Exposure Meter: Exposure Meter, also called light meter, is an instrument that measures the intensity of light when taking photos and thereby controls the exposure time and aperture size.

[0058] SIFT: Scale-invariant feature transform, is a description used in the field of image processing. This description is scale-invariant and can detect key points in the image. It is a local feature descriptor. SIFT features finally represent the input image as a set of 128-dimensional feature vectors. SIFT features are rotation, scaling, translation, and illumination invariant.

[0059] Homography: Homography is a transformation matrix that maps points on one image to corresponding points on another image.

[0060] As described in the background technology, existing stream light photography still has many problems, including: (1) the processed image has blurred background and ghosting due to insufficient registration accuracy; (2) the image after fusion and superposition of multiple frames may have overexposure of the background area; (3) the traffic flow still retains a lot of detailed information of the single-frame image, and it is difficult to simulate the traffic flow effect under long exposure conditions; (4) the computational complexity is too high. In the case of long-term multi-frame shooting, the calculation cannot meet the requirements of quickly generating result images and previewing.

[0061] In order to solve the above problems, the present invention provides an image processing method, an electronic device and a storage medium.

[0062] See attached Figure 1 , Figure 1 FIG. 1 is a flow chart of the main steps of an image processing method according to an embodiment of the present invention. Figure 1 As shown, the image processing method in the embodiment of the present invention mainly includes steps S101 to S105.

[0063] Step S101: Acquire multiple consecutive image frames.

[0064] Step S102: screening multiple consecutive image frames frame by frame based on preset conditions until an image frame that meets the preset conditions is found, and using the image frame that meets the preset conditions as a reference frame.

[0065] Step S103: taking other image frames after the reference frame in the continuous multiple image frames as image frames to be processed, and determining a current frame to be processed from the image frames to be processed.

[0066] Step S104: performing image registration and image fusion on the reference frame and the current frame to be processed to obtain a processed image frame, and replacing the reference frame with the processed image frame.

[0067] Step S105: selecting new frames to be processed from the image frames to be processed in sequence as new current frames to be processed, and executing step S104 in a loop until the image processing of all frames in the image frames to be processed is completed.

[0068] Based on the method described in steps S101 to S105 above, multiple consecutive image frames can be pre-screened to use image frames that meet preset conditions as reference frames, and then registration and fusion are performed based on the reference frames; and in the subsequent registration and fusion process, the reference frames are continuously replaced based on the registration and fusion results. Through the optimization design of the overall solution and algorithm details in image processing, the processing time of the streamer algorithm is greatly accelerated, and the problems of image blur, ghosting, overexposure, etc. after shooting are solved, and the long exposure effect of traffic is better simulated, ensuring a smoother mobile terminal experience.

[0069] The above steps S101 to S105 are further explained below.

[0070] In some embodiments, see Appendix Figure 2 , Figure 2 FIG. 1 is a schematic diagram of the main steps of obtaining continuous multi-frame images according to an embodiment of the present invention. Figure 2 As shown, the process mainly includes the following steps S1011 to S1012.

[0071] Step S1011: obtaining a single-frame exposure time corresponding to the current shooting scene;

[0072] The light streamer effect is an algorithm effect that simulates long exposure. Compared with ordinary shooting, it requires a longer single-frame exposure time. Therefore, it is necessary to obtain the single-frame exposure time corresponding to the current shooting scene, including:

[0073] (1) Performing exposure detection on the shooting scene to obtain automatic exposure AE;

[0074] The brightness of an image is mainly determined by the aperture factor, exposure time, and ISO. The shorter the exposure time, the less light enters, and the longer the exposure time, the more light enters; the lower the ISO, the less light enters, and the better the image quality; the higher the ISO, the more light enters, and the more noise there is, and the worse the image quality. Therefore, when the aperture factor of the camera is fixed, the brightness of the photo is controlled by the exposure time and ISO, and the AE can be obtained by performing exposure detection on the shooting scene.

[0075] (2) Calculating based on automatic exposure to obtain an exposure table;

[0076] After acquiring AE, the exposure time and ISO can be automatically adjusted according to the AE calculation to ensure normal brightness of the photographed object. Each exposure value in the exposure table corresponds to a set of parameters. In some implementations, the exposure table can be as shown in Table 1 below.

[0077] Table 1

[0078] (3) Setting the exposure time of a single frame image based on the exposure table and the shooting scene.

[0079] In order to adapt to different scenes, the exposure time can be appropriately extended based on the exposure table as the exposure setting of the light streamer algorithm. For example, the single-frame exposure time can be appropriately extended in night scenes, the exposure time can be almost not extended in day scenes, and the exposure time can be appropriately extended based on the lighting conditions in indoor scenes, etc., which are not limited here.

[0080] Step S1012: acquiring a plurality of continuous image frames based on a single frame exposure time.

[0081] After determining the exposure time of a single frame, continuous multiple-frame images can be acquired.

[0082] The above is a further description of step S101 , and the following is a further description of step S102 .

[0083] There may be some problematic images in the continuous multi-frame images obtained based on step S101, such as blur caused by the shaking of the shooting angle under a long exposure time, and brightness jumps due to changes in moving objects in the current scene. These images will have a great impact on the processing effect, such as ghosting and overexposure, etc. Therefore, it is necessary to screen the continuous multi-frame images frame by frame to filter out unqualified images.

[0084] Therefore, in some implementations of step S102, screening the continuous multiple frames of images frame by frame based on preset conditions includes: performing clarity detection and / or exposure detection on the continuous multiple frames of images.

[0085] Further, in some embodiments, see the attached Figure 3 , Figure 3 FIG. 1 is a flow chart showing the main steps of performing clarity detection on a plurality of consecutive frames of images according to an embodiment of the present invention. Figure 3 As shown, the clarity detection includes step S301 to step S302.

[0086] Step S301: obtaining a gradient map of a single frame image in a continuous plurality of frame images;

[0087] Specifically, a convolution operation can be performed on each frame of the image through a convolution kernel to extract a gradient map.

[0088] Step S302: Compare the average gradient of the gradient map with a preset gradient threshold, and filter out the image frames whose average gradient of the gradient map is greater than the preset gradient threshold.

[0089] Specifically, first calculate the mean of the gradient map to obtain the average gradient of the gradient map, denoted as a1. Then, by comparing a1 of each frame of the image with the preset gradient threshold T1, the qualified image frames can be filtered out. When a1 > T1, the clarity of this frame of the image meets the requirements; otherwise, it does not meet the requirements. The image frames that do not meet the requirements will be discarded to avoid affecting the image processing effect. Among them, the preset gradient threshold T1 can be set according to the usage scenario and is not limited here.

[0090] In some other embodiments, refer to the attached Figure 4 , Figure 4 is a schematic diagram of the main step flow for detecting the exposure of consecutive multiple frames of images according to an embodiment of the present invention. As Figure 4 shown, the clarity detection includes Step S401 to Step S402.

[0091] Step S401: Obtain the average value of all pixels of a single frame of the image among consecutive multiple frames of images.

[0092] By averaging the entire image for each frame of the image, the average value of all pixels of the image is obtained, denoted as a2.

[0093] Step S402: Filter out the image frames whose average value of all pixels falls within a preset exposure value range.

[0094] By judging whether a2 of each frame of the image falls within the exposure value range [T2, T3], the qualified image frames are filtered out. Specifically, when T2 < a2 < T3, it means that the exposure situation of this frame of the image meets the requirements; when a2 ≤ T2, it means that this frame of the image is underexposed; when a2 ≥ T3, it means that this frame of the image is overexposed. Similarly, in order not to affect the image processing effect, the image frames that do not meet the requirements will be discarded. Among them, the endpoint values of the exposure value range [T2, T3] can be set according to the usage scenario and are not limited here.

[0095] It should be noted that the method of screening consecutive multiple frames of images frame by frame based on preset conditions is not limited to the above two situations. In practical applications, as long as it does not violate the technical concept of the present invention, those skilled in the art can select according to the specific usage scenario and are not limited here.

[0096] Furthermore, in some embodiments, the first frame of the image that meets the preset conditions can be used as a reference frame.

[0097] The above is a further description of Step S102. Next, continue to make a further description of Step S103.

[0098] In some implementations of step S103, the acquired continuous multiple frames of images can be screened frame by frame, that is, after the reference frame is screened out, the next frame of image that meets the preset requirements is used as the current frame to be processed, and the current frame to be processed is subsequently aligned and fused with the reference frame.

[0099] In other embodiments, some frames (such as 8 frames) in the acquired continuous multiple-frame images can be screened as a group, and the first frame that meets the preset requirements is used as a reference frame, and the other image frames are used as image frames to be processed. The current frame to be processed is determined from the image frames to be processed, and then the current frame to be processed and the reference frame are subsequently aligned and fused, which is not limited here.

[0100] The above is a further description of step S103 , and the following is a further description of step S104 .

[0101] In some implementations of the above step S104, see the attached Figure 5 , Figure 5 FIG. 1 is a flow chart of the main steps of image registration between a reference frame and a current frame to be processed according to an embodiment of the present invention. Figure 5 As shown, it includes steps S501 to S504.

[0102] Step S501: down-sample the reference frame and the current frame to be processed.

[0103] By downsampling the current frame to be processed and the reference frame by n times, the amount of calculation can be reduced to a certain extent and the speed of image processing can be accelerated.

[0104] Step S502: performing feature detection and matching on the downsampled reference frame and the current frame to be processed, and upsampling the matched feature points.

[0105] In some implementations, for the downsampled reference frame and the current frame to be processed, feature detection may be performed based on SIFT, wherein the SIFT feature detection and matching steps include:

[0106] (1) Scale-space extremum detection: Search image locations at all scales and identify potential scale- and rotation-invariant interest points through Gaussian derivative functions (approximation).

[0107] (2) Accurate positioning of key points: At each candidate location, the position and scale are determined by fitting a fine-tuned model. The key points are selected based on their stability.

[0108] (3) Determination of the main direction of the key point: Based on the local gradient direction of the image, one or more directions are assigned to each key point position. All subsequent operations on the image data are transformed relative to the direction, scale and position of the key point, thereby providing invariance to these transformations.

[0109] (4) Feature point description: In the neighborhood around each feature point, the local gradients of the image are measured at a selected scale, and these gradients are transformed into a representation that allows relatively large local shape deformations and illumination changes.

[0110] Feature detection and matching of the downsampled reference frame and the current frame to be processed ensures the stability of feature detection and matching, and stable image mapping after downsampling can ensure that ghosting, blurring and other problems are less likely to occur in subsequent fusion steps.

[0111] Furthermore, by upsampling the matched feature points by a factor of n, the matched feature points can be restored to the original image resolution, thereby improving the registration accuracy.

[0112] Step S503: constructing a homography matrix based on the upsampled feature points.

[0113] Among them, the homography matrix Homography is a projection mapping from one plane to another plane.

[0114] Step S504: Mapping the pixel points of the current frame to be processed based on the homography matrix to obtain the registered current frame to be processed.

[0115] That is, the pixel points of the current frame to be processed are mapped point by point using the Homography matrix to obtain the current frame to be processed after mapping, that is, the image frame after registration.

[0116] The above is an explanation of image registration between the reference frame and the current frame to be processed.

[0117] In some other implementations of the above step S104, see the attached Figure 6 , Figure 6 FIG. 1 is a flow chart of the main steps of image fusion of a reference frame and a current frame to be processed according to an embodiment of the present invention. Figure 6 As shown, it includes steps S601 to S603.

[0118] Step S601: For each pixel position, obtain the similarity between the registered current frame to be processed and the reference frame.

[0119] In some implementations, before executing the above step S601, the current frame to be processed and the reference frame after registration are downsampled by n times, that is, to ensure that ghosting, blurring and other problems are less likely to occur in the fusion step.

[0120] Furthermore, in some implementations of the above step S601, for each pixel position, a method for obtaining the similarity between the registered current frame to be processed and the reference frame includes calculating a normalized correlation coefficient, cosine similarity, structural similarity measurement, and a hash algorithm.

[0121] The following takes the calculation of the normalized correlation coefficient as an example to further explain step S601. Specifically, for a certain pixel point A in the current frame to be processed after registration, the normalized correlation coefficient of the pixel point A can be obtained through the following steps, and the coefficient is used to represent the similarity between the current frame to be processed and the reference frame after registration:

[0122] (1) With pixel point A in the current frame to be processed after registration and pixel point B in the reference frame as the center and r as the radius, a neighborhood m1 of the pixel point in the current frame to be processed after registration and a neighborhood m2 of the pixel point in the reference frame after registration are constructed respectively; wherein r can be selected as the image radius of the current frame to be processed and the reference frame after registration, or a preset value can be selected according to actual needs, which is not limited here.

[0123] (3) Calculate the normalized correlation coefficient between neighborhood m1 and neighborhood m2 according to the following steps:

[0124] First, obtain the offset of each pixel in the neighborhood m2 relative to the corresponding pixel in the neighborhood m1. For example, if the coordinate position of a pixel in m1 is (x', y'), then the coordinate position of the corresponding pixel in m2 is (x+x', y+y'). If m1 and m2 completely overlap, the values ​​of x and y are 0.

[0125] Afterwards, for all the pixels contained in the neighborhood m1, convolve each pixel (x', y') with the pixel (x+x', y+y') corresponding to the pixel (x', y') in m2 in turn;

[0126] After completing the convolution operation of all pixels in m1 and all corresponding pixels in m2, the convolution results are summed and normalized to obtain the normalized correlation coefficient of m1 and m2, denoted as c, and the normalized correlation coefficient c is used as a parameter to characterize the similarity of pixel A.

[0127] It should be noted that the above example of obtaining the similarity between the current frame to be processed and the reference frame after alignment is only a schematic illustration. In actual applications, technical personnel in this field can select the above method or other methods to obtain the similarity between the current frame to be processed and the reference frame after alignment according to the usage scenario, and no limitation is made here.

[0128] The above is the description of step S601.

[0129] Step S602: Compare the similarity of each pixel with a preset similarity threshold, and determine the motion area of the current frame to be processed and the reference frame after registration based on the comparison result.

[0130] In some embodiments, the similarity threshold can be set to T4. Further, when c < T4, mark the positions of the corresponding pixel points in m1 and m2 as the motion area, thereby determining the motion area of the current frame to be processed and the reference frame after registration, denoted as M; when c ≥ T4, mark the positions of the corresponding pixel points in m1 and m2 as non-motion areas.

[0131] Further, the motion area can be upsampled by n times to restore it to the original image resolution.

[0132] The above is the description of step S602.

[0133] Step S603: Perform weighted superposition on the motion areas of the current frame to be processed and the reference frame after registration.

[0134] In some embodiments, M can be used to perform weighted superposition fusion on the current frame to be processed and the reference frame after registration. The algorithm is as follows:

[0135] O(x,y) = R(x,y), if M(x,y) = 0;

[0136] O(x,y) = I'(x,y)*w + R(x,y)*(1 - w), if M(x,y)>0

[0137] Among them, O is the output image, R represents the reference frame, I' represents the current frame to be processed after registration, (x,y) are the pixel coordinates of the image frame after fusion, and w is the fusion weight.

[0138] Specifically, when M(x,y) = 0, that is, the current position is a non-motion area. At this time, no fusion is performed, which can ensure that the static background will not be blurred due to motion superposition; when M(x,y)>0, that is, the current position is a motion area. At this time, weighted superposition is performed on the current frame to be processed and the reference frame after registration, and the weight is w. Among them, the calculation method of w is as follows:

[0139] w = M(x,y)*pow(I'(x,y) / 255,5)*255

[0140] Among them, M(x,y) represents each pixel point in the motion area, I' represents the current frame to be processed after registration, I'(x,y) / 255 represents the normalization calculation of each pixel point (x,y) in I' divided by 255, pow represents the power function, and the function pow(I'(x,y) / 255,5) represents the 5th power operation of the normalized value (the "5" in the formula is an empirical value and can be set by yourself in actual application), and finally multiplied by 255 to achieve higher weights for positions with larger pixel values.

[0141] Through the above fusion method, the smooth superposition of the moving area is guaranteed. At the same time, the pixels of the registered image are processed, and the positions with larger pixel values ​​have higher weights, which ensures that the result of the streamer effect fusion retains the highlight part as much as possible, while the redundant detail information can be erased, which is more realistic and close to the long exposure effect.

[0142] The above is the description of step S603.

[0143] Furthermore, in some implementations, each processed image frame obtained in step S104 may be previewed and displayed to show the fusion effect in real time, thereby improving the user experience.

[0144] The above is a further description of step S104 , and the following is a further description of step S105 .

[0145] In some implementations, step S105 includes sequentially selecting new frames to be processed from the image frames to be processed as new current frames to be processed, and looping through step S104 until image processing of all frames in the image frames to be processed is completed.

[0146] Specifically, the image frame outputted in step S104 may replace the reference frame, and continue to be registered and fused with the new current frame to be processed until all the images to be processed are processed, which can further ensure the effect of image processing and make the obtained streamer effect more natural.

[0147] Based on the above method, we can first pre-screen multiple consecutive image frames to obtain image frames that meet the preset conditions, and then perform registration and fusion. By optimizing the design of the overall solution and algorithm details, the processing time of the streamer algorithm is greatly accelerated. At the same time, by designing reasonable fusion calculations, we can solve problems such as image blur, ghosting, and overexposure after shooting, better simulate the long exposure effect of traffic flow, and ensure a smoother mobile user experience.

[0148] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art can understand that in order to achieve the effects of the present invention, different steps do not have to be performed in such an order. They can be performed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present invention.

[0149] It should be noted that the image frames and data (including but not limited to data for analysis, data for storage, data for display, etc.) involved in the embodiments of the present disclosure are all information and data authorized by the user or fully authorized by all parties. The operations such as acquisition, processing, and display of images involved in the embodiments of the present disclosure are all performed after authorization by the user or the object or after full authorization by all parties.

[0150] It is understood by those skilled in the art that the present invention implements all or part of the processes in the method of the above embodiment, and can also be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device, medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electric carrier signal, telecommunication signal and software distribution medium, etc. that can carry the computer program code.

[0151] Furthermore, the present invention also provides an electronic device. Figure 7 , Figure 7 1 is a schematic diagram of the main structure of an electronic device according to an embodiment of the present invention. Figure 7 As shown, the electronic device in the embodiment of the present invention mainly includes a processor 701 and a storage device 702. The storage device 702 can be configured to store a program for executing the image processing method of the above method embodiment, and the processor 701 can be configured to execute the program in the storage device 702, which includes but is not limited to the program for executing the image processing method of the above method embodiment. For ease of explanation, only the part related to the embodiment of the present invention is shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention.

[0152] In some possible implementations of the present invention, the electronic device may include multiple processors 701 and multiple storage devices 702. The program for executing the image processing method of the above method embodiment may be divided into multiple subprograms, each of which may be loaded and run by the processor 701 to execute different steps of the image processing method of the above method embodiment. Specifically, each subprogram may be stored in different storage devices 702, and each processor 701 may be configured to execute the programs in one or more storage devices 702 to jointly implement the image processing method of the above method embodiment, that is, each processor 701 executes different steps of the image processing method of the above method embodiment to jointly implement the image processing method of the above method embodiment.

[0153] The above-mentioned multiple processors 701 may be processors deployed on the same device. For example, the above-mentioned electronic device may be a high-performance device composed of multiple processors, and the above-mentioned multiple processors 701 may be processors configured on the high-performance device. In addition, the above-mentioned multiple processors 701 may also be processors deployed on different devices. For example, the above-mentioned electronic device may be a server cluster, and the above-mentioned multiple processors 701 may be processors on different servers in the server cluster; the above-mentioned electronic device may be a driving device cluster, and the above-mentioned multiple processors 701 may be processors on different driving devices in the driving device cluster.

[0154] Furthermore, the present invention also provides a computer-readable storage medium. In a computer-readable storage medium embodiment according to the present invention, the computer-readable storage medium can be configured to store a program for executing the image processing method of the above method embodiment, and the program can be loaded and run by the processor to implement the above image processing method. For ease of explanation, only the parts related to the embodiment of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The computer-readable storage medium can be a storage device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiment of the present invention is a non-temporary computer-readable storage medium.

[0155] So far, the technical solution of the present invention has been described in conjunction with an embodiment shown in the accompanying drawings, but it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

Claims

1. An image processing method, characterized in that: The method comprises: S1, acquiring multiple continuous frames of images; S2, screening the continuous multiple frames of images frame by frame based on a preset condition until an image frame that meets the preset condition is found, and using the image frame that meets the preset condition as a reference frame; S3, taking other image frames after the reference frame screened out from the continuous multiple image frames as image frames to be processed, and determining a current frame to be processed from the image frames to be processed; S4, performing image registration and image fusion on the reference frame and the current frame to be processed to obtain a processed image frame, and replacing the reference frame with the processed image frame; S5. Select new frames to be processed from the image frames to be processed in sequence as the new current frames to be processed, and execute step S4 in a loop until the image processing of all frames in the image frames to be processed is completed.

2. The image processing method according to claim 1, characterized in that: The screening of the continuous multiple frames of images frame by frame based on the preset conditions comprises: Perform clarity detection and / or exposure detection on the continuous multiple frames of images.

3. The image processing method according to claim 2, characterized in that: The performing clarity detection on the continuous multiple frames of images comprises: Acquire a gradient map of a single frame image in the continuous multiple frame images; Comparing the gradient average of the gradient map with a preset gradient threshold, and screening out image frames whose gradient average is greater than the preset gradient threshold; And / or, performing exposure detection on the continuous multiple frames of images includes: Obtaining a full-image pixel average value of the single-frame image in the continuous multiple-frame image; The image frames whose full-image pixel average value falls within a preset exposure value interval are screened out.

4. The image processing method according to claim 1, characterized in that: The acquiring of continuous multiple-frame images comprises: Get the single-frame exposure time corresponding to the current shooting scene; The continuous multiple frames of images are acquired based on the single frame exposure time.

5. The image processing method according to claim 1, characterized in that: The performing image registration on the reference frame and the current frame to be processed comprises: Downsampling the reference frame and the current frame to be processed; Performing feature detection and matching on the downsampled reference frame and the current frame to be processed, and upsampling the matched feature points; Constructing a homography matrix based on the upsampled feature points; The pixel points of the current frame to be processed are mapped based on the homography matrix to obtain the current frame to be processed after registration.

6. The image processing method according to claim 5, characterized in that: The image fusion of the reference frame and the current frame to be processed comprises: For each pixel position, obtaining the similarity between the registered current frame to be processed and the reference frame; Comparing the similarity of each pixel with a preset similarity threshold, and determining the motion area of ​​the registered current frame to be processed and the reference frame based on the comparison result; The motion regions of the registered current frame to be processed and the reference frame are weightedly superimposed.

7. The image processing method according to claim 6, characterized in that: Before obtaining the similarity between the registered current frame to be processed and the reference frame for each pixel position, the method further includes: Down-sampling the reference frame and the registered current frame to be processed; and / or, Before weighted superposition of the motion regions of the registered current frame to be processed and the reference frame, the method further includes up-sampling the motion regions.

8. The image processing method according to claim 1, characterized in that: The method further comprises: The processed image frame obtained in step S4 is previewed and displayed each time.

9. An electronic device comprising a processor and a storage device, wherein the storage device is suitable for storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and run by the processor to execute the image processing method according to any one of claims 1 to 8.

10. A computer-readable storage medium storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and run by a processor to execute the image processing method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Image processing method and device, electronic equipment and computer readable storage medium

    CN113674189A

  • Image processing method and device, electronic equipment and readable storage medium

    CN113870300A

  • Image processing method and image processing device

    CN113992861A

  • Image fusion method and device, computer readable storage medium and terminal

    CN114511487A

  • Video image denoising method and device, equipment and storage medium

    CN115242933A

Cited By

  • Multi-frame image fusion method and electronic equipment

    CN119485045A

  • Method and Electronic Device for Multi-Frame Image Fusion

    CN119485045B

  • Low-quality gating image enhancement processing method suitable for underwater imaging

    CN120070234A