End-to-end panoramic image stitching method, electronic equipment and storage medium
Through the end-to-end panoramic image stitching method, camera data and weight data are directly input into the stitching model, which solves the problems of complex network and high computing power consumption in the existing technology, and realizes efficient and real-time panoramic image stitching, which is suitable for the field of autonomous driving. embedded platform.
Patent Information
- Application Number
- CN202410739211.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-03
AI Technical Summary
Existing panoramic image stitching technology has problems such as complex network structure, excessive computing power consumption, and low real-time performance. Especially in the field of autonomous driving, fisheye camera distortion and lack of depth information lead to distortion, misalignment, and ghosting problems in spliced images. , and deep learning methods are complex and time-consuming.
Using an end-to-end panoramic image stitching method, we obtain images from multiple cameras, process the camera data and weight data, and directly input them into the trained panoramic image stitching model to generate a panoramic image map, simplifying the process and reducing intermediate conversions and brute force. Matching uses fewer model parameters and GPU computing power to improve real-time performance.
It achieves a simplified panoramic image stitching process, reduces computing power consumption, and improves real-time performance. It is suitable for use on embedded platforms and is suitable for real-time stitching requirements in the field of autonomous driving.
Smart Images

Figure CN118587086A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automobile panoramic image stitching, and in particular to an end-to-end panoramic image stitching method, electronic equipment and storage medium. Background Art
[0002] In the field of autonomous driving, panoramic imaging technology uses multiple camera sensors on the car to collect image information around the vehicle, and then combines these image information through image stitching technology to form a 360-degree panoramic image. The main difficulties of this technology are: (1) Due to the fisheye camera, the stitched image has distortion and stretching problems; (2) Due to the lack of depth information, the stitching area will have problems such as misalignment and ghosting.
[0003] The Chinese patent "A surround view stitching method based on depth estimation" (publication number: CN115861063A) proposes a surround view stitching method based on depth estimation, which mainly estimates the depth of the bird's-eye view of each camera and then matches the overlapping area. This method can solve the problem of distortion and poor stitching effect in the overlapping area of adjacent cameras to a certain extent. However, in actual scenes, the internal parameters of the fisheye camera are not completely accurate, the bird's-eye view image itself cannot completely eliminate distortion, and there will be slight deviations in feature extraction of the bird's-eye view, which will affect the robustness of the network to a certain extent; at the same time, neural network reasoning is required for each pair of images, which consumes more computing power on the autonomous driving domain controller, and finally brute force matching is required to obtain accurate matching points, which will reduce real-time performance.
[0004] The Chinese patent "Surround view stitching method and related equipment based on vehicle vision sensor" (publication number: CN115731104A) proposes a surround view stitching method and related equipment based on vehicle vision sensor, which mainly outputs multiple overhead feature maps through a deep learning feature model, and stitches multiple overhead images into a surround view image. Its advantage is that deep learning has strong feature extraction capabilities and is applicable to more scenarios; this method requires a CNN convolutional neural network and a Transformer self-attention model. The network is complex and has too many parameters, which requires more computing resources accordingly, and also increases performance time consumption.
[0005] In summary, existing panoramic image stitching technologies have introduced deep learning to solve the problems of misalignment and ghosting in overlapping areas. However, these technologies are not only complex in their own algorithms, but also require some additional conversion processes, making the entire process cumbersome and redundant. They also involve more computing resources and have low real-time performance. Summary of the invention
[0006] In view of the above defects of the prior art, the present invention provides an end-to-end panoramic image stitching method, electronic device and storage medium to solve the technical problems of complex network structure, excessive computing power consumption and low real-time performance.
[0007] To achieve the above-mentioned purpose and other related purposes, the present invention provides an end-to-end panoramic image stitching method, comprising the following steps: obtaining pictures taken by multiple cameras of a vehicle; processing multiple pictures to obtain camera data; inputting the camera data, preset parameter data and weight data into a trained panoramic image stitching model to generate a panoramic image map, wherein the parameter data is the coordinate mapping relationship between the picture and the panoramic image map, and the weight data is the weight of the picture in the panoramic image map.
[0008] In one embodiment of the present invention, the preset parameter data is obtained through the following steps: based on the internal parameters and external parameters of the multiple cameras, the inverse mapping relationship from world coordinates to camera coordinates is obtained; based on the inverse mapping relationship, the correspondence between the world coordinates and the pixel positions of the pictures taken by the multiple cameras is calculated; based on the correspondence relationship, the parameter data is obtained.
[0009] In one embodiment of the present invention, the step of calculating the correspondence between world coordinates and pixel positions of pictures taken by multiple cameras based on the inverse mapping relationship includes: for each world coordinate within the shooting range of the camera, calculating the first correspondence between the world coordinates and the pixel positions of the pictures taken by the camera based on the inverse mapping relationship; for world coordinates beyond the shooting range of the camera, the corresponding pixel positions are marked as (0,0) to obtain a second correspondence between the pixel positions of the pictures taken by the camera; the first correspondence and the second correspondence are combined to obtain a mapping table matrix to represent the correspondence between world coordinates and pixel positions of pictures taken by multiple cameras; wherein the mapping table matrix corresponds to the camera.
[0010] In an embodiment of the present invention, the step of obtaining the parameter data according to the corresponding relationship includes: combining a plurality of the mapping table matrices and normalizing them to obtain the parameter data.
[0011] In one embodiment of the present invention, the preset weight data is obtained through the following steps: dividing the panoramic image to be generated into multiple areas according to the positional relationship between the multiple cameras; and obtaining the weight data according to the relationship between the areas and the shooting range of the cameras.
[0012] In one embodiment of the present invention, the step of dividing the panoramic image to be generated into multiple areas according to the positional relationship of the multiple cameras includes: determining the image size of the panoramic image to be generated according to the positional relationship of the multiple cameras and the vehicle; and dividing the panoramic image to be generated into multiple areas according to the image size and the positional relationship of the multiple cameras and the vehicle.
[0013] In one embodiment of the present invention, the step of dividing the panoramic image to be generated into multiple areas according to the image size, according to the positional relationship of the multiple cameras and the vehicle includes: according to the image size, setting the area corresponding to the vehicle in the panoramic image to be generated as a vehicle area; according to the shooting ranges of the multiple cameras, setting the area in the panoramic image to be generated that is covered by the shooting range of only one camera as a non-overlapping area; according to the shooting ranges of the multiple cameras, setting the area in the panoramic image to be generated that is covered by the shooting ranges of at least two cameras as an overlapping area.
[0014] In one embodiment of the present invention, the step of obtaining the weight data based on the relationship between the area and the shooting range of the camera includes: when the area is a vehicle area, the weight data of all pixels located in the vehicle area are 0; when the area is a non-overlapping area, the weight data of all pixels located in the non-overlapping area are related to the camera corresponding to the area, and the values are equal; when the area is an overlapping area, the weight data of all pixels located in the overlapping area are related to the specific positions of the pixels and the contributions of multiple cameras corresponding to the area.
[0015] To achieve the above-mentioned purpose and other related purposes, the present invention also provides an electronic device, including a processor, a memory and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute a computer program stored in the memory to implement a method provided in any one of the above embodiments.
[0016] To achieve the above-mentioned object and other related objects, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is used to enable a computer to execute the method provided in any one of the above-mentioned embodiments.
[0017] Beneficial effects of the present invention: The present invention proposes an end-to-end panoramic image stitching method, electronic device and storage medium. The method adopts an end-to-end approach, does not require intermediate conversion changes, and does not require brute force matching. It directly inputs camera data, parameter data and weight data into the stitching model to obtain a panoramic stitching view. The model in this method has fewer parameters and less inference time, does not require a lot of GPU computing power, has high real-time performance, and is very suitable for embedded platforms. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 A flowchart provided for an embodiment of the present invention;
[0020] Figure 2 A flow chart of camera data acquisition provided by an embodiment of the present invention;
[0021] Figure 3 A schematic diagram of camera data provided by an embodiment of the present invention;
[0022] Figure 4 A parameter data acquisition flow chart provided in one embodiment of the present invention;
[0023] Figure 5 A flowchart for calculating the correspondence between pixel positions provided by an embodiment of the present invention;
[0024] Figure 6 A schematic diagram of parameter data corresponding to front and rear cameras provided in one embodiment of the present invention;
[0025] Figure 7 A schematic diagram of parameter data corresponding to left and right cameras provided by an embodiment of the present invention;
[0026] Figure 8 A weight data acquisition flow chart provided in one embodiment of the present invention;
[0027] Fig. 9 A flowchart of multiple area divisions provided by an embodiment of the present invention;
[0028] Fig.10 A specific area division flow chart provided for an embodiment of the present invention;
[0029] Fig.11A weight data calculation flow chart provided in one embodiment of the present invention;
[0030] Fig.12 A schematic diagram of weight data provided by an embodiment of the present invention;
[0031] Fig.13 A schematic diagram of a panoramic image stitching model provided by an embodiment of the present invention;
[0032] Fig.14 A schematic diagram of a panoramic image stitching model training process provided by an embodiment of the present invention;
[0033] Fig.15 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0034] The following describes the embodiments of the present invention through specific specific embodiments, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. It should be noted that the following embodiments and the features in the embodiments can be combined with each other without conflict. In addition to the specific methods, equipment, and materials used in the embodiments, according to the technical personnel in this technical field's grasp of the prior art and the records of the present invention, any methods, equipment, and materials of the prior art that are similar or equivalent to the methods, equipment, and materials described in the embodiments of the present invention can also be used to implement the present invention.
[0035] It should be understood that the terms used in the embodiments of the present invention are for describing specific embodiments rather than for limiting the scope of protection of the present invention. Unless otherwise defined, all technical and scientific terms used in the present invention have the same meaning as those generally understood by those skilled in the art.
[0036] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In some of the embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.
[0037] The flowchart and block diagram in the accompanying drawings illustrate the system architecture, functions and operations that may be implemented according to the methods and computer program products of various embodiments disclosed in the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment, or a part of a code, and the module, the program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0038] See also Figure 1 , Figure 1 An end-to-end panoramic image stitching method provided for one embodiment of the present invention comprises the following steps: S100, obtaining images taken by multiple cameras of a vehicle. A car panoramic camera is a vehicle-mounted visual safety system, which is used to collect images around the vehicle body, and convert the collected fisheye images into undistorted overhead images through image processing means, and finally stitch multiple images into a bird's-eye view of the vehicle body and display it to the driver in real time, thereby reducing traffic accidents caused by the driver's blind spots. Panoramic images are generally obtained by stitching images taken by multiple cameras. A common camera solution is four fisheye cameras. Of course, in order to obtain more accurate images around the vehicle, more cameras may be deployed in other solutions. In this step, it is first necessary to obtain images taken by all cameras.
[0039] It can be understood that the above-mentioned picture can be RGB image data, or YUV image data, or image data in other formats.
[0040] The end-to-end panoramic image stitching method further includes the following steps: S200, processing the multiple images to obtain camera data. Since the specifications and quantities of the multiple images are not uniform, in order to adapt to more occasions, the multiple images are processed here to obtain camera data in a uniform format, which is convenient for subsequent model processing.
[0041] The end-to-end panoramic image stitching method also includes the following steps: S300, inputting camera data, preset parameter data and weight data into the trained panoramic image stitching model to generate a panoramic image map, the parameter data is the coordinate mapping relationship between the picture and the panoramic image map, and the weight data is the weight of the picture in the panoramic image map. In order to achieve end-to-end panoramic image stitching, the present embodiment introduces preset parameter data and weight data, wherein the parameter data is the coordinate mapping relationship between the picture and the panoramic image map, which is mainly to introduce the parameter characteristics of the camera; the weight data is the weight of the picture in the panoramic image map. Finally, the camera data, parameter data and weight data are input into the trained panoramic image stitching model to obtain a stitched panoramic image map, thereby achieving end-to-end panoramic image stitching.
[0042] The above steps adopt an end-to-end approach, without the need for intermediate conversion changes or brute force matching. By directly inputting camera data, parameter data and weight data into the trained panoramic image stitching model, a panoramic image can be obtained. The model in this method has fewer parameters and less inference time, does not require a lot of GPU computing power, has high real-time performance, and is very suitable for embedded platforms.
[0043] In a specific embodiment of the present invention, step S100 includes: obtaining four pictures taken by the front camera, the rear camera, the left camera and the right camera at the same time. As mentioned above, the most common panoramic imaging solution generally includes four fisheye cameras, which are generally called the front camera, the rear camera, the left camera and the right camera according to their different positions on the vehicle. When each embodiment is further described in detail below, these four cameras are taken as an example for detailed description.
[0044] See also Figure 2 In a specific embodiment of the present invention, step S200 includes: S201, reducing the four pictures so that the length and width of the four pictures are reduced to half of the original pictures; S202, splicing the four reduced pictures into a picture of the same size as the original picture in a preset order to obtain camera data. In this embodiment, by reducing and splicing the original four pictures, a picture of the same size as the original picture can be obtained. For example, taking a 3-megapixel RGB picture as an example, the resolution of the pictures taken by the four cameras is 1920×1536, and the number of channels is 3. First, the four pictures are scaled to a resolution of 960×768, and then spliced.
[0045] For example, the stitching process can be to place the four pictures of the left camera, right camera, front camera, and rear camera at the upper left, upper right, lower left, and lower right positions for stitching. The stitching order can be arbitrary, but it should be noted that after the stitching order is determined, the same order needs to be used for stitching during model training and panoramic image stitching. The camera data after stitching is as follows: Figure 3 shown.
[0046] See also Figure 4 In a specific embodiment of the present invention, the preset parameter data is obtained by the following steps: S301, according to the internal parameters and external parameters of multiple cameras, the inverse mapping relationship from the world coordinates to the camera coordinates (also called camera coordinates) is obtained. For example, the inverse mapping relationship can be obtained by the following steps: first, the rotation matrix R is calculated according to the camera external parameters 3×3 and the translation matrix T 3×1 get Then calculate the distortion LUT parameter table based on the camera internal parameters Then based on and Calculate the inverse mapping relationship. The specific formula is as follows:
[0047]
[0048] In the formula, [x w ,y w ,z w ] T is the world coordinate, [u,v] T is the camera coordinate, r represents the arc length of the non-distorted point, and r' represents the arc length of the distorted point. This formula is the calculated inverse mapping relationship. It can be understood that when there are multiple cameras, each camera corresponds to an inverse mapping relationship.
[0049] See also Figure 5 , the preset parameter data is also obtained through the following steps: S302, according to the inverse mapping relationship, calculate the correspondence between the world coordinates and the pixel positions of the pictures taken by multiple cameras. After obtaining the inverse mapping relationship, the corresponding relationship can be further obtained. For example, in a specific embodiment of the present invention, step S302 includes: S3021, for each world coordinate within the shooting range of the camera, calculate the first correspondence between the pixel positions of the pictures taken by the camera according to the inverse mapping relationship; S3022, for the world coordinates beyond the shooting range of the camera, the corresponding pixel positions are marked as (0,0), and the second correspondence between the pixel positions of the pictures taken by the camera is obtained; S3023, the first correspondence is combined with the second correspondence to obtain a mapping table matrix to represent the correspondence between the world coordinates and the pixel positions of the pictures taken by multiple cameras; wherein the mapping table matrix corresponds to the camera.
[0050] The above steps are further explained below with specific examples. In order to align the camera data size, 1920×1536 is used as the grid range, and each grid point is sampled 16mm, corresponding to a field of view of 30.72m×24.576m. Establish a world coordinate system. For example, the center point of the rear axle of the vehicle can be used as the coordinate origin, the width of the vehicle can be used as the X direction, the length of the vehicle can be used as the Y direction, and the height of the vehicle can be used as the Z direction. The coordinate information (x w ,y w ,z w ). Taking the left camera as an example, we can use the coordinate information (x w ,y w ,z w ) and the above inverse mapping relationship, the pixel position of each pixel position in the world coordinate in the picture taken by the left camera is obtained. For the pixel position in the world coordinate that exceeds the shooting range of the left camera, the corresponding pixel position of the picture taken by the left camera is recorded as (0,0), thereby forming a 1920×1536 mapping table matrix, in which each element of the mapping table matrix corresponds to the pixel position of the picture taken by the left camera. For the other three cameras, three 1920×1536 mapping table matrices can be obtained in the same way, so a total of four mapping table matrices can be obtained.
[0051] See also Figure 6 and Figure 7 , since the elements in the mapping table matrix are pixel positions, the value range of its elements is 0 to 1920, which has a relatively large span and is not conducive to subsequent calculations. Therefore, normalization processing is required, for example, it can be normalized to 0 to 1 or other ranges. In the aforementioned scheme, the size of the camera data is 1920×1536×3, and each pixel value is 0 to 255. Therefore, in a specific embodiment of the present invention, for example, the four mapping table matrices can be normalized to 0 to 255. For ease of understanding, the four normalized mapping table matrices are combined in pairs to obtain two visualized pictures. For example, the normalized mapping table matrices corresponding to the front camera and the rear camera can be combined to obtain the first picture, wherein the R channel of the first picture is the x-coordinate of the mapping table matrix corresponding to the front camera, the G channel is the y-coordinate of the mapping table matrix corresponding to the front camera, the B channel is the x-coordinate of the mapping table matrix corresponding to the rear camera, and the A channel is the y-coordinate of the mapping table matrix corresponding to the rear camera. The first picture is as follows Figure 6As shown. Then combine the normalized mapping table matrices corresponding to the left camera and the right camera to get the second picture, where the R channel of the second picture is the x-coordinate of the mapping table matrix corresponding to the left camera, the G channel is the y-coordinate of the mapping table matrix corresponding to the left camera, the B channel is the x-coordinate of the mapping table matrix corresponding to the right camera, and the A channel is the y-coordinate of the mapping table matrix corresponding to the right camera. The second picture is as shown Figure 7 The first picture and the second picture together constitute the parameter data.
[0052] See also Figure 8 In a specific embodiment of the present invention, the preset weight data is obtained by the following steps: S310, dividing the panoramic image to be generated into multiple regions according to the position relationship of multiple cameras; S320, obtaining weight data according to the relationship between the regions and the shooting range of the cameras. By introducing the concept of multiple regions, the calculation of weight data can be simplified.
[0053] See also Fig. 9 In a specific embodiment of the present invention, step S310 includes: S311, determining the image size of the panoramic image to be generated according to the positional relationship of multiple cameras and the vehicle; S312, dividing the panoramic image to be generated into multiple areas according to the image size, the positional relationship of multiple cameras and the vehicle. In this embodiment, a specific area division method is provided, that is, the panoramic image is divided according to the positional relationship of multiple cameras and the vehicle. The reason for this is that in the panoramic image, the cameras are installed around the vehicle and facing outward, so the weight matrices corresponding to the vehicle area and the non-vehicle area must be different. At the same time, the positional relationship of multiple cameras directly affects the weight of each camera in the non-vehicle area.
[0054] See also Fig.10 In a specific embodiment of the present invention, step S312 includes: S3121, setting the area corresponding to the vehicle in the panoramic image to be generated as the vehicle area, for example Fig.12 In the weight data shown, the vehicle area is the middle area; S3122, according to the shooting range of multiple cameras, the area covered by the shooting range of only one camera in the panoramic image to be generated is set as a non-overlapping area, for example Fig.12 In the weight data shown, the non-overlapping areas are the front, rear, left and right areas, which correspond to the front camera, rear camera, left camera and right camera respectively; S3123, according to the shooting ranges of the multiple cameras, the areas covered by the shooting ranges of at least two cameras in the panoramic image to be generated are set as overlapping areas, for example Fig.12In the weight data shown, the overlapping areas are the left front, right front, left rear, and right rear areas. Both the front camera and the left camera can capture the left front area. Therefore, the left front area corresponds to the front camera and the left camera, and other areas also correspond to two cameras.
[0055] See also Fig.11 and Fig.12 In a specific embodiment of the present invention, step S320 includes: S321. When the area is a vehicle area, the weight data of all pixels located in the vehicle area are 0. For example, the initial weight of each pixel in the vehicle area can be recorded as [0,0,0,0], and these four 0s correspond to the weights of the four cameras respectively.
[0056] Step S320 also includes: S322, when the area is a non-overlapping area, the weight data of all pixels located in the non-overlapping area are related to the camera corresponding to the area, and the values are equal. The initial weights of the non-overlapping areas can be, for example: the initial weight of the front area is recorded as [1,0,0,0]; the initial weight of the rear area is recorded as [0,1,0,0]; the initial weight of the left area is recorded as [0,0,1,0]; the initial weight of the right area is recorded as [0,0,0,1]. Taking the front area as an example, this area only appears in the shooting range of the front camera, and other cameras cannot capture the front area, so the weight representing the front camera is recorded as 1, and the others are recorded as 0.
[0057] Step S320 also includes: S323, when the area is an overlapping area, the weight data of all pixels in the overlapping area are related to the specific position of the pixel and the contribution of multiple cameras corresponding to the area. The overlapping area includes the left front area, the right front area, the left rear area and the right rear area. Their corresponding initial weights can be, for example: the initial weight of the left front area is recorded as [α, 0, 1-α, 0]; the initial weight of the right front area is recorded as [α, 0, 0, 1-α]; the initial weight of the left rear area is recorded as [0, α, 1-α, 0]; the initial weight of the right rear area is recorded as [0, α, 0, 1-α]. Taking the left front area as an example, since the rear camera and the right camera cannot capture this area, the second and fourth numbers are 0. Assuming that in the left front area, the contribution of the front camera is α, then the contribution of the left camera is 1-α, so the initial weight of the left front area is [α, 0, 1-α, 0]. The weights of other overlapping areas can be calculated in the same way.
[0058] The above contribution can be understood as: the closer to the edge of a pixel point in the image taken by the camera, the lower the contribution. In actual calculation, α can be calculated based on the relative distance or angle between the position of each pixel point and the corresponding two areas.
[0059] For the left front area, it is the overlapping area of the front camera and the left camera. When calculating the specific α, taking the angle as an example, the initial weights of multiple positions corresponding to the same angle should be the same. See Fig.12 In a specific embodiment of the present invention, the weight value α is related to the angle θ between each actual position and the front area. For example, it can be calculated in the following way: the weight value α is 1.0 between 0 and θ1, changes linearly from 1 to 0.5 between θ1 and θ2, changes linearly from 0.5 to 0 between θ2 and θ3, and is 0 between θ3 and π / 2. Among them, θ1, θ2, and θ3 can be set to 30°, 45°, and 60° based on experience. It can be understood that when the definition of the angle θ is different, the calculation method of the weight value α is also different. The specific calculation method and angle value setting in this example are for reference only.
[0060] It can be understood that the values of the above initial weights are all 0 to 1. In order to maintain consistency with the camera data and parameter data, they can also be normalized to the range of 0 to 255. After normalization, the weight data can be mapped to a third picture, where the R channel of the third picture represents the normalized weight value of the front camera, the G channel represents the normalized weight value of the rear camera, the B channel represents the normalized weight value of the left camera, and the A channel represents the normalized weight value of the right camera. The third picture is as follows Fig.12 shown.
[0061] It can be understood that the above parameter data and weight data are only generated once during initialization, for example, when the vehicle leaves the factory, and then they can be saved as preset parameter data and weight data and can be directly read for subsequent use.
[0062] It is understandable that if the sizes of the camera data, parameter data, and weight data are different, the sizes can be adjusted first. The adjusted three types of data can be directly input into the trained panoramic image stitching model, or they can be input into the model after being combined, and the combination method can be, for example, matrix addition, matrix multiplication, or matrix dimension expansion.
[0063] See also Fig.13 In a specific embodiment of the present invention, step S300 includes: inputting camera data, preset parameter data and weight data into an encoder (Encode module) of a panoramic image stitching model to extract image features; inputting the extracted image features into a decoder (Decode module) of a panoramic image stitching model to parse the image features; inputting the parsed image features into a fully convolutional network layer ( Fig.13In this embodiment, the panoramic image stitching model includes an encoder, a decoder, and a full convolutional network layer, wherein the encoder and the decoder are mainly used to extract and analyze image features, and the full convolutional network layer is mainly used to adjust the size of the panoramic image output by the model, thereby outputting panoramic images of different fields of view.
[0064] It can be understood that the encoder and decoder can be implemented using networks such as Transformer and Resnet, or they can be composed of convolutional layers, such as in Fig.13 The panoramic image stitching model shown in the figure is composed of a three-layer convolutional neural network downsampling Encode module and a three-layer convolutional neural network upsampling Decode module. The former Encode module is used to extract image features, and the latter Decode module is used to analyze image features. Finally, a full convolutional network (CNN) is used to generate a panoramic image. The 7-layer convolutional neural network has fewer network parameters and less inference time. It does not require a lot of GPU computing power and has high real-time performance.
[0065] It is understandable that after building the panoramic image stitching model, the model needs to be trained. During training, the traditional optical flow method and feature point matching can be used to obtain a high-precision panoramic image as GroundTrue, and then minimize the loss function of GroundTrue and model output. The training process is as follows: Fig.14 During training, for example, the mean square error MSE can be used as a loss function to minimize the error between the high-precision panoramic image and the panoramic image output by the panoramic image stitching model.
[0066] It can be understood that multi-scale panoramic images can be used to train panoramic image stitching models of different fields of view, or panoramic images of a certain fixed scale can be used to train panoramic image stitching models. For the former model, it is necessary to prepare multi-scale training sets, and the training process is also longer, but the trained model can adapt well to panoramic images of different fields of view. For the latter model, only a single-scale training set is needed, and the model trained in the end is only suitable for panoramic images of that size.
[0067] See also Fig.15 , Fig.15 An electronic device provided for one embodiment of the present invention includes a processor, a memory and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute a computer program stored in the memory to implement the panoramic image stitching method in any of the above embodiments.
[0068] In a specific embodiment of the present invention, the present invention further provides a computer-readable storage medium on which a computer program is stored, and the computer program is used to enable a computer to execute the panoramic image stitching method in any of the above embodiments.
[0069] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. An end-to-end panoramic image stitching method, characterized in that: The steps include: Get pictures taken by multiple cameras of the vehicle; Processing a plurality of the images to obtain camera data; The camera data, preset parameter data and weight data are input into the trained panoramic image stitching model to generate a panoramic image map, wherein the parameter data is the coordinate mapping relationship between the image and the panoramic image map, and the weight data is the weight of the image in the panoramic image map.
2. The end-to-end panoramic image stitching method according to claim 1, characterized in that: The preset parameter data is obtained through the following steps: Obtaining an inverse mapping relationship from world coordinates to camera coordinates based on the intrinsic parameters and extrinsic parameters of the multiple cameras; According to the inverse mapping relationship, the correspondence between the world coordinates and the pixel positions of the pictures taken by the multiple cameras is calculated; The parameter data is obtained according to the corresponding relationship.
3. The end-to-end panoramic image stitching method according to claim 2, characterized in that: The step of calculating the correspondence between the world coordinates and the pixel positions of the pictures taken by the multiple cameras according to the inverse mapping relationship comprises: For each world coordinate within the shooting range of the camera, a first corresponding relationship between the world coordinate and the pixel position of the picture shot by the camera is calculated according to the inverse mapping relationship; For world coordinates beyond the shooting range of the camera, the corresponding pixel positions are marked as (0,0), and a second corresponding relationship between the pixel positions of the picture taken by the camera is obtained; The first corresponding relationship and the second corresponding relationship are combined to obtain a mapping table matrix to represent the corresponding relationship between the world coordinates and the pixel positions of the pictures taken by multiple cameras; wherein the mapping table matrix corresponds to the cameras.
4. The end-to-end panoramic image stitching method according to claim 3, characterized in that: The step of obtaining the parameter data according to the corresponding relationship comprises: A plurality of the mapping table matrices are combined and normalized to obtain the parameter data.
5. The end-to-end panoramic image stitching method according to claim 1, characterized in that: The preset weight data is obtained through the following steps: Dividing the panoramic image to be generated into a plurality of areas according to the positional relationship of the plurality of cameras; The weight data is obtained according to the relationship between the area and the shooting range of the camera.
6. The end-to-end panoramic image stitching method according to claim 5, characterized in that: The step of dividing the panoramic image to be generated into a plurality of areas according to the positional relationship of the plurality of cameras comprises: Determining the image size of the panoramic image to be generated according to the positional relationship between the multiple cameras and the vehicle; According to the image size, the panoramic image to be generated is divided into a plurality of areas according to the positional relationship of the multiple cameras and the vehicle.
7. The end-to-end panoramic image stitching method according to claim 6, characterized in that: The step of dividing the panoramic image to be generated into a plurality of regions according to the positional relationship of the plurality of cameras and the vehicle according to the image size comprises: according to the image size, Setting the area corresponding to the vehicle in the panoramic image to be generated as a vehicle area; According to the shooting ranges of the multiple cameras, in the panoramic image to be generated, an area covered by the shooting range of only one camera is set as a non-overlapping area; According to the shooting ranges of the multiple cameras, the areas covered by the shooting ranges of at least two cameras in the panoramic image to be generated are set as overlapping areas.
8. The end-to-end panoramic image stitching method according to claim 7, characterized in that: The step of obtaining the weight data according to the relationship between the area and the shooting range of the camera comprises: When the area is a vehicle area, the weight data of all pixels located in the vehicle area are 0; When the area is a non-overlapping area, the weight data of all pixels located in the non-overlapping area are related to the camera corresponding to the area, and the values are equal; When the area is an overlapping area, the weight data of all pixels located in the overlapping area are related to the specific positions of the pixels and the contribution of multiple cameras corresponding to the area.
9. An electronic device, characterized in that: The method comprises a processor, a memory and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute the computer program stored in the memory to implement the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is used to enable a computer to execute the method according to any one of claims 1 to 8.
Citation Information
Cited By
End-to-end panoramic image stitching method, electronic device, and storage medium
WO2025252250A1
Communication method and apparatus, and system
WO2026092173A1
