Panoramic video stitching method and system, electronic device and storage medium
By determining attention parameters and basic fusion parameters in panoramic video stitching and employing multi-band and single-band fusion strategies, the problems of ghosting and double contours in panoramic video stitching in existing technologies are solved, thereby improving visual quality and processing efficiency.
Patent Information
- Application Number
- CN202611362770.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-03
- Publication Date
- 2026-11-24
AI Technical Summary
Existing panoramic video stitching solutions cannot dynamically adjust the fusion strategy when there are moving objects or lens parallax, resulting in ghosting and double contours in the synthesized image, which affects visual quality.
A panoramic video stitching method is adopted. By acquiring multiple video frames to be stitched, attention parameters and basic fusion parameters are determined in the overlapping areas of the images. Pixel-level fusion is then performed based on these parameters, including multi-band fusion strategy for high-attention pixels and single-band or low-complexity fusion strategy for low-attention pixels.
It improves the visual quality of panoramic video, enhances fusion accuracy through differentiated fusion, reduces computational overhead and power consumption, and achieves a balance between visual effects and processing efficiency.
Smart Images

Figure CN123160341A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, specifically to panoramic video stitching methods, systems, electronic devices, and storage media. Background Technology
[0002] With the widespread application of 360° panoramic cameras in fields such as sports photography, security monitoring, and virtual reality, higher demands are being placed on the real-time stitching and processing of panoramic videos. Multi-lens panoramic acquisition devices (such as dual back-to-back fisheye cameras) cover different fields of view through each lens, and then form a complete panoramic image through geometric mapping and image fusion.
[0003] Existing panoramic stitching solutions generally employ a linear fusion method based on fixed weights. This approach involves pre-setting a fixed set of weighting coefficients (usually determined by the distance from the pixel to the boundary of the overlapping area) for each pixel within the overlapping image region. Then, a weighted average is applied to corresponding pixels from different lenses to achieve a smooth transition between images. However, in existing solutions, when moving objects or lens parallax exist in the stitching scene, the projected position of the same object in different images will shift. Since the fixed weights cannot dynamically adjust the fusion strategy based on the actual alignment quality, this results in noticeable ghosting and double contours in the synthesized image, severely impacting the visual quality of the panoramic video. Summary of the Invention
[0004] A panoramic video stitching method is provided to improve the visual quality of panoramic videos.
[0005] Firstly, a panoramic video stitching method is provided, including: Obtain the images to be stitched together corresponding to multiple video frames; For the image overlap region of the images to be stitched in each video frame, determine the attention parameters and basic fusion parameters of the pixels within the image overlap region; Based on attention parameters and basic fusion parameters, pixel-level fusion is performed on the pixel information of each pixel in the image to be stitched to obtain the panoramic stitched image corresponding to each video frame.
[0006] In one embodiment, pixel-level fusion is performed on the pixel information of each pixel in the image to be stitched, based on attention parameters and basic fusion parameters, including: Based on the comparison between the attention parameter and the preset threshold, the pixels in the overlapping area of the image are divided into high-attention pixels and low-attention pixels. A first fusion strategy is used to fuse high-interest pixels, while a second fusion strategy is used to fuse low-interest pixels. The computational complexity of the second fusion strategy is lower than that of the first fusion strategy.
[0007] In one embodiment, a first fusion strategy is used for high-interest pixels, and a second fusion strategy is used for low-interest pixels, including: For high-interest pixels, multi-band fusion is performed on the high-interest pixels based on attention parameters and basic fusion parameters; For low-interest pixels, single-band fusion is performed on the low-interest pixels based on the basic fusion parameters.
[0008] In one embodiment, for high-interest pixels, multi-band fusion is performed on the high-interest pixels based on attention parameters and basic fusion parameters, including: Based on the pixel information of the high-interest pixels in the image to be stitched, determine the frequency band components of each pixel information of the high-interest pixels in multiple frequency bands; Based on the attention parameters and basic fusion parameters of high-attention pixels, the target fusion parameters corresponding to high-attention pixels in multiple frequency bands are determined. By using target fusion parameters, the frequency band components corresponding to high-interest pixels in multiple frequency bands are fused.
[0009] In one embodiment, based on the attention parameters and basic fusion parameters of the high-interest pixels, the target fusion parameters corresponding to the high-interest pixels in multiple frequency bands are determined, including: Obtain the first fusion weights corresponding to each of the multiple frequency bands; The first fusion weight is corrected based on the attention parameters of the high-attention pixels to obtain the second fusion weights corresponding to multiple frequency bands. Based on the basic fusion parameters and the second fusion weight, the target fusion parameters corresponding to the high-interest pixels in multiple frequency bands are determined.
[0010] In one embodiment, based on the basic fusion parameters and the second fusion weights, the target fusion parameters corresponding to the high-interest pixels in multiple frequency bands are determined, including: Obtain the inter-frame difference information between the video frame and the previous video frame, and determine the scene state of the video frame based on the inter-frame difference information; In the case of a sudden change in scene state, the target fusion parameters corresponding to the high-interest pixels in multiple frequency bands are determined based on the basic fusion parameters and the second fusion weight. When the scene is continuous, the predicted fusion weights of the high-interest pixels are obtained in multiple frequency bands. The predicted fusion weights are predicted by using the historical fusion weights corresponding to historical video frames. Based on the basic fusion parameters, predicted fusion weights, and second fusion weights, the target fusion parameters corresponding to the high-interest pixels in multiple frequency bands are determined.
[0011] In one embodiment, the panoramic video stitching method further includes: Obtain the historical fusion weights of high-interest pixels in multiple frequency bands in the panoramic stitched image of at least two historical video frames, as well as the device motion information corresponding to the video frames; For any frequency band of a high-interest pixel, obtain the inter-frame weight difference between multiple historical fusion weights of the frequency band; Based on the inter-frame weight difference, device motion information, and preset motion coefficients, the prediction fusion weights of the predicted frequency bands are predicted, thereby obtaining the prediction fusion weights corresponding to multiple frequency bands.
[0012] In one embodiment, for the image overlap region of the images to be stitched in each video frame, basic fusion parameters within the image overlap region are determined, including: Perform boundary search within the overlapping region of the images to obtain the target stitching boundary; Based on the target stitching boundary, the basic fusion parameters of each pixel within the overlapping area of the image are determined.
[0013] In one embodiment, boundary search is performed within the overlapping region of the images to obtain the target stitching boundary, including: In the overlapping area of the images, obtain multiple candidate stitching boundaries; The target splicing boundary is determined based on the spatial continuity features, temporal continuity features, and target object perception features corresponding to multiple candidate splicing boundaries.
[0014] In one embodiment, spatial continuity features include color difference information and gradient information of the location of the candidate splicing boundary within the overlapping region; Temporal continuity features include the positional difference between the candidate stitching boundary and the target stitching boundary corresponding to the previous video frame; Target object perception features include the target object detection results at the location of the candidate splicing boundary within the overlapping area.
[0015] In one embodiment, the basic fusion parameters are determined based on the target stitching boundary within the image overlap region, and the target stitching boundary is obtained by performing a boundary search within the image overlap region. Panoramic video stitching methods also include: Based on the boundary position of the target stitching boundary, the stitching optimization region is determined within the panoramic stitching image, as well as the current image gradient of the image to be stitched in the stitching optimization region; The gradient of the current image is fused according to the preset gradient mixing coefficients to obtain the gradient of the target image; Based on the difference between the current image gradient and the target image gradient, gradient optimization is performed on the stitching optimization region to obtain the target panoramic stitched image; A panoramic video is obtained by stitching together the target panoramic images corresponding to multiple video frames.
[0016] In one embodiment, the panoramic video stitching method further includes: For each video frame, the image to be stitched is geometrically mapped to a preset panoramic coordinate system; Determine the overlapping area of the images in the preset panoramic coordinate system, and the mapped pixel coordinates within the overlapping area of the images; Based on the mapped pixel coordinates, obtain the pixel information corresponding to the pixel points located in the overlapping area of the images to be stitched.
[0017] Secondly, this application provides a panoramic video stitching device, the device comprising: The data acquisition module is used to acquire the images to be stitched together corresponding to multiple video frames. The parameter extraction module is used to determine the attention parameters and basic fusion parameters of the pixels in the overlapping regions of the images to be stitched for each video frame. An image fusion module is used to perform pixel-level fusion of pixel information at each pixel point of the image to be stitched based on attention parameters and basic fusion parameters, to obtain a panoramic stitched image corresponding to each video frame. Thirdly, this application also provides a panoramic video stitching system, including: The data acquisition module includes a panoramic acquisition device, used to acquire the image to be stitched from each video frame in real time; A panoramic video stitching module, connected to a data acquisition module, is used to implement the panoramic video stitching method as described in any of the first aspects; The video output module, connected to the panoramic video stitching module, is used to output panoramic video based on the panoramic stitched image of each video frame.
[0018] Fourthly, an electronic device is provided, including a processor and a memory coupled to the processor, the memory being used to store program code including instructions, the processor reading instructions from the memory to cause the electronic device to perform a method as described in any of the above aspects and any of the designs therein.
[0019] Fifthly, the present application provides a computer-readable storage medium including computer instructions that, when executed on a device, cause the device to perform any of the possible designs described above.
[0020] Sixthly, the present application provides a computer program product that, when run on a device, causes the device to execute the method in any possible design of any of the above aspects.
[0021] Beneficial effects: By determining attention parameters and basic fusion parameters for the overlapping areas of each video frame, and performing pixel-level fusion on each pixel based on these parameters, fusion can be performed within the overlapping areas according to the characteristics of each pixel, achieving differentiated fusion, improving fusion accuracy, and thus enhancing the visual quality of panoramic video. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a flowchart illustrating the panoramic video stitching method provided by an exemplary embodiment of this disclosure; Figure 2 This is another flowchart illustrating the panoramic video stitching method provided by an exemplary embodiment of this disclosure; Figure 3 This is a flowchart illustrating the first fusion strategy provided by an exemplary embodiment of this disclosure; Figure 4 This is a schematic diagram of the fusion parameter calculation process provided by an exemplary embodiment of this disclosure; Figure 5 This is a schematic diagram of the multi-band fusion process provided by an exemplary embodiment of this disclosure; Figure 6 This is a schematic diagram of the process of panoramic video stitching based on GPU-NPU collaborative execution provided by an exemplary embodiment of this disclosure; Figure 7 This is a schematic diagram of the overall structure of the panoramic video stitching system provided in the exemplary embodiments of this disclosure; Figure 8 This is a timing diagram of asynchronous readback provided by an exemplary embodiment of this disclosure; Figure 9 This is a schematic diagram of a panoramic video stitching device provided in an exemplary embodiment of this disclosure; Figure 10 This is an architecture diagram of a panoramic video stitching system provided by an exemplary embodiment of this disclosure. Detailed Implementation
[0024] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0026] This application provides a panoramic video stitching method, system, electronic device, and storage medium. In one embodiment, an image processing device acquires images to be stitched corresponding to multiple video frames. The image processing device can be a terminal or a server. For the overlapping area of the images to be stitched in each video frame, attention parameters and basic fusion parameters of the pixels within the overlapping area are determined. Based on the attention parameters and basic fusion parameters, pixel-level fusion is performed on the pixel information of each pixel in the images to be stitched to obtain a panoramic stitched image corresponding to the video frame. Based on the panoramic stitched images corresponding to multiple video frames, a panoramic video is obtained. The image processing device can be, for example, a terminal or a server. The terminal can include, but is not limited to, computers, laptops, etc. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, big data, and artificial intelligence platforms. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited herein.
[0027] Firstly, this embodiment provides a panoramic video stitching method, such as... Figure 1 As shown, it includes the following steps: S101, Obtain the images to be stitched corresponding to multiple video frames respectively; S102, for the image overlap region of the image to be stitched in each video frame, determine the attention parameters and basic fusion parameters of the pixels in the image overlap region; S103, based on attention parameters and basic fusion parameters, performs pixel-level fusion of the pixel information of each pixel in the image to be stitched, to obtain the panoramic stitched image corresponding to each video frame.
[0028] In this context, a video frame refers to a moment in the process of acquiring images to be stitched together using a panoramic acquisition device. The panoramic acquisition device includes multiple lenses covering different fields of view; for example, a dual fisheye panoramic camera consists of two fisheye lenses mounted back-to-back, each covering approximately 180° of field of view. The images to be stitched together are the original images from different lenses of the panoramic acquisition device within the same video frame. The image overlap region is the area containing the same scene content in two adjacent images to be stitched together within the same video frame, representing the same physical scene captured at the boundary of the fields of view of different lenses. The image overlap region includes multiple pixels, as well as pixel information from different images to be stitched together at the same pixel, such as pixel values.
[0029] Attention parameters characterize the degree of visual attention to image content; specifically, they can be the attention parameters corresponding to any pixel in an overlapping region of the image. Basic fusion parameters are pre-calculated parameters used to fuse different pixel information of the same pixel, such as weighted fusion of different pixel information. Basic fusion parameters can be fusion parameters to be optimized, and can be optimized based on the corresponding attention parameters.
[0030] For example, the image processing device can be connected to a panoramic acquisition device or an image storage device to acquire images to be stitched together in real time, corresponding to multiple video frames. This includes image data acquired by multiple lenses along different field of view directions at the same time for each video frame, with the multiple images to be stitched together covering the panoramic field of view.
[0031] For any given video frame and at least two images to be stitched, determine the overlapping region between adjacent images. Specifically, this can be achieved by transforming the coordinate system of the images to be stitched from the same video frame to obtain multiple images to be stitched in the same coordinate system, and then determining the overlapping region within these images. The overlapping region includes multiple pixels and pixel information from adjacent images at the same pixel.
[0032] Then, based on the pixel information and pixel positions of the overlapping image regions, the attention parameters and basic fusion parameters within these regions are determined. Specifically, this can be achieved by extracting attention features from the pixel information and pixel positions of the overlapping image regions, and identifying the attention parameters based on these features. For example, attention parameters can be obtained by identifying the attention features for each pixel. Finally, by searching for the target stitching boundary within the overlapping image regions, the basic fusion parameters for each pixel are determined based on the distance between each pixel in the overlapping image regions and the target stitching boundary.
[0033] After obtaining the attention parameters and basic fusion parameters for the overlapping regions of the images, the pixels within these regions are divided into high-attention pixels and low-attention pixels based on the attention parameters. For each high-attention pixel and low-attention pixel, a corresponding fusion strategy is applied using the basic fusion parameters to fuse the pixel information, resulting in the fused overlapping regions. Based on the images to be stitched and the fused overlapping regions, the corresponding panoramic stitched image for that video frame is obtained. The panoramic stitched images corresponding to multiple video frames are then sorted by timestamp to obtain the panoramic video.
[0034] In one embodiment, for high-interest pixels, the corresponding basic fusion parameters can be optimized based on the pixel information of each high-interest pixel to obtain optimized fusion parameters. These optimized fusion parameters are then used to fuse multiple pixel information from the high-interest pixel. Specifically, multi-band fusion is performed on the multiple pixel information from the high-interest pixel. For example, each pixel information is decomposed into frequency band components in multiple frequency bands. The optimized fusion parameters for each frequency band and the frequency band components are then used to fuse the high-interest pixel to obtain the fusion result.
[0035] For low-interest pixels, multiple fusion parameters for each low-interest pixel can be fused using basic fusion parameters to obtain the fusion result for the low-interest pixel. Specifically, multi-band fusion or single-band fusion can be performed on multiple pixel information of low-interest pixels, where the number of frequency bands decomposed from the pixel information of low-interest pixels is less than the number of frequency bands decomposed from the pixel information of high-interest pixels.
[0036] In this embodiment, attention parameters and basic fusion parameters are determined for the overlapping areas of each video frame, and pixel-level fusion is performed on each pixel based on the attention parameters and basic fusion parameters. This enables fusion based on the characteristics of each pixel within the overlapping areas, achieving differentiated fusion, improving fusion accuracy, and thus enhancing the visual quality of the panoramic video.
[0037] In one embodiment, pixel-level fusion is performed on the pixel information of each pixel in the image to be stitched, based on attention parameters and basic fusion parameters, including: Based on the comparison between the attention parameter and the preset threshold, the pixels in the overlapping area of the image are divided into high-attention pixels and low-attention pixels. A first fusion strategy is used to fuse high-interest pixels, while a second fusion strategy is used to fuse low-interest pixels. The computational complexity of the second fusion strategy is lower than that of the first fusion strategy.
[0038] For example, based on the comparison between the attention parameter of each pixel and a preset threshold, pixels within the overlapping area of the image are divided into high-attention pixels and low-attention pixels. Pixels with attention parameters greater than the preset threshold can be identified as high-attention pixels, while pixels with attention parameters less than or equal to the preset threshold can be identified as low-attention pixels.
[0039] A first fusion strategy is used for high-interest pixels, while a second fusion strategy is used for low-interest pixels. The computational complexity of the second fusion strategy is lower than that of the first fusion strategy.
[0040] In this embodiment, by using an attention-guided hierarchical fusion strategy, limited computing resources can be concentrated on highly saliency areas (high-attention pixels), while lightweight processing is applied to visually insensitive areas, which significantly reduces computing overhead and power consumption and improves the real-time processing efficiency of panoramic video stitching.
[0041] In one embodiment, attention features are extracted from the pixel information and pixel positions of the overlapping regions of the image to obtain multi-dimensional attention features, including contrast features, motion features, semantic features, and center prior features. The weight parameters corresponding to each dimension of the attention features are obtained, and the attention features of multiple dimensions are weighted and fused according to these weight parameters to obtain attention parameters. These attention parameters can be used as attention weights to weight the basic fusion information. The attention parameters are shown in formula (1).
[0042] (1) Where A(x,y) represents the attention parameter of any highly concerned pixel, and the closer it is to 1, the more attention it receives; (.) represents the normalization or sigmoid function, used to restrict the weighted result to [0,1]. Represents the attention features of the i-th class; The weight parameters representing the attention features of the i-th class can be obtained through empirical pre-setting, calibration, or offline learning.
[0043] in, Including contrast feature S contrast Motion characteristics S motion Semantic features S semantic and the central prior feature S center .
[0044] Contrast Feature S contrast : Calculate the standard deviation or gradient intensity of brightness within the neighborhood of a pixel. The stronger the texture and the higher the contrast, the greater the significance. Motion characteristics S motionCalculate the color or brightness difference between the current frame and the previous frame at the corresponding position, with higher significance in moving areas.
[0045] Semantic features S semantic : Determined by the mask of the face, body, vehicle, etc. output by the NPU or detection module.
[0046] Central prior feature S center Determined based on the distance from the pixel to the center of the display or the center of the user's field of vision.
[0047] In this embodiment, by adaptively weighting and fusing the multi-dimensional attention features of the overlapping region, the foreground and background can be accurately distinguished, significantly improving the accuracy of target detection and region attention in complex scenes.
[0048] In one embodiment, such as Figure 2 As shown, a first fusion strategy is used for high-interest pixels, and a second fusion strategy is used for low-interest pixels, including: S201, for high-interest pixels, performs multi-band fusion based on attention parameters and basic fusion parameters; S202, for low-interest pixels, performs single-band fusion on low-interest pixels based on basic fusion parameters.
[0049] For example, the pixels within the overlapping region of the images include pixel information from different sources of the images to be stitched together. For high-interest pixels, each pixel information among the multiple pixel information corresponding to the high-interest pixel is decomposed into frequency band components in multiple frequency bands. The frequency band components include at least low-frequency components and high-frequency components. A frequency band refers to different frequency ranges in the spatial domain of an image, divided according to the degree of drastic change in pixel values.
[0050] Then, based on the attention parameters and the basic fusion parameters, the target fusion parameters for each frequency band are determined. The frequency band components of multiple frequency bands are weighted and fused using the target fusion parameters to obtain the fusion result for high-interest pixels. For low-interest pixels, the basic fusion parameters are used to fuse the pixel information corresponding to the low-interest pixel to obtain the fusion result for the low-interest pixel.
[0051] In this embodiment, by performing differentiated multi-band fusion on different regions of the image based on attention parameters, high-quality fusion of visually concerned regions is ensured while significantly reducing the computational overhead of non-concerned regions, achieving the optimal balance between fusion quality and processing efficiency.
[0052] In one embodiment, such as Figure 3 As shown, in step S201, for high-interest pixels, multi-band fusion is performed on the high-interest pixels based on attention parameters and basic fusion parameters, including: S301, Based on the pixel information of the high-interest pixels in the image to be stitched, determine the frequency band components of each pixel information of the high-interest pixels in multiple frequency bands; S302, Based on the attention parameters and basic fusion parameters of the high-attention pixels, determine the target fusion parameters corresponding to the high-attention pixels in multiple frequency bands respectively; S303 uses target fusion parameters to fuse the frequency band components corresponding to high-interest pixels in multiple frequency bands.
[0053] For example, for each pixel information corresponding to a high-interest pixel, the information is decomposed into frequency band components in multiple frequency bands. Specifically, this can be achieved by performing multi-scale Gaussian filtering on overlapping regions of the image, giving each high-interest pixel a multi-scale frequency domain representation, thus obtaining the frequency band components of each high-interest pixel in multiple frequency bands. A frequency band refers to a different frequency range in the spatial domain of an image, divided according to the degree of drastic change in pixel values. Frequency band components refer to information components in the image with different degrees of drastic change in grayscale or color, used to characterize the degree of drastic change in pixel values along the spatial direction. For example, high-frequency components correspond to the detail and edge information of the image, while low-frequency components correspond to the overall brightness and color distribution information of the image.
[0054] For example, the frequency bands can be decomposed into four bands, including ultra-low frequency (L0), low frequency (L1), mid frequency (L2), and high frequency (L3). The frequency band decomposition method is as follows: Ultra-low frequency L0: Apply a large radius Gaussian blur to the original image, for example, σ=16 pixels, to represent overall brightness and large areas of color.
[0055] Low-frequency L1: The difference between the blur result with σ=8 and the blur result with σ=16 represents the hue gradation.
[0056] Mid-frequency L2: The difference between the fuzzy result with σ=4 and the fuzzy result with σ=8 represents the texture structure.
[0057] High-frequency L3: The difference between the original image and the σ=4 blurred result, representing edges and details.
[0058] Specifically, a Gaussian blur with a large-scale parameter (e.g., σ=16 pixels) is applied to the original image, and the result is denoted as the ultra-low frequency component L0, which characterizes the overall brightness distribution and large-scale color information of the image. The difference between the Gaussian blur result with σ=8 pixels and the Gaussian blur result with σ=16 pixels is denoted as the low-frequency component L1, which reflects the tonal gradation information of the image; the difference between the Gaussian blur result with σ=4 pixels and the Gaussian blur result with σ=8 pixels is denoted as the mid-frequency component L2, which characterizes the texture structure information of the image; the difference between the original image and the Gaussian blur result with σ=4 pixels is denoted as the high-frequency component L3, which characterizes the edge contour and detail information of the image. The above σ values are parameters of the embodiment and can be adjusted according to resolution, lens calibration, output size, and mobile computing power. Laplacian pyramids or wavelet decomposition can also be used instead of Gaussian difference. Thus, the original image is decomposed into multiple frequency band components, each corresponding to image features at different scales, so as to perform differentiated fusion processing for different regions of interest in the subsequent process.
[0059] Then, based on the attention parameters and basic fusion parameters of the high-attention pixels, the target fusion parameters corresponding to the high-attention pixels in multiple frequency bands are determined. Specifically, this can involve obtaining the first fusion weights corresponding to each of the multiple frequency bands, calculating the second fusion weights corresponding to each of the multiple frequency bands based on the attention parameters and the first fusion weights, and adjusting the basic fusion parameters using the second fusion weights to obtain the target fusion parameters corresponding to each of the multiple frequency bands. Here, the first fusion weight represents the initially set fusion weight, and the second fusion weight represents the fusion weight after adjustment by the attention parameters. The fusion weight represents the influence factor on the basic fusion parameters.
[0060] After obtaining the target fusion parameters, the frequency band components corresponding to the high-interest pixels in multiple frequency bands are fused to obtain the fusion result of the high-interest pixels.
[0061] In this embodiment, in the overlapping area of the images, frequency band adaptive fusion is guided by an attention mechanism. The target fusion parameters are obtained by adjusting the basic fusion parameters using attention parameters. This preserves the clarity of high-frequency details and ensures a smooth transition of the low-frequency background, thereby eliminating ghosting and brightness abrupt changes at the stitching point.
[0062] In one embodiment, such as Figure 4 As shown, in step S302, based on the attention parameters and basic fusion parameters of the high-interest pixels, the target fusion parameters corresponding to the high-interest pixels in multiple frequency bands are determined, including: S401, obtain the first fusion weights corresponding to multiple frequency bands respectively; S402, the first fusion weight is corrected based on the attention parameters of the high-attention pixels to obtain the second fusion weights corresponding to multiple frequency bands respectively; S403, based on the basic fusion parameters and the second fusion weight, determines the target fusion parameters corresponding to the high-interest pixels in multiple frequency bands.
[0063] For example, the first fusion weights corresponding to multiple frequency bands are associated with the intensity of change represented by the frequency band (such as high frequency band, low frequency band, etc.). A preset initial fusion weight is obtained, and the first fusion weight corresponding to each frequency band is calculated based on the frequency band position and the initial fusion weight. The first fusion weight is shown in formula (2).
[0064] (2) in, This represents the first fusion weight of the k-th frequency band; Indicates the initial fusion weights; η represents the frequency scaling factor, used to control the magnitude of the increase in fusion weight power as the frequency band increases; η represents the nonlinear exponent, used to control the growth curve of fusion weight power; k / N represents the normalized frequency band position, and the larger the k, the higher the frequency.
[0065] The attention parameters of high-attention pixels are used to correct the first fusion weights corresponding to multiple frequency bands, resulting in second fusion weights corresponding to multiple frequency bands. Specifically, an adjustment coefficient for the first fusion weight can be calculated based on the attention parameters, and the first fusion weight can be adjusted using the adjustment coefficient to obtain the second fusion weight. The second fusion weight is shown in formulas (3) and (4).
[0066] (3) (4) in, This represents the second fusion weight of any highly concerned pixel in the k-th frequency band; Indicates the first fusion weight; This represents a dynamic adjustment coefficient used to amplify or reduce the first fusion weight based on the attention parameter. For example, the larger the attention parameter (the more important the pixel), the more important it is. The smaller the value, the stronger the reduction effect on the first fusion weight; attention parameter The smaller (the less important the pixel), then The larger the value, the stronger the amplification effect on the first fusion weight. This indicates the lower limit of the preset fusion weight, power. This indicates the upper limit of the preset fusion weight, power.
[0067] After obtaining the second fusion weight, the target fusion parameters corresponding to the high-interest pixels in multiple frequency bands are calculated based on the basic fusion parameters and the second fusion weight. Then, the frequency band components of multiple frequency bands are fused using the target fusion parameters. This can be done by performing weighted fusion calculation on the frequency band components of multiple frequency bands to obtain the multi-band fusion result of the high-interest pixels.
[0068] In this embodiment, the frequency band fusion weights are adaptively corrected by the attention parameter, which can suppress the over-enhancement of high-interest areas on high-frequency components to preserve the original texture fidelity, while allowing low-interest areas to obtain a larger enhancement margin on low-frequency components. This achieves differentiated fusion with coordinated frequency band and spatial dimensions, thereby improving the accuracy and visual naturalness of pixel fusion.
[0069] In one embodiment, determining the target fusion parameters corresponding to the high-interest pixels in multiple frequency bands based on the basic fusion parameters and the second fusion weights further includes: Obtain the inter-frame difference information between the video frame and the previous video frame, and determine the scene state of the video frame based on the inter-frame difference information; In the case of a sudden change in scene state, the target fusion parameters corresponding to the high-interest pixels in multiple frequency bands are determined based on the basic fusion parameters and the second fusion weight. When the scene is continuous, the predicted fusion weights of the high-interest pixels are obtained in multiple frequency bands. The predicted fusion weights are predicted by using the historical fusion weights corresponding to historical video frames. Based on the basic fusion parameters, predicted fusion weights, and second fusion weights, the target fusion parameters corresponding to the high-interest pixels in multiple frequency bands are determined.
[0070] Inter-frame difference information refers to the change characteristics between images in adjacent video frames. Scene state indicates whether the scene being filmed has changed and the degree of change. Scene abrupt changes include, for example, switching between people (changes in objects) or switching between indoor and outdoor scenes (changes in background and lighting). Scene continuity indicates that the same scene is being filmed continuously, or that the changes in scene content are minor, such as slow movement of a moving object or a person waving. Scene abrupt changes can be understood as a lack of continuity in content between the current frame and the previous frame, resulting in a jump in the scene. Scene continuity can be understood as a strong correlation in content between the current frame and the previous frame, resulting in a smooth transition.
[0071] Predictive fusion weights are based on historical fusion weights corresponding to historical video frames. They are estimated fusion parameters for high-interest pixels in the current frame across multiple frequency bands, obtained through temporal prediction.
[0072] For example, during pixel fusion in overlapping image regions, due to the temporal correlation between video frames, the content of adjacent frames often exhibits strong continuity (such as target movement, slow camera panning, etc.). However, during video recording or playback, scene abrupt changes frequently occur due to factors such as camera switching, scene replacement, or sudden changes in lighting. Scene abrupt changes cause the pixel content between the current frame and the previous frame to lose its correlation. If the prediction fusion weights obtained based on historical frame information are still used in this situation, the prediction results will deviate significantly from the actual requirements of the current frame, leading to ghosting, motion blur, or significant distortion in the fused image. Therefore, it is also necessary to detect the scene state of the video frames to be stitched and determine the target fusion parameters based on the detected scene state.
[0073] Specifically, the inter-frame difference information between the video frame and the previous video frame is obtained, and the scene state of the video frame is determined based on the inter-frame difference information. The scene state detection is shown in formula (5).
[0074] (5) in, A flag value indicating the scene state; This represents the image captured at time t (the current frame); This represents the image captured at time t-1 (the previous frame); This represents a frame difference image, reflecting the magnitude of change for each pixel. This represents the L1 norm (Manhattan norm). Indicates the scene switching threshold; This indicates inter-frame difference information.
[0075] If the inter-frame difference exceeds the scene switching threshold, it indicates that the current frame is in a scene state of sudden change. When the scene state is in a sudden change, the content correlation between the current frame and the previous frame is weak, making it impossible to rely on historical information for predicting fusion weights. Based on the basic fusion parameters and the second fusion weight, the target fusion parameters corresponding to the high-interest pixels in the current frame in multiple frequency bands are determined.
[0076] If the inter-frame difference information is less than or equal to the scene switching threshold, it indicates that the current frame is in a scene-continuous state. When the scene state is scene-continuous, the content continuity between the current frame and the previous frame is high, and the fusion parameters of historical frames can be used as reference data. By obtaining the predicted fusion weights corresponding to high-interest pixels in multiple frequency bands, and based on the basic fusion parameters, predicted fusion weights, and second fusion weights, the target fusion parameters corresponding to the high-interest pixels in multiple frequency bands are determined.
[0077] Specifically, the target fusion parameters are shown in formulas (6) and (7).
[0078] (6) (7) in, This represents the target fusion parameters for k frequency bands; The basic fusion parameters representing any highly relevant pixel are the fusion mask; This represents an intermediate parameter used to calculate the target fusion parameters, which is related to scene changes; This represents the second fusion weight calculated based on the image acquired at time t (the current frame); This represents the prediction fusion weights at time t (current frame); This represents the weight of the calculated value in the current frame. The fusion mask w(x,y) ranges from [0,1]. w(x,y)=0 indicates that the pixel value at this position comes entirely from the image to be stitched, captured by the first camera (e.g., the front camera). w(x,y)=1 indicates that the pixel value at this position comes entirely from the image to be stitched, captured by the second camera (e.g., the rear camera). w(x,y)=0.5 indicates that the pixel value at this position comes from images captured by the front and rear cameras, each accounting for 50%.
[0079] After obtaining the target fusion parameters, the frequency band components of multiple frequency bands are fused using the target fusion parameters to obtain the multi-band fusion result of the high-interest pixels. The multi-band fusion is shown in formulas (8) and (9).
[0080] (8) (9) in, This represents the multi-band fusion result of any pixel of high interest; This represents the reconstruction weight of the k-th frequency band, which can usually be 1, or it can be obtained through calibration or training. This represents the frequency band component of the k-th frequency band of the high-interest pixel in the first shot's image to be stitched together; This represents the frequency band component of the k-th frequency band of the high-interest pixel in the image to be stitched from the second shot; This represents the template fusion parameters for the k-th frequency band.
[0081] In one embodiment, such as Figure 5 The diagram illustrates a multi-band fusion process. Specifically, taking a dual fisheye camera as an example, it includes a front camera and a rear camera. The input consists of panoramic image patches acquired by the front and rear cameras, i.e., the images to be stitched together.
[0082] In the image overlap area of the images to be stitched, after determining high-attention pixel points based on the attention parameters of each pixel point, the high-attention pixel points of the input image are decomposed into four frequency bands in the frequency domain through a separable Gaussian filter: an ultra-low frequency band, a low frequency band, a medium frequency band, and a high frequency band. Among them, the ultra-low frequency band contains brightness information of the image, the low frequency band contains tone information, the medium frequency band contains texture information, and the high frequency band contains edge information. Each frequency band characterizes the structural features of the image at different spatial frequencies.
[0083] For the four decomposed frequency bands, the adaptive fusion strength parameter corresponding to each frequency band is calculated separately (first fusion weight), and the calculation is shown in formula (2). Among them, represents the frequency band index, is the total number of frequency bands, and different values correspond to different fusion strengths, which are characterized as the adjustment strength of the basic fusion parameter. For example, corresponds to wide transition fusion, corresponds to smooth transition fusion, corresponds to balanced fusion, corresponds to sharp switching fusion. Then, the fusion strength parameter is used to calculate the target fusion parameter corresponding to each frequency band.
[0084] The target fusion parameters of each frequency band are used to fuse the frequency band components of the corresponding front and rear images in multiple frequency bands, so as to obtain the multi-frequency band fusion result corresponding to the high-attention pixel points, and then obtain the preliminary multi-frequency band fusion image. Then, in the image overlap area of the preliminary multi-frequency band fusion image, a corresponding fusion strategy is performed on the low-attention pixel points to obtain a panoramic stitched image.
[0085] In one embodiment, the pixel points in the image overlap area can be specifically divided into high-attention pixel points, medium-attention pixel points, and low-attention pixel points according to the attention parameter A(x,y).
[0086] Among them, pixel points with A(x,y)>0.7 are regarded as high-attention pixel points, and the first fusion strategy (multi-band fusion strategy) is used for fusion.
[0087] Pixel points with 0.3<A(x,y)<=0.7 are regarded as medium-attention pixel points, and the second fusion strategy is used for fusion, or a standard symmetric power function is used for fusion.
[0088] Pixel points with A(x,y)<=0.3 are regarded as low-attention pixel points, and the second fusion strategy is used for fusion, or fast linear fusion is used.
[0089] In this embodiment, the scene state of video frames is identified by inter-frame difference information. When the scene is continuous, historical fusion weight prediction is introduced to improve parameter consistency by utilizing temporal redundancy information. When the scene changes abruptly, the basic fusion parameters and attention correction weights are switched to ensure the fusion accuracy of independent frames, thereby achieving efficient and robust video fusion scene adaptation.
[0090] In one embodiment, the panoramic video stitching method further includes: Obtain the historical fusion weights of high-interest pixels in multiple frequency bands in the panoramic stitched image of at least two historical video frames, as well as the device motion information corresponding to the video frames; For any frequency band of a high-interest pixel, obtain the inter-frame weight difference between multiple historical fusion weights of the frequency band; Based on the inter-frame weight difference, device motion information, and preset motion coefficients, the prediction fusion weights of the predicted frequency bands are predicted, thereby obtaining the prediction fusion weights corresponding to multiple frequency bands.
[0091] Among these, device motion information refers to the motion information of the panoramic acquisition device. Historical fusion weight refers to the fusion weight actually used when fusing images from historical video frames.
[0092] For example, the historical fusion weights of high-interest pixels in multiple frequency bands are obtained in panoramic stitched images of at least two historical video frames, along with the device motion information corresponding to the video frames. The device motion information can be obtained through the motion sensor of the panoramic acquisition device, such as a gyroscope.
[0093] For any frequency band of a high-interest pixel, the difference between the historical fusion weights of adjacent historical video frames corresponding to that frequency band is calculated to obtain the inter-frame weight difference for that frequency band. Then, weight prediction is performed on the inter-frame weight difference, device motion information, and preset motion coefficients to obtain the preset fusion weight for that frequency band in the current frame.
[0094] Specifically, the weight change parameters of the frequency band in the current frame can be predicted based on the inter-frame weight difference, device motion information, and preset motion coefficients. Based on the historical fusion weights and weight change parameters, the predicted fusion weights of the frequency band in the current frame can be obtained, thereby obtaining the predicted fusion weights of multiple frequency bands in the current frame. The weight prediction is shown in formulas (10) and (11).
[0095] (10) (11) in, This represents the prediction fusion weights at time t (current frame); and This represents the historical fusion weights corresponding to time t-1 and time t-2; This represents the weight change parameter; 'a' represents the momentum coefficient, indicating the degree to which the historical trend of change continues; 'b' represents the motion influence coefficient; the preset motion coefficients include the momentum coefficient and the motion influence coefficient. This indicates device motion information at time t (current frame); This indicates the information about the device's movement. A function that converts parameters into correction values.
[0096] To improve the temporal stability of the parameters and avoid drastic changes in the fusion parameters due to single-frame noise or local anomalies, a Kalman filter mechanism is introduced to perform temporal smoothing on the predicted fusion weights. Specifically, the predicted fusion weights... The second fusion weight, calculated independently for the current frame, serves as the prior prediction value for the Kalman filter. As an observed measurement, through Kalman gain The two are then weighted and updated, and the updated prediction fusion weights are used. Second fusion weight Perform the calculations using formulas (6) and (7). Kalman gain The calculation is shown in formula (12).
[0097] (12) in, To predict covariance, For measuring noise. Specifically, for measuring noise. It is not a fixed constant, but is adaptively adjusted according to the motion state of the video frame, as shown in formula (13).
[0098] (13) in, Based on noise measurement This is the motion amplification factor. This represents the motion amplitude of the current frame. It is calculated independently for the current frame when the motion is intense. It is prone to short-term fluctuations due to large movements, at which point the noise measurement... Increase Kalman gain As the value decreases accordingly, the filter is more inclined to trust the predicted value. This suppresses jitter and smooths the output. When the scene is stable or the motion is gentle, the noise is measured. Smaller, Kalman gain As the value increases, the filter is more inclined to trust the calculated values of the current frame. This allows it to quickly follow real-time changes in the scene. And the final parameters of adjacent frames... It will not change drastically due to single-frame noise. The fusion weight distribution and boundary position are continuous in time, making the changes in brightness, color and splicing seams more stable during video playback.
[0099] In this embodiment, by acquiring the historical fusion weights of at least two historical video frames and calculating the inter-frame differences, and combining the device motion information for motion compensation, the fusion weight of the current frame can be accurately predicted under dynamic shooting conditions, avoiding weight misjudgment or lag caused by global motion, thereby ensuring the temporal consistency and fusion stability of panoramic stitched images in dynamic scenes.
[0100] In one embodiment, for the image overlap region of the images to be stitched in each video frame, the basic fusion parameters of the pixels within the image overlap region are determined, including: Perform boundary search within the overlapping region of the images to obtain the target stitching boundary; Based on the target stitching boundary, the basic fusion parameters of pixels within the overlapping area of the image are determined.
[0101] For example, a boundary search is performed within the overlapping region of the images to obtain template stitching boundaries that meet preset boundary conditions. The target stitching boundary is the boundary path within the overlapping region that minimizes stitching fusion traces. Then, within the overlapping region, the basic fusion parameters for each pixel are determined based on the distance between each pixel and the target stitching boundary. The basic fusion parameters, which smoothly vary from 0 to 1, can be generated using linear, cosine, or sigmoid forms (using an S-curve to generate a smooth mask).
[0102] In this embodiment, by searching for the target stitching boundary with the smallest visual stitching traces and providing spatially differentiated basic fusion parameters for pixels in the overlapping area, the difficulty of fusion is reduced from the source, and a reasonable initial benchmark is provided for subsequent adaptive fusion.
[0103] In one embodiment, boundary search is performed within the overlapping region of the images to obtain the target stitching boundary, including: In the overlapping area of the images, obtain multiple candidate stitching boundaries; The target splicing boundary is determined based on the spatial continuity features, temporal continuity features, and target object perception features corresponding to multiple candidate splicing boundaries.
[0104] For example, multiple candidate stitching boundaries are constructed within the overlapping region of the images, representing a continuous pixel path extending from one end of the overlapping region to the other. Visual features of each candidate stitching boundary are extracted, including spatial continuity features, temporal continuity features, and object perception features.
[0105] Among them, spatial continuity features represent the image differences on both sides of the candidate stitching boundary, including color difference information and gradient information. Temporal continuity features represent the positional change of the candidate stitching boundary relative to the target stitching boundary in the previous frame. Object perception features represent the perception of the candidate stitching boundary passing through an object.
[0106] Based on spatial continuity, temporal continuity, and target object perception characteristics, evaluation parameters are calculated for each candidate stitching boundary. The target stitching boundary is then determined from multiple candidate boundaries based on these evaluation parameters; for example, the candidate stitching boundary with the smallest evaluation parameter is selected as the target stitching boundary.
[0107] Specifically, the evaluation parameters are calculated as shown in formula (14), and the target splicing boundary is selected as shown in formula (15).
[0108] (14) (15) Where B represents the candidate splicing boundary; Indicates the evaluation parameters; Indicates color difference information; Gradient information representing candidate splicing boundaries; Indicates the continuous nature of time; It represents the perceived characteristics of the target object. , , , The weights of each visual feature can be obtained from empirical presets, camera calibration, offline training, or configuration files. Indicates the target stitching boundary of the previous frame; Indicates the target splicing boundary; This is the time smoothing constraint coefficient, used to control the allowable offset of the current frame's stitching boundary relative to the target stitching boundary of the previous frame. This indicates that the path within the parentheses with the minimum total cost is selected from all candidate boundary paths.
[0109] In this embodiment, the optimal boundary is selected from multiple candidate boundaries by combining spatial continuous features, temporal continuous features and target object perception features, so that the splicing boundary is spatially concealed, temporally stable and semantically reasonable, thus achieving the optimal splicing path selection under multi-dimensional constraints.
[0110] In one embodiment, spatial continuity features include color difference information and gradient information of the location of the candidate splicing boundary within the overlapping region; Temporal continuity features include the positional difference between the candidate stitching boundary and the target stitching boundary corresponding to the previous video frame; Target object perception features include the target object detection results at the location of the candidate splicing boundary within the overlapping area.
[0111] For example, spatial continuity features, including color difference information and gradient information at the location of the candidate stitching boundary within the overlapping region, are used to ensure that the stitching boundary passes through locations with small color differences between the preceding and following images, and avoids strong edges and object contours. Color difference information... The calculation is shown in formula (16), gradient information The calculation is shown in formula (17).
[0112] (16) (17) in, This represents the pixel information of the images to be stitched together from the first shot; This represents the pixel information of the image to be stitched from the second camera; This represents the image gradient of the first shot's image to be stitched together; This represents the image gradient of the second shot's image to be stitched together.
[0113] Temporal continuity features include the positional difference between the candidate stitching boundary and the target stitching boundary corresponding to the previous video frame, which is used to constrain the change between the current boundary and the boundary of the previous frame. The calculation of temporal continuity features is shown in formula (18).
[0114] (18) in, B represents the target stitching boundary of the previous frame. B represents the candidate stitching boundary of the current frame. This can be calculated based on the semantic mask output by the NPU or lightweight vision detection module. When the candidate stitching boundary crosses the region of an important object, this item will incur a penalty.
[0115] The target object perception features include the target object detection results at the location of the candidate splicing boundary within the overlapping area. These are determined by the semantic mask output by the NPU, ensuring that the splicing boundary avoids important semantic regions such as faces, vehicles, and human bodies.
[0116] In this embodiment, color and gradient constraints ensure the visual concealment of the splicing boundary, inter-frame position constraints ensure the playback stability of the boundary, and target object detection constraints ensure semantic integrity, thus achieving high-quality video splicing through three-dimensional joint optimization.
[0117] In one embodiment, the basic fusion parameters are determined based on the target stitching boundary within the image overlap region, and the target stitching boundary is obtained by performing a boundary search within the image overlap region. Panoramic video stitching methods also include: Based on the boundary position of the target stitching boundary, the stitching optimization region is determined within the panoramic stitching image, as well as the current image gradient of the image to be stitched in the stitching optimization region; The gradient of the current image is fused according to the preset gradient mixing coefficients to obtain the gradient of the target image; Based on the difference between the current image gradient and the target image gradient, gradient optimization is performed on the stitching optimization region to obtain the target panoramic stitched image.
[0118] The stitching optimization region is the local area of application for gradient inpainting within the panoramic stitched image. The current image gradient is the gradient of each pixel in the panoramic stitched image within the stitching optimization region, reflecting the color or brightness transition state of the current fusion result near the boundary. The target image gradient is obtained by weighting and fusing the gradients of at least two images to be stitched using preset gradient mixing coefficients, and serves as a reference benchmark for gradient optimization.
[0119] For example, the target stitching boundary is the boundary position with the least visual stitching artifacts obtained by performing a boundary search within the overlapping area of the images. After obtaining the panoramic stitched image, a preset width, such as 20 to 40 pixels, can be extended to both sides of the boundary position of the target stitching boundary to form a narrow band region. This narrow band region is used as the stitching optimization region, and gradient optimization is performed within the stitching optimization region to eliminate any residual visual stitching artifacts, such as slight discontinuities in brightness, color, or texture, that may still exist on both sides of the boundary.
[0120] Gradient optimization is performed within the stitching optimization area of the panoramic stitched image, and no processing is performed outside the stitching optimization area. The execution logic is as shown in formula (19), which means that pixels that are less than the target stitching boundary are marked as 1 (belonging to the stitching optimization area), and the remaining pixels are marked as 0 (not participating in optimization).
[0121] (19) in, Represents a narrowband mask at the boundary, at the pixel level. The value at this location is 1, which indicates that the pixel is within the stitching optimization area, and 0, which indicates that it is outside the stitching optimization area. Indicates the boundary of the target splicing. Indicates the preset radius.
[0122] Calculate the current image gradient of each image to be stitched within the stitching optimization region. According to the preset gradient mixing coefficient, perform gradient fusion on the image gradients corresponding to at least two images to be stitched to obtain the target image gradient. The calculation of the target image gradient is shown in formula (20).
[0123] (20) in, Represents the gradient of the target image; This represents the gradient of the first shot's image to be stitched within the stitching optimization region; This represents the gradient of the second shot's image to be stitched within the stitching optimization region; This represents the preset gradient blending coefficient, which can be determined by the distance of the pixel from the target stitching boundary or the blending weight.
[0124] After determining the gradient of the target image, linear interpolation is performed on the gradient optimization region according to the difference between the current image gradient and the target image gradient, based on a preset optimization strength, to obtain the optimized image gradient within the gradient optimization region. Through Poisson reconstruction or Jacobi iteration, pixel values are iteratively inferred from the optimized image gradient to obtain the target panoramic stitched image. Then, based on the target panoramic stitched images corresponding to multiple video frames, a gradient-optimized panoramic video is generated.
[0125] The gradient optimization described above is shown in Equation (21).
[0126] (twenty one) in, This represents the image gradient after optimization during the iterative optimization process; This represents the current image gradient; Indicates the preset gradient mixing coefficient; This represents the boundary narrowband mask in the stitching optimization region ( The value is 1 within the mask region and 0 outside the stitching optimization region. Within the stitching optimization region, the current gradient is pulled closer to the target gradient direction, and the correction magnitude is changed from... control.
[0127] Jacobi iterative calculation is shown in formula (22).
[0128] (twenty two) in, This represents the result of the (n+1)th iteration; This represents the pixel value of the pixel to the left of the current pixel in the nth iteration result; This represents the pixel value of the pixel adjacent to the right of the current pixel in the nth iteration result; This represents the pixel value of the pixel adjacent to the current pixel in the nth iteration result; This represents the pixel value of the pixel adjacent to the current pixel in the nth iteration result; This represents the target Laplace value.
[0129] In real-time implementation, 5 to 10 iterations can be performed consistently. Offline evaluation can determine convergence by whether the maximum difference between two adjacent iterations is less than a threshold. Since this step is only performed within the narrow boundary band, and the initial value is already the fused image, the number of iterations is much less than that of full-image Poisson fusion.
[0130] In this embodiment, by performing gradient domain orientation correction in a narrow band region near the optimal stitching boundary, the brightness and color discontinuities of the boundary residue are eliminated with minimal computational overhead, significantly improving the local fusion smoothness and overall visual consistency of the panoramic video.
[0131] In one embodiment, the panoramic video stitching method further includes: For each video frame, the image to be stitched is geometrically mapped to a preset panoramic coordinate system; Determine the overlapping area of the images in the preset panoramic coordinate system, and the mapped pixel coordinates within the overlapping area of the images; Based on the mapped pixel coordinates, obtain the pixel information corresponding to the pixel points located in the overlapping area of the images to be stitched.
[0132] The preset panoramic coordinate system is used to define the spatial reference of the panoramic stitched image, so that images captured by different lenses can be spatially aligned under the same reference frame.
[0133] For example, in the process of panoramic video stitching, for at least two images to be stitched in any video frame, such as two video frame images obtained synchronously by two adjacent lenses in a multi-view panoramic acquisition device, preprocessing such as ROI cropping and color space conversion is performed to obtain the processed images to be stitched.
[0134] Then, based on the pre-calculated geometric mapping table, at least two images to be stitched are geometrically mapped to a preset panoramic coordinate system, transforming the pixels in each image from their original coordinate system to their corresponding positions in the panoramic coordinate system. Based on the mapping range of the two images in the preset panoramic coordinate system, the field of view coverage area is calculated as the image overlap area, and the mapped pixel coordinates within this overlap area are obtained. Mapped pixel coordinates refer to the positions of pixels in the images to be stitched in the panoramic coordinate system after geometric mapping, used to identify the pixel correspondence of the same panoramic spatial location between different images to be stitched.
[0135] Based on the coordinates of each mapped pixel within the overlapping region of the images, determine the pixel point of the image to be stitched located within the overlapping region of the original image coordinate system, so as to obtain the pixel information of the corresponding pixel point in the image to be stitched.
[0136] In this embodiment, after mapping each image to be stitched to a unified panoramic coordinate system, the spatial correspondence between different images is established through the mapped pixel coordinates in the overlapping area, and the effective pixel points in each image that participate in the subsequent fusion processing are determined accordingly.
[0137] In one embodiment, in traditional solutions, the GPU (Graphics Processing Unit) and NPU (Neural Processing Unit) each use independent memory spaces. Data needs to be copied multiple times between GPU memory, CPU memory, and NPU memory, resulting in significant memory bandwidth consumption and processing latency. To address this, this application utilizes the ION or DMA-BUF shared memory allocation mechanism of mobile operating systems (such as Android or Linux) to allocate a shared buffer in physical memory that can be accessed by multiple hardware modules. The access handles of this buffer are exported to the image acquisition unit (Camera), GPU, and NPU, respectively. Real-time panoramic video stitching is performed using data interaction between the GPU and NPU to output panoramic video. This avoids the large-block pixel data copying from GPU memory to CPU memory and then to NPU memory, as is common in traditional solutions.
[0138] Specifically, such as Figure 6 The diagram illustrates a process for panoramic video stitching based on GPU-NPU collaborative execution. Specifically, taking a dual-fisheye camera as an example, the dual-fisheye camera sensors simultaneously acquire two video images (images to be stitched), serving as the raw input for panoramic video stitching. The image data is stored and managed by the ION (ION memory allocator) / DMA-BUF (DMA buffer shared) unified memory management unit within the mobile SoC chip. This unified memory is a shared buffer within physical memory, accessible to multiple hardware modules such as the GPU and NPU via handles.
[0139] On the GPU side, the GPU reads input texture data from unified memory and performs computationally intensive tasks using its massively parallel computing cores. Specifically, the GPU performs geometric mapping through the Fragment Shader, transforming the images to be stitched from the original coordinate system to a preset panoramic coordinate system, resulting in a geometrically corrected panoramic image to be fused in the preset panoramic coordinate system, including the overlapping regions of the images. Furthermore, the GPU is also responsible for handling the energy cost within the overlapping regions (…). The GPU performs calculations and color rendering. Because the GPU has thousands of computing cores, it can simultaneously handle coordinate transformations and color calculations for all pixels in an image, achieving high-throughput parallel processing.
[0140] On the NPU side, the NPU reads image data from the same unified memory and executes AI inference tasks. Specifically, the NPU runs deep learning models to perform semantic segmentation (such as target recognition of faces, vehicles, pedestrians, etc.) and scene type recognition, outputs semantic segmentation results and scene transition detection signals, and writes them back to the unified memory.
[0141] After completing the geometric mapping of the current frame, the GPU reads the semantic segmentation results output by the NPU from unified memory and uses them to calculate the semantic-aware energy term. The system reads scene transition detection signals to determine whether to perform fusion parameter prediction, such as predicting fusion weights. Simultaneously, based on the scene state and the parameter prediction results output by the NPU, the GPU performs frequency domain separation fusion and gradient field repair of the stitching optimization region, ultimately generating a panoramic image, which is then output to the panoramic video encoder for encoding, storage, or transmission.
[0142] In this embodiment, the GPU and NPU interact with each other based on the same physical memory, avoiding data copying across memory regions in traditional solutions, and realizing parallel and efficient collaboration between image processing and AI inference in panoramic video stitching.
[0143] In one embodiment, such as Figure 7 As shown, a schematic diagram of the overall structure of a panoramic video stitching system is provided, illustrating the processing flow from dual fisheye video input to panoramic video output, including four stages: CPU preprocessing, GPU rendering, asynchronous readback, and panoramic video output.
[0144] CPU Preprocessing: The dual fisheye video input consists of two synchronously acquired raw video streams. The CPU first performs frame segmentation, dividing the dual fisheye image into two independent image frames. Then, it extracts the Region of Interest (ROI) from the segmented images and uses circular cropping to remove invalid black borders captured by the fisheye lens. Next, it performs color space conversion (BGR→RGB), converting the image from BGR color format to RGB format to meet the standard input requirements for GPU rendering.
[0145] GPU Rendering: The GPU rendering stage is implemented based on the OpenGL ES 3.0 graphics programming interface. Preprocessed image data is transferred to the GPU, which uses texture mapping (TIF mapping sampling) to map the original image pixels to their corresponding positions in the panoramic coordinate system. Subsequently, the GPU performs effective region detection to determine the overlapping area between adjacent images. Within the overlapping area, the GPU performs differentiated fusion (including symmetric power function fusion) of each frequency band component according to a frequency domain decomposition and multi-band adaptive fusion strategy, generating a preliminary panoramic fused image.
[0146] Asynchronous readback: The fused panoramic image data is stored in the GPU memory and needs to be transferred to the CPU or encoder via readback operations. This solution uses a dual PBO (Pixel Buffer Object) mechanism to achieve asynchronous readback. The dual PBO mechanism allows GPU rendering, pixel data transfer, and CPU reading to overlap in time, effectively reducing readback latency.
[0147] Panoramic video output: After the CPU acquires panoramic image data asynchronously via PBO, it performs necessary post-processing (such as compression encoding) and finally outputs a panoramic video stream. The final panoramic image can be output in different formats depending on the application scenario. This adaptability comes from the pre-computed mapping table and the configurability of the GPU rendering target. For example, consumer-grade 360° video or live streaming: outputs equidistant cylindrical projection panoramic frames; VR headsets: outputs binocular panoramic frames arranged horizontally or vertically; vehicle surround view: outputs bird's-eye view or multi-view stitching results; security monitoring: outputs panoramic images and virtual PTZ cropped images. The core fusion algorithm does not need to be rewritten for each output format; only the geometric mapping table, output resolution, and rendering target configuration need to be changed.
[0148] In this embodiment, a three-stage pipeline architecture consisting of CPU preprocessing, GPU rendering, and dual PBO asynchronous readback is used to achieve parallel processing of panoramic video from acquisition to output. This significantly reduces end-to-end latency while ensuring fusion quality, thus meeting the real-time panoramic stitching requirements of mobile devices.
[0149] In one embodiment, such as Figure 8 The diagram shows the timing of the asynchronous readback. In traditional solutions, after the GPU completes rendering, the CPU must wait for all pixel data to be transferred before it can perform subsequent processing, resulting in CPU idle time. This application adopts a dual PBO (Pixel Buffer Object) mechanism, which uses two pixel buffers (PBO0 and PBO1) to work alternately, achieving pipelined parallelism of the three stages: GPU rendering, asynchronous PBO transfer, and CPU reading.
[0150] The specific timing sequence is as follows: At time T0 (pipeline startup phase): The GPU begins rendering the Nth frame of the panoramic image (rendering frame N). At this time, both PBO0 and PBO1 are idle, and there is no previous frame available for the CPU to read. The pipeline is in the startup phase.
[0151] At time T1: After the GPU completes rendering of frame N, it writes the rendering result to PBO0 via asynchronous DMA transfer (frame N is asynchronously written to PBO0). This transfer operation is initiated directly by the GPU and does not consume CPU resources. At the same time, the GPU can immediately start rendering the next frame (rendering frame N+1) without waiting for the PBO transfer to complete.
[0152] At time T2: After the Nth frame data transmission in PBO0 is completed, the CPU begins to read the Nth frame data from PBO0 (mapped reading of frame N) and performs encoding or subsequent processing. At the same time, the GPU completes the rendering of the N+1th frame, asynchronously writes the result to PBO1 (frame N+1 is asynchronously written to PBO1), and continues to render subsequent frames (rendering frame N+2).
[0153] At time T3 and beyond (stable pipeline phase): GPU rendering, asynchronous PBO transfer, and CPU reading are executed in complete overlap. The GPU continuously renders new frames, PBO0 and PBO1 alternately transfer rendering results, and the CPU continuously reads data from the ready PBOs for processing. As shown in the timing diagram: frame N+2 is asynchronously written to PBO0 (reusing PBO0), frame N+3 is asynchronously written to PBO1 (reusing PBO1), and the CPU accordingly alternately reads data from PBO0 and PBO1.
[0154] In this embodiment, through the dual PBO asynchronous readback mechanism, GPU rendering, pixel data transmission and CPU reading form a pipeline in parallel, so that the CPU can continuously process panoramic frame data without blocking and waiting for pixel readback, which effectively reduces the end-to-end latency of the panoramic video stitching system and improves the overall throughput.
[0155] Secondly, this embodiment provides a panoramic video stitching device. Figure 9 This is a schematic diagram of a panoramic video stitching device according to an embodiment of this application, as shown below. Figure 9 As shown, the panoramic video stitching device 900 includes: a data acquisition module 901, a parameter extraction module 902, and an image fusion module 903, wherein: Data acquisition module 901 is used to acquire the images to be stitched corresponding to multiple video frames; The parameter extraction module 902 is used to determine the attention parameters and basic fusion parameters of the pixels in the image overlap area of the image to be stitched for each video frame. The image fusion module 903 is used to perform pixel-level fusion of the pixel information of each pixel in the image to be stitched based on attention parameters and basic fusion parameters, to obtain a panoramic stitched image corresponding to each video frame. In one embodiment, the image fusion module 903 is specifically used to divide the pixels in the overlapping area of the image into high-attention pixels and low-attention pixels according to the comparison result of attention parameters and preset thresholds; a first fusion strategy is used for fusion of high-attention pixels, and a second fusion strategy is used for fusion of low-attention pixels, wherein the computational complexity of the second fusion strategy is lower than that of the first fusion strategy.
[0156] In one embodiment, the image fusion module 903 is specifically used to perform multi-band fusion on high-interest pixels based on attention parameters and basic fusion parameters; and to perform single-band fusion on low-interest pixels based on basic fusion parameters.
[0157] In one embodiment, the image fusion module 903 is specifically used to determine the frequency band components of each pixel information of the high-interest pixel in multiple frequency bands based on the pixel information of the high-interest pixel in the image to be stitched; determine the target fusion parameters corresponding to the high-interest pixel in multiple frequency bands based on the attention parameters and basic fusion parameters of the high-interest pixel; and fuse the frequency band components corresponding to the high-interest pixel in multiple frequency bands using the target fusion parameters.
[0158] In one embodiment, the image fusion module 903 is specifically used to obtain first fusion weights corresponding to multiple frequency bands respectively; to correct the first fusion weights based on the attention parameters of high-attention pixels to obtain second fusion weights corresponding to multiple frequency bands respectively; and to determine the target fusion parameters corresponding to high-attention pixels in multiple frequency bands based on the basic fusion parameters and the second fusion weights.
[0159] In one embodiment, the image fusion module 903 is specifically used to acquire inter-frame difference information between a video frame and the previous video frame, determine the scene state of the video frame based on the inter-frame difference information; when the scene state is a sudden change, determine the target fusion parameters corresponding to the high-interest pixels in multiple frequency bands based on the basic fusion parameters and the second fusion weight; when the scene state is continuous, acquire the predicted fusion weights corresponding to the high-interest pixels in multiple frequency bands, the predicted fusion weights being predicted using the historical fusion weights corresponding to historical video frames; and determine the target fusion parameters corresponding to the high-interest pixels in multiple frequency bands based on the basic fusion parameters, the predicted fusion weights, and the second fusion weight.
[0160] In one embodiment, the panoramic video stitching device 900 is specifically used to acquire, in the panoramic stitched image of at least two historical video frames, the historical fusion weights corresponding to high-interest pixels in multiple frequency bands, and the device motion information corresponding to the video frames; for any frequency band of the high-interest pixels, acquire the inter-frame weight difference between the multiple historical fusion weights of the frequency band; based on the inter-frame weight difference, the device motion information, and the preset motion coefficient, predict the predicted fusion weight of the frequency band, thereby obtaining the predicted fusion weights corresponding to the multiple frequency bands respectively.
[0161] In one embodiment, the parameter extraction module 902 is specifically used to perform boundary search within the image overlap region to obtain the target stitching boundary; and based on the target stitching boundary, to determine the basic fusion parameters of the pixels within the image overlap region.
[0162] In one embodiment, the parameter extraction module 902 is specifically used to obtain multiple candidate stitching boundaries in the overlapping area of the image; and to determine the target stitching boundary based on the spatial continuity features, temporal continuity features and target object perception features corresponding to the multiple candidate stitching boundaries respectively.
[0163] In one embodiment, the spatial continuity features include color difference information and gradient information of the candidate stitching boundary's location within the overlapping region; the temporal continuity features include the positional difference between the candidate stitching boundary and the target stitching boundary corresponding to the previous video frame; and the target object perception features include the target object detection results at the location of the candidate stitching boundary within the overlapping region.
[0164] In one embodiment, the basic fusion parameters are determined based on the target stitching boundary within the image overlap region, and the target stitching boundary is obtained by performing a boundary search within the image overlap region. The panoramic video stitching device 900 is specifically used to determine the stitching optimization area within the panoramic stitching image based on the boundary position of the target stitching boundary, and the current image gradient of the image to be stitched in the stitching optimization area; perform gradient fusion on the current image gradient according to a preset gradient mixing coefficient to obtain the target image gradient; and perform gradient optimization on the stitching optimization area based on the difference between the current image gradient and the target image gradient to obtain the target panoramic stitching image.
[0165] In one embodiment, the panoramic video stitching device 900 is specifically used to geometrically map the image to be stitched to a preset panoramic coordinate system for each video frame; determine the image overlap region and the mapped pixel coordinates located within the image overlap region in the preset panoramic coordinate system; and obtain pixel information corresponding to the pixels located within the image overlap region in the image to be stitched based on the mapped pixel coordinates.
[0166] Thirdly, this embodiment also provides a panoramic video stitching system, such as... Figure 10 The architecture diagram of the panoramic video stitching system shown includes: a data acquisition module, a panoramic video stitching module, and a video output module, wherein: The data acquisition module includes a panoramic acquisition device, used to acquire the image to be stitched from each video frame in real time; A panoramic video stitching module, connected to a data acquisition module, is used to implement the panoramic video stitching method as described in any of the first aspects; The video output module, connected to the panoramic video stitching module, is used to output panoramic video based on the panoramic stitched image of each video frame.
[0167] Fourthly, an electronic device is provided, including a processor and a memory coupled to the processor, the memory being used to store program code including instructions, the processor reading instructions from the memory to cause the electronic device to perform a method as described in any of the above aspects and any of the designs therein.
[0168] Fifthly, the present application provides a computer-readable storage medium including computer instructions that, when executed on a device, cause the device to perform any of the possible designs described above.
[0169] Sixthly, the present application provides a computer program product that, when run on a device, causes the device to execute the method in any possible design of any of the above aspects.
[0170] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0171] The panoramic video stitching method, system, electronic device, and storage medium provided in the embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A panoramic video stitching method, characterized in that, include: Obtain the images to be stitched together corresponding to multiple video frames; For the image overlap region of the images to be stitched in each video frame, determine the attention parameters and basic fusion parameters of the pixels within the image overlap region; Based on the attention parameters and the basic fusion parameters, pixel-level fusion is performed on the pixel information of each pixel in the image to be stitched to obtain a panoramic stitched image corresponding to each video frame.
2. The method of claim 1, wherein, The step of performing pixel-level fusion of the pixel information of each pixel in the image to be stitched, based on the attention parameters and the basic fusion parameters, includes: Based on the comparison result between the attention parameter and the preset threshold, the pixels in the overlapping area of the image are divided into high attention pixels and low attention pixels. A first fusion strategy is used to fuse the high-interest pixels, and a second fusion strategy is used to fuse the low-interest pixels. The computational complexity of the second fusion strategy is lower than that of the first fusion strategy.
3. The method of claim 2, wherein, The process of using a first fusion strategy for the high-interest pixels and a second fusion strategy for the low-interest pixels includes: For the high-attention pixels, multi-band fusion is performed on the high-attention pixels based on the attention parameters and the basic fusion parameters; For the low-interest pixels, single-band fusion is performed on the low-interest pixels based on the basic fusion parameters.
4. The method of claim 3, wherein, The step of performing multi-band fusion on the high-attention pixels based on the attention parameters and the basic fusion parameters includes: Based on the pixel information of the high-interest pixels in the image to be stitched, determine the frequency band components of each pixel information of the high-interest pixels in multiple frequency bands; Based on the attention parameters and basic fusion parameters of the high-attention pixels, the target fusion parameters corresponding to the high-attention pixels in multiple frequency bands are determined respectively; Using the target fusion parameters, the frequency band components corresponding to the high-interest pixels in multiple frequency bands are fused.
5. The method of claim 4, wherein, The step of determining the target fusion parameters corresponding to the high-attention pixels in multiple frequency bands based on the attention parameters and basic fusion parameters of the high-attention pixels includes: Obtain the first fusion weights corresponding to the multiple frequency bands respectively; The first fusion weight is corrected based on the attention parameters of the high-attention pixels to obtain the second fusion weights corresponding to the multiple frequency bands respectively; Based on the basic fusion parameters and the second fusion weight, the target fusion parameters corresponding to the high-interest pixels in the multiple frequency bands are determined respectively.
6. The method of claim 5, wherein, The step of determining the target fusion parameters corresponding to the high-interest pixel in multiple frequency bands based on the basic fusion parameters and the second fusion weight further includes: Obtain the inter-frame difference information between the video frame and the previous video frame, and determine the scene state of the video frame based on the inter-frame difference information; In the case of a sudden change in the scene state, the target fusion parameters corresponding to the high-interest pixels in multiple frequency bands are determined based on the basic fusion parameters and the second fusion weight. When the scene state is continuous, the prediction fusion weights corresponding to the high-attention pixels in multiple frequency bands are obtained. The prediction fusion weights are predicted using the historical fusion weights corresponding to historical video frames. Based on the basic fusion parameters, the predicted fusion weights, and the second fusion weights, the target fusion parameters corresponding to the high-interest pixels in the multiple frequency bands are determined.
7. The method of claim 6, wherein, The method further includes: Obtain the historical fusion weights of the high-attention pixels in multiple frequency bands in the panoramic stitched image of at least two historical video frames, as well as the device motion information corresponding to the video frames; For any frequency band of the high-interest pixel, obtain the inter-frame weight difference between multiple historical fusion weights of the frequency band; Based on the inter-frame weight difference, the device motion information, and the preset motion coefficient, the prediction fusion weight of the frequency band is predicted, thereby obtaining the prediction fusion weights corresponding to the multiple frequency bands respectively.
8. The method of claim 1, wherein, For the image overlap region of the images to be stitched in each video frame, determine the basic fusion parameters of the pixels within the image overlap region, including: Boundary search is performed within the overlapping area of the images to obtain the target stitching boundary; Based on the target stitching boundary, the basic fusion parameters of the pixels within the overlapping area of the image are determined.
9. The method of claim 8, wherein, The step of performing boundary search within the overlapping region of the images to obtain the target stitching boundary includes: In the overlapping area of the images, multiple candidate stitching boundaries are obtained; The target splicing boundary is determined based on the spatial continuity features, temporal continuity features, and target object perception features corresponding to the multiple candidate splicing boundaries.
10. The method of claim 9, wherein, The spatial continuity feature includes color difference information and gradient information of the candidate splicing boundary in the overlapping area; The temporal continuity feature includes the positional difference between the candidate splicing boundary and the target splicing boundary corresponding to the previous video frame; The target object perception features include the target object detection results at the location of the candidate splicing boundary within the overlapping area.
11. The method of claim 1, wherein, The basic fusion parameters are determined based on the target stitching boundary within the overlapping area of the images, and the target stitching boundary is the boundary position obtained by performing a boundary search within the overlapping area of the images. The method further includes: Based on the boundary position of the target stitching boundary, a stitching optimization region is determined within the panoramic stitching image, and the current image gradient of the image to be stitched is determined within the stitching optimization region; The gradient of the current image is fused according to a preset gradient mixing coefficient to obtain the gradient of the target image; Based on the difference between the current image gradient and the target image gradient, gradient optimization is performed on the stitching optimization region to obtain the target panoramic stitched image.
12. The method of claim 1, wherein, The method further includes: For each video frame containing an image to be stitched, the image to be stitched is geometrically mapped to a preset panoramic coordinate system; The image overlap region and the mapped pixel coordinates located within the image overlap region are determined in the preset panoramic coordinate system. Based on the mapped pixel coordinates, obtain the pixel information corresponding to the pixel points located in the overlapping area of the image to be stitched.
13. A panoramic video stitching system characterized by, include: The data acquisition module includes a panoramic acquisition device, used to acquire the image to be stitched from each video frame in real time; A panoramic video stitching module, connected to the data acquisition module, is used to implement the panoramic video stitching method as described in any one of claims 1 to 12; The video output module is connected to the panoramic video stitching module and is used to output panoramic video based on the panoramic stitched image of each video frame.
14. An electronic device, comprising: The electronic device includes a processor and a memory, the memory storing a computer program configured to be executed by the processor to implement the steps of the method according to any one of claims 1 to 12.
15. A computer storage medium, comprising, The computer storage medium stores a computer program configured to be executed by a processor to implement the method of any one of claims 1 to 12.
