Image processing method, electronic device, and storage medium

By optimizing image screening, registration and fusion in streamer shooting technology, the problems of image blur, ghosting and overexposure in streamer shooting are solved, achieving better long exposure effects and mobile experience, and improving the performance of the streamer algorithm. Processing speed.

WO2024183388A1PCT designated stage expired Publication Date: 2024-09-12NIO SMART TECH CO LTD

Patent Information

Application Number
PCT/CN2023/138632
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-07
Filing Date
2023-12-14
Publication Date
2024-09-12

Smart Images

  • Figure CN2023138632_12092024_PF_FP_ABST
    Figure CN2023138632_12092024_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the field of image processing, and specifically provides an image processing method, an electronic device, and a storage medium, aiming to solve the problems of image blur, ghosting, overexposure, and slow processing after photographing. To achieve this objective, the present application comprises: S1, acquiring multiple consecutive image frames; S2, screening the multiple consecutive image frames frame by frame on the basis of a preset condition, and taking an image frame satisfying the preset condition as a reference frame; S3, taking other image frames after the reference frame in the multiple consecutive image frames as image frames to be processed, and determining a current frame to be processed from among the image frames to be processed; 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 a new current frame to be processed from among the image frames to be processed, and cyclically executing S4 until image processing of all the image frames to be processed is completed. By means of the implementation mode, the problems of image blur, 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

Image processing method, electronic device and storage medium

[0001] This application claims priority to Chinese patent application No. 202310216169.X filed on March 7, 2023, with the invention name “Image processing method, electronic device and storage medium”. The entire contents of the above Chinese patent application are incorporated into this application by reference. Technical Field

[0002] The present application relates to the field of image processing technology, and in particular to an image processing method, electronic device, and storage medium. Background Art

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

[0004] Existing stream light photography still has many problems, including: the processed image has blurred and ghosting backgrounds due to insufficient registration accuracy; the image after multi-frame fusion and superposition may have overexposed background areas; the traffic flow still retains many detailed information of the single-frame image and cannot well simulate the traffic flow effect under long exposure conditions; the computational 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.

[0005] Accordingly, this field requires a new technical solution to solve the above problems.

[0006] Summary of the Invention

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

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

[0009] S1, acquiring multiple consecutive frames of images;

[0010] 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;

[0011] 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;

[0012] 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;

[0013] 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.

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

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

[0016] In one technical solution of the above-mentioned image processing method, the performing clarity detection on the continuous multiple frames of images includes:

[0017] Obtaining a gradient map of a single frame image in the continuous multi-frame image;

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

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

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

[0021] Image frames whose full-image pixel average value falls within a preset exposure value range are screened out.

[0022] In one technical solution of the above image processing method, acquiring a plurality of consecutive frames of images includes:

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

[0024] The continuous multiple-frame images are acquired based on the single-frame exposure time.

[0025] 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:

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

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

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

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

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

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

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

[0033] Weighted superposition is performed on the motion areas of the registered current frame to be processed and the reference frame.

[0034] 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:

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

[0036] and / or,

[0037] 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.

[0038] In one technical solution of the above image processing method, the method further includes:

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

[0040] 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.

[0041] In a third aspect, a computer-readable storage medium is provided, which stores a plurality of program codes, 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.

[0042] The above one or more technical solutions of this application have at least one or more of the following beneficial effects:

[0043] In the technical solution for implementing the present application, the image processing method includes: S1, obtaining 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 looping through step S4 until image processing of all frames in the image frames to be processed is completed. Through the above implementation method, multiple consecutive image frames can be pre-screened first, and the image frames that meet the preset conditions can be used as reference frames. 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 flow is better simulated, ensuring a smoother mobile user experience.

[0044] 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

[0045] The disclosure of this application will be more easily understood with reference to the accompanying drawings. Those skilled in the art will readily appreciate that these drawings are for illustrative purposes only and are not intended to limit the scope of protection of this application. Furthermore, similar numbers in the figures represent similar components, where:

[0046] FIG1 is a schematic flow chart of main steps of an image processing method according to an embodiment of the present application;

[0047] FIG2 is a schematic diagram of a main step flow chart of acquiring multiple consecutive frames of images according to an embodiment of the present application;

[0048] FIG3 is a schematic flow chart of the main steps of performing clarity detection on a plurality of consecutive image frames according to an embodiment of the present application;

[0049] FIG4 is a schematic flow chart of main steps of performing exposure detection on a plurality of consecutive image frames according to an embodiment of the present application;

[0050] FIG5 is 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 application;

[0051] FIG6 is a schematic 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 application;

[0052] FIG7 is a schematic diagram of the main structure of an electronic device according to an embodiment of the present application.

[0053] List of reference numerals:

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

[0055] Some embodiments of the present application are described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present application and are not intended to limit the scope of protection of the present application.

[0056] In the description of this application, "module" and "processor" may include hardware, software, or a combination of both. A module may include hardware circuitry, various suitable sensors, communication ports, and memory. It may also include software components, such as program code, or a combination of software and hardware. A processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other suitable processor. A processor has data and / or signal processing capabilities. A processor may be implemented in software, hardware, or a combination of both. Non-transitory computer-readable storage media include any suitable medium capable of storing program code, such as magnetic disks, hard disks, optical disks, flash memory, read-only memory, random access memory, etc. The term "A and / or B" refers to all possible combinations of A and B, such as only A, only B, or both A and B. The terms "at least one of A or B" or "at least one of A and B" have similar meanings to "A and / or B" and may include only A, only B, or both A and B. The singular forms "a" and "the" may also include the plural forms.

[0057] Here we first explain some terms involved in this application.

[0058] Auto exposure (AE) is a type of 3A algorithm. It's a mechanism by which the camera automatically adjusts exposure and gain based on ambient light levels to prevent overexposure or underexposure. AE is a crucial component of the entire debugging module and is often intertwined with other modules. A well-debugged module is inherently based on excellent auto exposure. AE is primarily influenced by ISO sensitivity, aperture size, and exposure time.

[0059] 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.

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

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

[0062] As described in the background technology, existing stream light photography still has many problems, including: (1) the background of the processed image is blurred and ghosted due to insufficient registration accuracy; (2) the image after multi-frame fusion and superposition may have overexposure of the background area; (3) the traffic flow still retains a lot of detailed information of the single-frame image, which cannot well 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.

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

[0064] Please refer to Figure 1, which is a schematic flow chart of the main steps of an image processing method according to an embodiment of the present application. As shown in Figure 1, the image processing method in the embodiment of the present application mainly includes steps S101 to S105.

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

[0066] 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.

[0067] Step S103: other image frames following the reference frame in the continuous multiple image frames are used as image frames to be processed, and a current frame to be processed is determined from the image frames to be processed.

[0068] 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.

[0069] 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 image processing of all frames in the image frames to be processed is completed.

[0070] Based on the method described in steps S101 to S105 above, multiple consecutive image frames can be pre-screened, with the image frame that meets the preset conditions serving as the reference frame. Registration and fusion are then performed based on this reference frame; and during the subsequent registration and fusion process, this reference frame is continuously replaced based on the registration and fusion results. By optimizing the overall image processing scheme and algorithm details, the processing time of the streamer algorithm is greatly accelerated, resolving issues such as blurred images, ghosting, and overexposure after capture, better simulating the long-exposure effect of traffic flow, and ensuring a smoother mobile user experience.

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

[0072] In some embodiments, referring to FIG2 , FIG2 is a schematic flow chart of the main steps of acquiring a continuous multi-frame image according to an embodiment of the present application. As shown in FIG2 , the process mainly includes the following steps S1011 to S1012 .

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

[0074] The light stream effect is an algorithmic effect that simulates long exposure. Compared to 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. Specifically, it includes:

[0075] (1) Perform exposure detection on the shooting scene and obtain automatic exposure AE;

[0076] Image brightness is primarily determined by the aperture, exposure time, and ISO. Shorter exposure times reduce the amount of light entering, while longer exposure times increase the amount of light entering. Lower ISO values ​​reduce light intake but also improve image quality. Higher ISO values ​​increase light intake but also increase noise and reduce image quality. Therefore, when the camera's aperture is fixed, the brightness of the image is controlled by exposure time and ISO. AE can be determined by performing exposure monitoring on the scene.

[0077] (2) Calculate based on automatic exposure to obtain an exposure table;

[0078] After obtaining 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 embodiments, the exposure table can be as shown in Table 1 below.

[0079] Table 1

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

[0081] To adapt to different scenarios, the exposure time can be appropriately extended based on the exposure table as the exposure setting for the light stream algorithm. For example, the exposure time for a single frame can be appropriately extended in night scenes, the exposure time can be almost unchanged in day scenes, and the exposure time can be appropriately extended in indoor scenes based on the lighting conditions, etc., which are not limited here.

[0082] Step S1012: Acquire multiple consecutive image frames based on the single-frame exposure time.

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

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

[0085] 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. Therefore, it is necessary to screen the continuous multi-frame images frame by frame to filter out unqualified images.

[0086] 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.

[0087] Furthermore, in some embodiments, referring to FIG3 , FIG3 is a schematic flow chart of the main steps of performing clarity detection on a plurality of consecutive image frames according to an embodiment of the present application. As shown in FIG3 , the clarity detection includes steps S301 to S302 .

[0088] Step S301: obtaining a gradient map of a single frame image in a continuous multi-frame image;

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

[0090] Step S302: Compare the gradient average value of the gradient image with a preset gradient threshold, and select image frames whose gradient average value is greater than the preset gradient threshold.

[0091] Specifically, first calculate the mean value of the gradient map to obtain the average value of the gradient map, denoted as a1. Then, by comparing a1 of each frame image with a preset gradient threshold T1, the image frames that meet the conditions can be screened out. When a1 > T1, the clarity of this frame 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.

[0092] In some other embodiments, refer to FIG. 4. FIG. 4 is a schematic diagram of the main steps for detecting the exposure of consecutive multiple frames of images according to an embodiment of the present application. As shown in FIG. 4, the clarity detection includes steps S401 to S402.

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

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

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

[0096] By judging whether a2 of each frame image falls within the exposure value range [T2, T3], the image frames that meet the conditions are screened out. Specifically, when T2 < a2 < T3, it means that the exposure situation of this frame image meets the requirements; when a2 ≤ T2, it means that this frame image is underexposed; when a2 ≥ T3, it means that this frame 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.

[0097] 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 solution of the present application, those skilled in the art can select according to the specific usage scenario and are not limited here.

[0098] Further, in some embodiments, the first frame image that meets the preset conditions screened out can be used as a reference frame.

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

[0100] In some embodiments of step S103, the obtained consecutive multiple frames of images can be screened frame by frame. That is, after screening out the reference frame, the next frame image that meets the preset requirements is used as the current frame to be processed, and the current frame to be processed and the reference frame are subjected to subsequent registration and fusion.

[0101] In other embodiments, some frames (such as 8 frames) in the acquired continuous multi-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.

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

[0103] In some implementations of the above step S104, refer to FIG5, which is a flowchart of the main steps of performing image registration between the reference frame and the current frame to be processed according to an embodiment of the present application. As shown in FIG5, it includes steps S501 to S504.

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

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

[0106] 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.

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

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

[0109] (2) Accurate positioning of key points: At each candidate location, a fine-tuned model is used to determine the position and scale. The key points are selected based on their stability.

[0110] (3) Determination of the main direction of key points: 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 points, thereby providing invariance to these transformations.

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

[0112] Performing feature detection and matching on the downsampled reference frame and the current frame to be processed ensures the stability of feature detection and matching, and performing stable image mapping after downsampling can ensure that problems such as ghosting and blurring will occur less frequently in the subsequent fusion steps.

[0113] 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.

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

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

[0116] 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.

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

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

[0119] In some other implementations of the above step S104, please refer to FIG6, which is a schematic flow chart of the main steps of image fusion of the reference frame and the current frame to be processed according to an embodiment of the present application. As shown in FIG6, it includes steps S601 to S603.

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

[0121] In some implementations, before executing step S601 , the registered current frame to be processed and the reference frame are downsampled by a factor of n, to ensure that ghosting, blurring, and other issues are less likely to occur in the fusion step.

[0122] 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.

[0123] The following further illustrates step S601 by taking the calculation of the normalized correlation coefficient as an example. 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 by the following steps, and the normalized correlation coefficient is used to represent the similarity between the current frame to be processed and the reference frame after registration:

[0124] (1) With the pixel point A in the current frame to be processed after registration and the corresponding 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 corresponding pixel point in the reference frame are constructed respectively; where 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.

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

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

[0127] Afterwards, for all 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.

[0128] 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. The normalized correlation coefficient c is used as the parameter to characterize the similarity of pixel A.

[0129] 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, those skilled in the art can choose 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.

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

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

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

[0133] Further, the motion region can be upsampled by n times to restore to the original image resolution.

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

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

[0136] 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:

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

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

[0139] Where, 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.

[0140] Specifically, when M(x,y) = 0, that is, the current position is a non-motion region. 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 region. 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. The calculation method of w is as follows:

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

[0142] Where, M(x,y) represents each pixel point of the motion region, I' represents the current frame to be processed after registration, I'(x,y) / 255 represents normalizing each pixel point (x,y) in I' by dividing by 255, pow represents the function of taking the power, the function pow(I'(x,y) / 255,5) represents performing the fifth power operation on the normalized value (the "5" in the formula is an empirical value and can be set by yourself in actual applications), and finally multiplying by 255 to make the position with a larger pixel value have a higher weight.

[0143] The above fusion method ensures smooth superposition of moving areas. At the same time, the registered image pixels are processed, and positions with larger pixel values ​​are given higher weights. This ensures that the result of the streamer effect fusion retains the highlights as much as possible, while unnecessary details can be erased, more realistically approaching the effect of long exposure.

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

[0145] 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.

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

[0147] In some embodiments, 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.

[0148] Specifically, the image frame output 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. This can further ensure the effect of image processing and make the obtained light effect more natural.

[0149] 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 alignment and fusion. By optimizing 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, problems such as image blur, ghosting, and overexposure after shooting are solved, which better simulates the long exposure effect of traffic flow and ensures a smoother mobile user experience.

[0150] 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 will understand that in order to achieve the effect of the present application, 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 application.

[0151] It should be noted that the image frames and data involved in the embodiments of this disclosure (including but not limited to data used for analysis, storage, and display) are all information and data authorized by the user or fully authorized by all parties. The image acquisition, processing, and display operations involved in the embodiments of this disclosure are all performed with the authorization of the user or the subject or with the full authorization of all parties.

[0152] It will be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment of the present application 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. When the computer program is executed by a processor, it can implement the steps of the above-mentioned various method embodiments. The computer program includes computer program code, which 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, USB flash drive, mobile hard disk, magnetic 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.

[0153] Furthermore, the present application also provides an electronic device. Refer to Figure 7, which is a schematic diagram of the main structure of an electronic device embodiment according to the present application. As shown in Figure 7, the electronic device in the embodiment of the present application 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-mentioned 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 a program for executing the image processing method of the above-mentioned method embodiment. For ease of explanation, only the parts related to the embodiment of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present application.

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

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

[0156] Furthermore, the present application also provides a computer-readable storage medium. In a computer-readable storage medium embodiment according to the present application, the computer-readable storage medium can be configured to store a program for executing the image processing method of the above-mentioned method embodiment, and the program can be loaded and run by the processor to implement the above-mentioned image processing method. For ease of explanation, only the parts related to the embodiment of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present application. 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 application is a non-temporary computer-readable storage medium.

[0157] Thus far, the technical solution of the present application has been described in conjunction with an embodiment shown in the accompanying drawings. However, it is readily understood by those skilled in the art that the scope of protection of the present application is obviously not limited to these specific embodiments. Without departing from the principles of the present application, those skilled in the art may make equivalent changes or substitutions to the relevant technical features, and the technical solutions after such changes or substitutions will fall within the scope of protection of the present application.

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

  • Method and apparatus for generating high dynamic range images

    CN109997351A

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

    CN113674189A

  • Image processing method and image processing device

    CN113992861A

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

    CN114511487A

  • Systems and methods for facilitating the identifying of correspondences between images experiencing motion blur

    US20220028094A1

Cited By

  • Equipment nameplate image recognition and calibration processing method

    CN119206698A

  • Breathing flicker removal processing method and device for movie picture and storage medium

    CN120321348A

  • Method and system for detecting working condition of automatic emptying valve of drying kettle based on multi-view image fusion

    CN121810663A

  • Raindrop distorted image restoration method based on multi-frame registration

    CN122134599A