Image splicing method and device, equipment and storage medium
By deforming and splicing images from multiple camera devices in the processor, the problem of scene misalignment and discontinuous seams is solved, and the accuracy of image splicing and user experience are improved.
Patent Information
- Application Number
- CN202410752437.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-10-01
AI Technical Summary
The existing technology has problems such as misaligned scenes and discontinuous seams in image splicing, resulting in low accuracy of image splicing and affecting users' accurate observation and analysis of environmental information.
By communicating between the processor and multiple camera devices, the images of adjacent camera devices are acquired and deformed, the positions of the pixels are changed, and the images are aligned and then spliced to generate a target image, including the images captured by the adjacent camera devices. scene.
It improves the accuracy of image splicing, achieves seamless splicing, provides clearer and more realistic pictures, and improves the user's viewing experience.
Smart Images

Figure CN118735773A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to computer vision, deep learning, AIGC and other technical fields in the field of artificial intelligence, and can be used in scenarios such as smart sports, and in particular to an image stitching method, device, equipment and storage medium. Background Art
[0002] A camera device can only provide a limited viewing angle. In order for a user to fully view the information in the environment, a plurality of cameras need to be deployed in the environment.
[0003] In order to provide users with a smooth viewing experience, images captured by different camera devices need to be stitched together. Summary of the invention
[0004] The present disclosure provides an image stitching method, an apparatus, a device and a storage medium.
[0005] According to a first aspect of the present disclosure, a method for image stitching is provided. The method is applied to a processor, wherein the processor is communicatively connected to a plurality of camera devices connected in series. The method comprises:
[0006] Acquire an image captured by each of the adjacent camera devices;
[0007] Performing deformation processing on the image captured by each of the adjacent camera devices to obtain a deformed image corresponding to the camera device; wherein the deformation processing is used to change the position of the pixel points in the image;
[0008] The deformed images corresponding to each camera device in the adjacent camera devices are stitched together to obtain a target image; wherein the target image includes a scene in an image captured by a previous camera device in the adjacent camera devices and a scene in an image captured by a subsequent camera device in the adjacent camera devices.
[0009] According to a second aspect of the present disclosure, there is provided an image stitching device, which is applied to a processor, wherein the processor is communicatively connected to a plurality of camera devices connected in series, and the device comprises:
[0010] An image acquisition unit, used to acquire an image captured by each of the adjacent camera devices;
[0011] A deformation unit, used for performing deformation processing on the image captured by each of the adjacent camera devices to obtain a deformed image corresponding to the camera device; wherein the deformation processing is used to change the position of the pixel points in the image;
[0012] A stitching unit is used to stitch the deformed images corresponding to each camera device in the adjacent camera devices to obtain a target image; wherein the target image includes the scene in the image captured by the previous camera device in the adjacent camera devices and the scene in the image captured by the next camera device in the adjacent camera devices.
[0013] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0014] at least one processor; and
[0015] a memory communicatively coupled to the at least one processor;
[0016] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.
[0017] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the first aspect.
[0018] According to a fifth aspect of the present disclosure, a computer program product is provided, the computer program product comprising: a computer program, which implements the method described in the first aspect when executed by a processor.
[0019] According to the technology disclosed in the present invention, the accuracy of image stitching is improved and the viewing experience of users is enhanced.
[0020] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0022] Figure 1 is a flowchart of an image stitching method provided according to an embodiment of the present disclosure;
[0023] Figure 2 is a flowchart of an image stitching method provided according to an embodiment of the present disclosure;
[0024] Figure 3 is a schematic diagram of confirming a first position and a second position provided according to an embodiment of the present disclosure;
[0025] Figure 4a is a schematic diagram of an image before deformation processing provided according to an embodiment of the present disclosure;
[0026] Figure 4b is a schematic diagram of an image after deformation processing provided according to an embodiment of the present disclosure;
[0027] Figure 5 is a flowchart of an image stitching method provided according to an embodiment of the present disclosure;
[0028] Figure 6a is a schematic diagram of a first image provided according to an embodiment of the present disclosure;
[0029] Figure 6b is a schematic diagram of a second image provided according to an embodiment of the present disclosure;
[0030] Figure 7 is a schematic diagram of a mask image provided according to an embodiment of the present disclosure;
[0031] Figure 8 is a structural block diagram of an image stitching device provided according to an embodiment of the present disclosure;
[0032] Fig. 9 is a structural block diagram of an image stitching device provided according to an embodiment of the present disclosure;
[0033] Fig.10 is a block diagram of an electronic device for implementing the image stitching method of the embodiment of the present disclosure;
[0034] Fig.11 The block diagram is a block diagram of an electronic device used to implement the image stitching method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0035] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0036] Cameras can only provide a limited viewing angle when shooting. In order to fully view the information in the environment, multiple cameras need to be deployed in the environment. Especially in today's professional sports, there is a growing demand for high-precision, real-time sports performance analysis. This demand stems from the continuous pursuit of optimizing athlete performance, including accurate analysis of technical details, instant adjustment of sports strategies, and effective management of injury prevention. Traditional analysis methods often rely on manual observation and post-data processing, which is not only time-consuming and labor-intensive, but also difficult to achieve the required accuracy and real-time performance.
[0037] For example, current swimming competition video shooting often only provides limited perspectives and cannot fully show the entire race track. To address this problem, multiple cameras can be placed at the bottom of the swimming pool and automatic stitching technology can be used to achieve panoramic video shooting of a single track, so that coaches and athletes can obtain more comprehensive and detailed competition information. This information helps coaches conduct more accurate analysis and guidance, and helps athletes improve their techniques and performance.
[0038] However, there may be overlaps in scenes and misalignment of objects between images captured by different cameras, and users cannot accurately view information in the environment. Traditional image stitching methods often result in discontinuous seams in images, unnatural transitions between images captured by different cameras, and low image stitching accuracy, which may affect coaches and athletes' accurate observation and analysis of the game process. Therefore, it is necessary to use precise stitching technology and optimized algorithms to achieve seamless stitching of images captured by multiple cameras, so that the images appear coherent and natural at the seams. Provide users with clearer and more realistic images to help them better understand the performance of the players and the game process, thereby improving their training results.
[0039] The present disclosure provides a method, device, equipment and storage medium for image stitching, which are applied to technical fields such as computer vision, deep learning, and AIGC (Artificial Intelligence Generated Content) in the field of artificial intelligence to improve the accuracy of image stitching.
[0040] It should be noted that the data in this embodiment is not targeted at a specific user and cannot reflect the personal information of a specific user. It should be noted that the images in this embodiment are from a public data set.
[0041] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0042] In order to enable readers to more deeply understand the implementation principle of the present disclosure, the following Figure 1-Figure 11 The embodiment is further refined.
[0043] Figure 1 The figure is a flow chart of an image stitching method provided according to an embodiment of the present disclosure. The method is applied to a processor, and the processor is in communication connection with a plurality of camera devices connected in series. The method can be executed by an image stitching device. Figure 1 As shown, the method comprises the following steps:
[0044] S101: Acquire an image captured by each of the adjacent camera devices.
[0045] Exemplarily, a plurality of cameras may be placed in a pool, and the cameras may be arranged in a straight line, and the cameras may be cameras. For example, in a swimming pool for a swimming competition, a row of cameras may be placed against the pool wall and along the bottom of the pool, from the start to the end of the lane, so that the images captured by all cameras may include the entire lane. Each camera may be adjacent to at least one camera, and two adjacent cameras may be determined as a pair of adjacent cameras. For example, camera one, camera two, and camera three are placed in the water in sequence, then camera one and camera two are adjacent cameras, and camera two and camera three are adjacent cameras.
[0046] Each camera device can shoot in real time, and each camera device is connected to the processor for communication, and can send the captured images to the processor in real time. That is, the processor can be connected to the cameras arranged in a straight line underwater for communication. The processor can be a computing device for receiving and processing image data. For each pair of adjacent cameras, the processor can obtain in real time the images captured by each camera device at the same time. For example, the processor can simultaneously receive the images captured by camera device 1 and camera device 2 at 9:36.
[0047] S102, performing deformation processing on the image captured by each of the adjacent camera devices to obtain a deformed image corresponding to the camera device; wherein the deformation processing is used to change the position of the pixel points in the image.
[0048] Exemplarily, after obtaining the image captured by each of the adjacent camera devices, each image is deformed and the processed image is determined as a deformed image. That is, a deformed image of the image captured by each camera device can be obtained, that is, a deformed image corresponding to the camera device.
[0049] Deformation processing can be used to change the position of pixels in an image, and to move pixels in the image up, down, left, and right. For example, the image includes a floating ball in the upper left corner of the image. After deformation, the floating ball is in the middle of the image. A calculation formula for deformation processing can be preset. For example, the calculation formula can move each pixel in the image downward by a distance of two pixels. The calculation formula for deformation can be called a deformation operator. In this embodiment, the preset deformation operator is not specifically limited.
[0050] The images captured by each camera in the adjacent cameras must be deformed, and the deformation operators corresponding to each camera can be the same or different. The purpose of deformation is to align the images captured by each camera to avoid misalignment of the scenes in the two images. For example, through deformation calculation, the image distortion in the underwater camera that is difficult to correct by camera distortion can be corrected, and the swimming lanes, buoys and underwater bottom lines in each image can be aligned.
[0051] S103, stitching the deformed images corresponding to each of the adjacent camera devices to obtain a target image; wherein the target image includes a scene in an image captured by a previous camera device among the adjacent camera devices and a scene in an image captured by a subsequent camera device among the adjacent camera devices.
[0052] Exemplarily, after the deformed images corresponding to each of the adjacent camera devices are obtained, the deformed images are fused. Fusion may refer to stitching two images into one image, that is, stitching the deformed images into one image, and determining the image obtained after stitching as the target image. The target image may include scenes in the deformed images, that is, including scenes in the image captured by the previous camera device in the adjacent camera devices and scenes in the image captured by the next camera device in the adjacent camera devices.
[0053] The deformable images may be spliced according to the arrangement order of the camera devices. For example, if the camera device 1 is on the left side of the camera device 2, the deformable image corresponding to the camera device 1 may be spliced on the left side of the deformable image corresponding to the camera device 2.
[0054] In this embodiment, the images captured by adjacent cameras may overlap, for example, the right side of the image captured by camera 1 is consistent with the left side of the image captured by camera 2. When stitching, stitching can be performed according to the image width of the overlapping area, that is, the overlapping parts of the two images are stacked together to avoid duplication of the images in the target image.
[0055] In an embodiment of the present disclosure, multiple cameras are placed in an environment, such as underwater, to obtain images captured by each of the adjacent cameras in real time. The images captured by each of the adjacent cameras are deformed to obtain a deformed image corresponding to the camera, thereby avoiding the situation where the images captured by different cameras are not aligned with each other. The deformed images corresponding to each of the adjacent cameras are then spliced to obtain a target image, so that the target image can represent the scene in the image captured by the previous camera in the adjacent camera and the scene in the image captured by the next camera in the adjacent camera, thereby achieving panoramic shooting of the underwater scene. By deforming and splicing, the problem of discontinuous splicing in the related art is solved, the accuracy of image splicing is improved, and the target image presents a coherent and natural effect, providing users with clearer and more realistic pictures and improving the user's viewing experience.
[0056] Figure 2 A flowchart of an image stitching method provided in an embodiment of the present disclosure.
[0057] In this embodiment, deformation processing is performed on the image captured by each camera device in the adjacent camera devices to obtain a deformed image corresponding to the camera device, including: respectively determining a deformation operator corresponding to each camera device in the adjacent camera devices; wherein the deformation operator is a function for performing deformation processing; according to the deformation operator, deformation processing is performed on the image captured by each camera device in the adjacent camera devices to obtain a deformed image corresponding to the camera device.
[0058] like Figure 2 As shown, the method comprises the following steps:
[0059] S201: Acquire an image captured by each of the adjacent camera devices.
[0060] Exemplarily, this step may refer to the above-mentioned step S101 and will not be described in detail.
[0061] S202, respectively determine a deformation operator corresponding to each of the adjacent camera devices; wherein the deformation operator is a function for performing deformation processing.
[0062] Exemplarily, each camera device in an environment, such as a pool, corresponds to its own deformation operator, and the deformation operator may refer to a function for performing deformation processing, which is used to perform deformation processing. The deformation operators associated with each camera device are predetermined and stored. After acquiring the image captured by each camera device in the adjacent camera devices, the deformation operators corresponding to each camera device in the adjacent camera devices are determined. For example, the deformation operator of camera device one can move the pixel points in the image captured by camera device one to the left by a distance of two pixel points, and the deformation operator of camera device two can move the pixel points in the image captured by camera device two up by a distance of one pixel point.
[0063] In this embodiment, the method also includes: acquiring historical images captured by each camera device in adjacent camera devices; determining a first position and a second position confirmed by a user on the historical image through a preset visualization interface; wherein the first position represents the coordinate position of the pixel point before deformation, and the second position represents the coordinate position of the pixel point after deformation; according to the first position and the second position, determining a deformation operator corresponding to the camera device, and storing the camera device and the corresponding deformation operator in association; wherein the deformation operator corresponding to the camera device is used to transfer the coordinate position of the pixel point from the first position to the second position.
[0064] Specifically, for each camera device, a deformation operator corresponding to the camera device is predetermined. Images captured by the camera device in a historical time can be obtained as historical images. The user can see the historical images of the camera device through a visualization interface and can click on the historical images.
[0065] Determine the position where the user clicks on the historical image through the visualization interface. Determine the position where the user clicks as the first position and the second position, for example, determine the first position clicked by the user as the first position, and determine the second position clicked by the user as the second position. The user can confirm multiple first positions and second positions on the historical image, and the number of first positions is the same as the number of second positions. The first position can represent the coordinate position of the pixel point before deformation, and the second position can represent the coordinate position of the pixel point after deformation, that is, the first position is the actual position of the pixel point in the image before deformation, and the second position is the expected position of the pixel point after deformation.
[0066] According to the first position and the second position, a deformation operator corresponding to the camera device is determined, and the deformation operator corresponding to the camera device can be used to transfer the coordinate position of the pixel point from the first position to the second position. That is, the second position can be obtained by substituting the first position into the deformation operator. In this embodiment, TPS (Thin Plate Spline) deformation can be used. For example, the deformation operator can be expressed as:
[0067] Deform=T(srcpoint ,dst point );
[0068] Among them, Deform represents the deformation operator, T is the function formula, src point Indicates the first position, dst point Indicates the second position. TPS is through the pixel src point and dst point , calculate the deformation relationship Deform, which is to transform src point Mapping to dst point The target is calculated. Deform is then applied to the image to achieve image deformation.
[0069] Each camera device and the corresponding deformation operator are stored in association to facilitate subsequent search for the corresponding deformation operator.
[0070] The beneficial effect of such a setting is that the deformation operator corresponding to each camera device is determined in advance, so that targeted deformation processing can be performed on each camera device, which is convenient for subsequent calculations and improves the efficiency and accuracy of image stitching.
[0071] S203 . Perform deformation processing on the image captured by each of the adjacent camera devices according to the deformation operator to obtain a deformed image corresponding to the camera device.
[0072] Exemplarily, after obtaining the deformation operator corresponding to each of the adjacent camera devices, deformation processing is performed on the image captured by the camera device corresponding to the deformation operator, and the image obtained after the deformation processing is determined as the deformed image corresponding to the camera device.
[0073] Each camera device may correspond to its own deformable image. The position of each pixel in the image captured by the camera device may be sequentially substituted into the corresponding deformation operator, the new position of each pixel may be calculated, and a new image may be constructed according to the new position as the deformable image of the camera device.
[0074] In this embodiment, deformation operators corresponding to each camera device are pre-set, and targeted function calculations are performed according to the deformation operators to obtain deformed images corresponding to each camera device. Targeted processing of different images is achieved to avoid misalignment of scenes between different images, improve the accuracy and efficiency of deformation processing, and further improve the accuracy and efficiency of image stitching.
[0075] In this embodiment, according to the deformation operator, the image captured by each camera device in the adjacent camera devices is deformed to obtain a deformed image corresponding to the camera device, including: determining the coordinate position of the pixel point in the image captured by each camera device in the adjacent camera devices, and taking the coordinate position as the current position; according to the deformation operator, determining the target position corresponding to the current position; wherein the target position represents the coordinate position of the pixel point in the deformed image; and determining the deformed image corresponding to the camera device according to the target position of the pixel point.
[0076] Specifically, an image is composed of a plurality of pixels, and each pixel has its own corresponding position on the image. For an image captured by a camera in an adjacent camera, the coordinate position of each pixel in the image is determined as the current position of the pixel.
[0077] According to the deformation operator corresponding to the camera device, the current position is calculated, and the calculation result is determined as the target position corresponding to the current position, that is, the coordinate position of the pixel point in the deformed image is determined. For example, the current position can be substituted into the deformation operator for calculation to calculate the target position. The target position of each pixel point in the image or the pixel point of a preset local area in the image can be calculated. According to the target position of the pixel point, the pixel point is arranged at the target position to obtain the deformed image corresponding to the camera device.
[0078] The beneficial effect of such a setting is that the deformation operator can be used to calculate the target position of the pixel point, and the deformed image is constructed from the target position to correct the distortion in the image and improve the accuracy of image stitching.
[0079] In this embodiment, the deformation operator corresponding to the previous camera device among the adjacent camera devices is the first operator, and the deformation operator corresponding to the next camera device among the adjacent camera devices is the second operator; according to the deformation operator, the image captured by each camera device among the adjacent camera devices is deformed to obtain a deformed image corresponding to the camera device, including: according to the first operator, the image captured by the previous camera device among the adjacent camera devices is deformed to obtain a deformed image corresponding to the previous camera device among the adjacent camera devices; and, according to the second operator, the image captured by the next camera device among the adjacent camera devices is deformed to obtain a deformed image corresponding to the next camera device among the adjacent camera devices.
[0080] Specifically, the adjacent camera devices include at least two camera devices, which are arranged in sequence, and when performing deformation processing, the image captured by each of the adjacent camera devices needs to be deformed. That is, the image captured by the previous camera device in the adjacent camera devices needs to be deformed, and the image captured by the next camera device in the adjacent camera devices needs to be deformed.
[0081] Each camera device has its own deformation operator. The deformation operator corresponding to the previous camera device among the adjacent camera devices is the first operator, and the deformation operator corresponding to the next camera device among the adjacent camera devices is the second operator. When deforming, the image captured by the previous camera device among the adjacent camera devices is deformed according to the first operator to obtain a deformed image corresponding to the previous camera device. The image captured by the next camera device among the adjacent camera devices is deformed according to the second operator to obtain a deformed image corresponding to the next camera device. In this embodiment, the order of deformation processing of the two images is not specifically limited.
[0082] The beneficial effect of such an arrangement is that the images captured by each camera device are subjected to targeted deformation processing, thereby improving the accuracy of the deformation processing and further improving the accuracy of image stitching.
[0083] S204, stitching the deformed images corresponding to each of the adjacent camera devices to obtain a target image; wherein the target image includes the scene in the image captured by the previous camera device among the adjacent camera devices and the scene in the image captured by the next camera device among the adjacent camera devices.
[0084] Exemplarily, this step may refer to the above-mentioned step S103 and will not be described in detail.
[0085] Figure 3 Schematic diagram of confirmation of the first position and the second position in this embodiment. Figure 3 The historical image displayed on the visualization interface is shown. The user confirms the first position and the second position on the historical image. The first position is Q1 and the second position is Q2. Multiple Q1s and Q2s can be set, and each Q1 corresponds to a Q2. The purpose of the deformation operator is to move Q1 to the corresponding Q2.
[0086] Figure 4a This is a schematic diagram of the image before deformation processing. Figure 4b This is a schematic diagram of the image after deformation processing. Figure 4a and Figure 4b In the figure, the image on the left is the image of the swimming pool captured by the previous camera device among the adjacent cameras, and the image on the right is the image of the swimming pool captured by the next camera device among the adjacent cameras. A row of buoys float on the surface of the swimming pool. Figure 4a In the figure, the floating balls in the two images are not aligned. After deformation, Figure 4b In the figure, the floating balls in the two images are aligned.
[0087] In the disclosed embodiment, multiple cameras are placed underwater to obtain images captured by each of the adjacent cameras in real time. The images captured by each of the adjacent cameras are deformed to obtain a deformed image corresponding to the camera, thereby avoiding the situation where the images captured by different cameras are not aligned with each other. The deformed images corresponding to each of the adjacent cameras are then spliced to obtain a target image, so that the target image can represent the scene in the image captured by the previous camera in the adjacent camera and the scene in the image captured by the next camera in the adjacent camera, thereby achieving panoramic shooting of the underwater scene. By deforming and splicing, the problem of discontinuous splicing in the related art is solved, the accuracy of image splicing is improved, and the target image presents a coherent and natural effect, providing users with a clearer and more realistic picture and improving the user's viewing experience.
[0088] Figure 5 A flowchart of an image stitching method provided in an embodiment of the present disclosure.
[0089] In this embodiment, there is an overlapping area between the images captured by each camera device in the adjacent camera devices; the deformed images corresponding to each camera device in the adjacent camera devices are stitched together to obtain a target image, including: obtaining the width of the overlapping area between the deformed image corresponding to the previous camera device in the adjacent camera devices and the deformed image corresponding to the next camera device in the adjacent camera devices; wherein the width of the overlapping area includes a first offset, a second offset, and a fusion width, the first offset represents the width of the deformed image corresponding to the previous camera device in the adjacent camera devices that needs to be cropped, the second offset represents the width of the deformed image corresponding to the next camera device in the adjacent camera devices that needs to be cropped, and the fusion width represents the width of the transition part between the two images when the images are stitched; according to the width of the overlapping area, the deformed image corresponding to the previous camera device in the adjacent camera devices and the deformed image corresponding to the next camera device in the adjacent camera devices are stitched together to obtain the target image.
[0090] like Figure 5 As shown, the method comprises the following steps:
[0091] S501: Acquire an image captured by each of the adjacent camera devices.
[0092] Exemplarily, this step may refer to the above-mentioned step S101 and will not be described in detail.
[0093] S502: Perform deformation processing on the image captured by each of the adjacent camera devices to obtain a deformed image corresponding to the camera device; wherein the deformation processing is used to change the position of the pixel points in the image.
[0094] Exemplarily, this step may refer to the above-mentioned step S102 and will not be described in detail.
[0095] S503, obtaining the width of the overlapping area between the deformed image corresponding to the previous camera device among the adjacent camera devices and the deformed image corresponding to the next camera device among the adjacent camera devices; wherein the width of the overlapping area includes a first offset, a second offset, and a fusion width, the first offset represents the width of the deformed image corresponding to the previous camera device among the adjacent camera devices that needs to be cropped, the second offset represents the width of the deformed image corresponding to the next camera device among the adjacent camera devices that needs to be cropped, and the fusion width represents the width of the transition part between the two images when the images are stitched.
[0096] For example, in order to avoid missing underwater images, the distance between adjacent cameras can be arranged relatively close, and there is an overlapping area between the images captured by each camera in the adjacent cameras. That is, the images captured by the cameras in the adjacent cameras may contain the same images. The image captured by the camera has the same image width as the deformed image corresponding to the camera, and the width of the overlapping area in the image captured by the camera is also the same as the width of the overlapping area in the corresponding deformed image.
[0097] By adjusting the distance between the cameras, the width of the overlapping area in the image can be adjusted. According to the distance between the cameras, the width of the overlapping area between the deformed image corresponding to the previous camera in the adjacent cameras and the deformed image corresponding to the next camera in the adjacent cameras can be predetermined. When the images need to be spliced, the width of the overlapping area can be directly obtained.
[0098] The width of the overlapping area can be divided into three parts, including the first offset, the second offset, and the fusion width. That is, the sum of the first offset, the second offset, and the fusion width is the width of the overlapping area. The first offset can represent the width of the deformed image corresponding to the previous camera device in the adjacent camera devices that needs to be cropped, the second offset can represent the width of the deformed image corresponding to the next camera device in the adjacent camera devices that needs to be cropped, and the fusion width can represent the width of the transition part between the two images when the images are stitched.
[0099] S504 , according to the width of the overlapping area, splicing the deformed image corresponding to the previous camera device among the adjacent camera devices and the deformed image corresponding to the next camera device among the adjacent camera devices to obtain a target image.
[0100] Exemplarily, according to the width of the overlapping area, the deformed image corresponding to the previous camera device in the adjacent camera devices and the deformed image corresponding to the next camera device in the adjacent camera devices are spliced to avoid repeated overlapping area images in the target image. For example, the overlapping area of the deformed image corresponding to the previous camera device and the overlapping area of the deformed image corresponding to the next camera device can be overlapped to obtain a complete target image.
[0101] The deformed image corresponding to the previous camera device may also be cropped according to the first offset. The deformed image corresponding to the next camera device may be cropped according to the second offset. The cropped portion is the portion of the overlapping area. For example, the deformed image corresponding to the previous camera device is cropped on the right side of the image, and the deformed image corresponding to the next camera device is cropped on the left side of the image. Then, the two cropped deformed images are spliced and fused according to the fusion width. That is, the width of the truly overlapping portion during splicing is the fusion width.
[0102] In this embodiment, two deformed images are cropped and fused to obtain a final target image, thereby achieving seamless splicing of images, which can allow users to experience a smoother and more coherent visual experience.
[0103] In this embodiment, according to the width of the overlapping area, the deformed image corresponding to the previous camera device in the adjacent camera devices and the deformed image corresponding to the next camera device in the adjacent camera devices are spliced to obtain the target image, including: obtaining the image width of the deformed image corresponding to the previous camera device in the adjacent camera devices as the first width, and obtaining the image width of the deformed image corresponding to the next camera device in the adjacent camera devices as the second width; obtaining a first cropping width according to the first width, the first offset, and the fusion width, and obtaining a second cropping width according to the second width, the second offset, and the fusion width; wherein the first cropping width is the first width minus the first offset and then minus half of the fusion width. width, the second cropping width is the second width minus the second offset, minus half of the fusion width; according to the first cropping width and the second cropping width, a mask image is constructed; wherein the width of the mask image is the first cropping width plus the second cropping width; according to the image width of the mask image, the deformed image corresponding to the previous camera device in the adjacent cameras is expanded to obtain the first image, and the deformed image corresponding to the next camera device in the adjacent cameras is expanded to obtain the second image; wherein the image widths of the first image, the second image, and the mask image are the same, and the expanded parts in the first image and the second image are black; according to the first image, the second image, and the mask image, a target image is obtained.
[0104] Specifically, the width of the image captured by each camera device can be predetermined, and the image widths corresponding to different cameras can be the same or different. The image width of the deformed image corresponding to the previous camera device in the adjacent camera devices is obtained as the first width. The deformed image corresponding to the previous camera device in the adjacent camera devices is set to I1, and the first width is set to W1. The image width of the deformed image corresponding to the next camera device in the adjacent camera devices is obtained as the second width, and the deformed image corresponding to the next camera device in the adjacent camera devices is set to I2, and the second width is set to W2.
[0105] According to the first width, the first offset, and the blending width, the first cropping width is obtained, which is the first width minus the first offset, minus half of the blending width. According to the second width, the second offset, and the blending width, the second cropping width is obtained, which is the second width minus the second offset, minus half of the blending width. The first cropping width and the second cropping width can be expressed as:
[0106]
[0107] Among them, W , 1 is the first cropping width, W , 2 is the second cropping width, diff1 is the first offset, diff2 is the second offset, and overlay is the fusion width.
[0108] A mask image is constructed based on the first cropping width and the second cropping width. The mask image is a black and white image, and the image width of the mask image is the size of the first cropping width plus the second cropping width. That is, the image width of the mask image is W , 1+W , 2.
[0109] The image width of the deformed image corresponding to the previous camera device in the adjacent camera devices is smaller than the image width of the mask image, and the image width of the deformed image corresponding to the next camera device is also smaller than the image width of the mask image. The deformed image corresponding to the previous camera device and the deformed image corresponding to the next camera device can be expanded so that the image widths of the two expanded images are consistent with the image width of the mask image. That is, according to the image width of the mask image, the deformed image corresponding to the previous camera device in the adjacent camera devices is expanded to obtain a first image, and the image width of the first image is the same as that of the mask image. According to the image width of the mask image, the deformed image corresponding to the next camera device in the adjacent camera devices is expanded to obtain a second image, and the image width of the second image is the same as that of the mask image. When expanding, the expanded part can be a black image. For example, the left part of the first image is the deformed image I1 corresponding to the previous camera device, and the right part is a black image; the right part of the second image is the deformed image I2 corresponding to the next camera device, and the left part is a black image.
[0110] The target image can be determined based on the first image, the second image, and the mask image. For example, a pixel value calculation formula of the target image can be preset, and the pixel values of the same position in the first image, the second image, and the mask image can be substituted into the preset pixel value calculation formula to calculate the pixel value of the position in the target image. The pixel values of all positions in the target image are determined to obtain the target image. In this embodiment, the preset pixel value calculation formula is not specifically limited.
[0111] The beneficial effect of such a setting is that the deformed images of adjacent cameras are fused, and the use of cropping and masking technology can avoid image content duplication, ensure image continuity, determine the pixel value in the target image, improve the efficiency and accuracy of image stitching, and enhance the user's viewing experience.
[0112] In this embodiment, a first cropping width is obtained according to a first width, a first offset, and a fusion width, including: determining a target edge of a deformed image corresponding to a previous camera device in adjacent camera devices according to arrangement positions of adjacent camera devices; wherein the target edge represents adjacent image edges in a deformed image corresponding to a previous camera device and a deformed image corresponding to a subsequent camera device; and cropping the deformed image corresponding to a previous camera device in adjacent camera devices from the target edge of the deformed image corresponding to the previous camera device in adjacent camera devices according to the first width, the first offset, and the fusion width to obtain the first cropping width.
[0113] Specifically, according to the arrangement positions of the adjacent camera devices, the target edge of the deformed image corresponding to the previous camera device among the adjacent camera devices is determined, and the target edge refers to the adjacent image edges in the deformed image corresponding to the previous camera device and the deformed image corresponding to the next camera device. For example, if the previous camera device is on the left and the next camera device is on the right, then the target edge of the deformed image corresponding to the previous camera device is the right image edge of the deformed image.
[0114] The deformed image is cropped according to the first width, the first offset, and the fusion width. For the deformed image corresponding to the previous camera device in the adjacent camera devices, the cropping process can be performed from the target edge of the deformed image, and the width of the cropped image is determined as the first cropping width. For example, the cropping can be performed from the right side of the deformed image to the left, and the cropping width is the first offset plus half of the fusion width.
[0115] The beneficial effect of such a setting is that the target edge of the deformed image is determined, cropping is started from the target edge, some repeated images are cropped, and information loss caused by cropping useful images in the image is avoided, thereby improving the accuracy of image stitching.
[0116] In this embodiment, according to the image width of the mask image, the deformed image corresponding to the previous camera device in the adjacent camera devices is expanded to obtain the first image, including: according to the image width of the mask image, the deformed image corresponding to the previous camera device in the adjacent camera devices is expanded from the target edge of the deformed image corresponding to the previous camera device in the adjacent camera devices to obtain the first image.
[0117] Specifically, when the deformed image is expanded, it can also be expanded from the target edge. The target edge of the deformed image corresponding to the previous camera device in the adjacent camera devices is determined, and according to the image width of the mask image, the deformed image is expanded outward from the target edge of the deformed image corresponding to the previous camera device, and the part of the deformed image is kept unchanged, and the expanded image is determined as the first image.
[0118] For example, if the target edge of the deformed image of the previous image is the image edge on the right, the deformed image remains unchanged, and a portion of the width is increased to the right starting from the image edge on the right, so that the total width is consistent with the image width of the mask image. The expanded portion is a black image, that is, the left side of the first image is the deformed image, and the right side is a black image.
[0119] The beneficial effect of such a setting is that the expansion starts from the target edge, thus avoiding the destruction of the deformed image, facilitating the subsequent fusion with the mask image, and improving the accuracy of image stitching.
[0120] In this embodiment, a second cropping width is obtained according to the second width, the second offset, and the fusion width, including: determining a target edge of a deformed image corresponding to a rear camera device among the adjacent camera devices according to the arrangement positions of the adjacent camera devices; and cropping the deformed image corresponding to the rear camera device among the adjacent camera devices from the target edge of the deformed image corresponding to the rear camera device among the adjacent camera devices according to the second width, the second offset, and the fusion width to obtain the second cropping width.
[0121] Specifically, according to the arrangement positions of the adjacent camera devices, the target edge of the deformed image corresponding to the next camera device among the adjacent camera devices is determined, and the target edge refers to the adjacent image edges in the deformed image corresponding to the previous camera device and the deformed image corresponding to the next camera device. For example, if the previous camera device is on the left and the next camera device is on the right, the target edge of the deformed image corresponding to the next camera device is the left image edge of the deformed image.
[0122] The deformed image is cropped according to the second width, the second offset, and the fusion width. For the deformed image corresponding to the latter camera device in the adjacent camera devices, the cropping process can be performed from the target edge of the deformed image, and the width of the cropped image is determined as the second cropping width. For example, the cropping can be performed from the left side of the deformed image to the right, and the cropping width is the second offset plus half of the fusion width.
[0123] The beneficial effect of such a setting is that the target edge of the deformed image is determined, cropping is started from the target edge, some repeated images are cropped, and information loss caused by cropping useful images in the image is avoided, thereby improving the accuracy of image stitching.
[0124] In this embodiment, the deformed image corresponding to the latter camera device among the adjacent camera devices is expanded to obtain a second image, including: according to the image width of the mask image, the deformed image corresponding to the latter camera device among the adjacent camera devices is expanded from the target edge of the deformed image corresponding to the latter camera device among the adjacent camera devices to obtain the second image.
[0125] Specifically, when the deformed image is expanded, it can also be expanded from the target edge. The target edge of the deformed image corresponding to the next camera device among the adjacent cameras is determined, and according to the image width of the mask image, the deformed image is expanded outward from the target edge of the deformed image corresponding to the next camera device, while keeping part of the deformed image unchanged, and the expanded image is determined as the second image.
[0126] For example, if the target edge of the deformed image of the latter image is the image edge on the left, the deformed image remains unchanged, and a portion of the width is increased from the image edge on the left to the left, so that the total width is consistent with the image width of the mask image. The expanded portion is a black image, that is, the right side of the second image is the deformed image, and the left side is a black image.
[0127] The beneficial effect of such a setting is that the expansion starts from the target edge, thus avoiding the destruction of the deformed image, facilitating the subsequent fusion with the mask image, and improving the accuracy of image stitching.
[0128] In this embodiment, a mask image is constructed according to a first cropping width and a second cropping width, including: determining a first mask width in the mask image according to the first cropping width and a fusion width, and determining a second mask width in the mask image according to the second cropping width and a fusion width; wherein the first mask width is the first cropping width minus half of the fusion width, and the second mask width is the second cropping width minus half of the fusion width; constructing a mask image according to the first mask width, the second mask width, and the fusion width; wherein, in the mask image, a portion of the first mask width is black, a portion of the second mask width is white, and a portion of the fusion width is a gradient of black and white.
[0129] Specifically, the image corresponding to the first cropping width is determined as the first cropping image, and the image corresponding to the second cropping width is determined as the second cropping image. The fusion width is at the intersection between the first cropping image and the second cropping image. Half of the fusion width is included in the first cropping image, and the other half of the fusion width is included in the second cropping image. The first cropping width and the fusion width are calculated to obtain a first mask width, which is the first cropping width minus half of the fusion width. That is, the portion of the image that is half of the fusion width is removed from the first cropping image. The second cropping width and the fusion width are calculated to obtain a second mask width, which is the second cropping width minus half of the fusion width. That is, the portion of the image that is the other half of the fusion width is removed from the first cropping image. The first mask width is The second mask width is
[0130] The image of the first mask width in the deformed image corresponding to the previous camera device is set to black, the image of the second mask width in the deformed image corresponding to the next camera device is set to white, and the image of the fusion width between the first mask width and the second mask width is set to black and white gradient color. According to the arrangement order of the cameras, a mask image from black to white or from white to black is constructed. For example, if the previous camera device is on the left and the next camera device is on the right, the left side of the mask image is black, the middle is black and white gradient color, and the right side is white.
[0131] The beneficial effect of such a setting is that a black and white Mask image is constructed to facilitate subsequent image fusion and ensure the coherence of the target image.
[0132] In this embodiment, the target image is represented as:
[0133] Result=I , 1×(1-Mask)+I , 2×Mask;
[0134] Among them, Result represents the target image, Mask represents the mask image, and I , 1 represents the first image, I , 2 represents the second image.
[0135] Specifically, the pixel value of each position in the first image is determined, the pixel value of the corresponding position in the second image is determined, and the pixel value of the corresponding position in the mask image is determined. Substituting these three pixel values into the above formula, the calculation result is the pixel value of the position in the target image, thereby obtaining a complete target image.
[0136] The beneficial effect of such a setting is that pixel-by-pixel multiplication is performed according to a preset formula, and the obtained Result is the pixel value at each position, that is, the target image is obtained, thereby improving the determination accuracy and efficiency of the target image.
[0137] Figure 6a is a schematic diagram of the first image, Figure 6b is a schematic diagram of the second image. The front camera device is located on the left side of the rear camera device. Therefore, the right side of the first image is a black image, and the left side of the second image is a black image. The image widths of the first image and the second image are the same. The first image and the second image include a repeated area. Figure 6a and Figure 6b In the figure, the slashed part is the repeated area, and the width of the area is the fusion width. Figure 7 is a schematic diagram of the mask image. In the mask image, the part corresponding to the diagonal line is black and white gradient, corresponding to the first image Part is black, corresponding to the second image Partially white.
[0138] In the disclosed embodiment, multiple cameras are placed underwater to obtain images captured by each of the adjacent cameras in real time. The images captured by each of the adjacent cameras are deformed to obtain a deformed image corresponding to the camera, thereby avoiding the situation where the images captured by different cameras are not aligned with each other. The deformed images corresponding to each of the adjacent cameras are then spliced to obtain a target image, so that the target image can represent the scene in the image captured by the previous camera in the adjacent camera and the scene in the image captured by the next camera in the adjacent camera, thereby achieving panoramic shooting of the underwater scene. By deforming and splicing, the problem of discontinuous splicing in the related art is solved, the accuracy of image splicing is improved, and the target image presents a coherent and natural effect, providing users with a clearer and more realistic picture and improving the user's viewing experience.
[0139] Figure 8 This is a structural block diagram of an image stitching device provided by an embodiment of the present disclosure. The device is applied to a processor, and the processor is connected to a plurality of camera devices connected in series for communication. For ease of description, only the parts related to the embodiment of the present disclosure are shown. Figure 8 The image stitching device 800 includes: an image acquisition unit 801, a deformation unit 802 and a stitching unit 803.
[0140] An image acquisition unit 801 is used to acquire an image captured by each of the adjacent camera devices;
[0141] A deformation unit 802 is used to perform deformation processing on the image captured by each camera device in the adjacent camera devices to obtain a deformed image corresponding to the camera device; wherein the deformation processing is used to change the position of the pixel points in the image;
[0142] The stitching unit 803 is used to stitch the deformed images corresponding to each camera device in the adjacent camera devices to obtain a target image; wherein the target image includes the scene in the image captured by the previous camera device in the adjacent camera devices and the scene in the image captured by the next camera device in the adjacent camera devices.
[0143] Fig. 9 A structural block diagram of an image stitching device provided in an embodiment of the present disclosure, such as Fig. 9 As shown, the image stitching device 900 includes an image acquisition unit 901 , a deformation unit 902 and a stitching unit 903 , wherein the deformation unit 902 includes an operator determination module 9021 and a deformation processing module 9022 .
[0144] An operator determination module 9021 is used to respectively determine a deformation operator corresponding to each of the adjacent camera devices; wherein the deformation operator is a function for performing deformation processing;
[0145] The deformation processing module 9022 is used to perform deformation processing on the image captured by each camera device in the adjacent camera devices according to the deformation operator to obtain a deformed image corresponding to the camera device.
[0146] In one example, the deformation processing module 9022 includes:
[0147] A current position determination submodule, used to determine the coordinate position of a pixel point in the image captured by each of the adjacent camera devices, and use the coordinate position as the current position;
[0148] A target position determination submodule, used to determine the target position corresponding to the current position according to the deformation operator; wherein the target position represents the coordinate position of the pixel point in the deformation image;
[0149] The deformable image determining submodule is used to determine the deformable image corresponding to the camera device according to the target position of the pixel point.
[0150] In one example, the deformation operator corresponding to the previous camera device among the adjacent camera devices is a first operator, and the deformation operator corresponding to the next camera device among the adjacent camera devices is a second operator; the deformation processing module 9022 includes:
[0151] A first deformation submodule is used to perform deformation processing on the image captured by the previous camera device among the adjacent camera devices according to the first operator to obtain a deformed image corresponding to the previous camera device among the adjacent camera devices; and
[0152] The second deformation submodule is used to perform deformation processing on the image captured by the latter camera device among the adjacent camera devices according to the second operator to obtain a deformed image corresponding to the latter camera device among the adjacent camera devices.
[0153] In one example, it also includes:
[0154] A history acquisition unit, used to acquire the historical images captured by each of the adjacent camera devices;
[0155] A position determination unit, used to determine a first position and a second position confirmed by a user on the historical image through a preset visual interface; wherein the first position represents a coordinate position of a pixel point before deformation, and the second position represents a coordinate position of a pixel point after deformation;
[0156] An operator storage unit is used to determine the deformation operator corresponding to each camera device in the adjacent cameras according to the first position and the second position, and associate and store each camera device in the adjacent cameras with the corresponding deformation operator; wherein the deformation operator corresponding to each camera device in the adjacent cameras is used to transfer the coordinate position of the pixel point from the first position to the second position.
[0157] In one example, there are overlapping areas between the images captured by the adjacent camera devices; the stitching unit 903 includes:
[0158] an overlap determination module, used to obtain a width of an overlap area between a deformed image corresponding to a previous camera device among the adjacent camera devices and a deformed image corresponding to a subsequent camera device among the adjacent camera devices; wherein the width of the overlap area includes a first offset, a second offset, and a fusion width, wherein the first offset represents a width of the deformed image corresponding to the previous camera device among the adjacent camera devices that needs to be cropped, the second offset represents a width of the deformed image corresponding to the subsequent camera device among the adjacent camera devices that needs to be cropped, and the fusion width represents a width of a transition portion between two images when the images are stitched;
[0159] The image stitching module is used to stitch the deformed image corresponding to the previous camera device among the adjacent camera devices and the deformed image corresponding to the next camera device among the adjacent camera devices according to the width of the overlapping area to obtain the target image.
[0160] In one example, the image stitching module includes:
[0161] a width acquisition submodule, configured to acquire an image width of a deformed image corresponding to a preceding camera device among the adjacent camera devices, which is a first width, and to acquire an image width of a deformed image corresponding to a succeeding camera device among the adjacent camera devices, which is a second width;
[0162] a cropping submodule, configured to obtain a first cropping width according to the first width, the first offset, and the blending width, and to obtain a second cropping width according to the second width, the second offset, and the blending width; wherein the first cropping width is the first width minus the first offset, minus half of the blending width, and the second cropping width is the second width minus the second offset, minus half of the blending width;
[0163] An image construction submodule, configured to construct a mask image according to the first cropping width and the second cropping width; wherein the width of the mask image is the first cropping width plus the second cropping width;
[0164] an image expansion submodule, configured to expand the deformed image corresponding to the previous camera device among the adjacent camera devices according to the image width of the mask image to obtain a first image, and to expand the deformed image corresponding to the next camera device among the adjacent camera devices to obtain a second image; wherein the image widths of the first image, the second image, and the mask image are the same, and the expanded parts of the first image and the second image are black;
[0165] The target acquisition submodule is used to obtain the target image according to the first image, the second image, and the mask image.
[0166] In one example, the clipping submodule is specifically used to:
[0167] Determine, according to the arrangement positions of the adjacent camera devices, a target edge of the deformed image corresponding to the preceding camera device among the adjacent camera devices; wherein the target edge represents an adjacent image edge in the deformed image corresponding to the preceding camera device and the deformed image corresponding to the succeeding camera device;
[0168] The deformed image corresponding to the previous camera device among the adjacent camera devices is cropped from the target edge of the deformed image corresponding to the previous camera device among the adjacent camera devices according to the first width, the first offset, and the fusion width to obtain the first cropping width.
[0169] In one example, the image expansion submodule is specifically used to:
[0170] According to the image width of the mask image, the deformed image corresponding to the previous camera device among the adjacent camera devices is expanded from the target edge of the deformed image corresponding to the previous camera device among the adjacent camera devices to obtain the first image.
[0171] In one example, the clipping submodule is specifically used to:
[0172] Determining, according to the arrangement positions of the adjacent camera devices, a target edge of the deformed image corresponding to a rear camera device among the adjacent camera devices;
[0173] According to the second width, the second offset, and the fusion width, the deformed image corresponding to the latter camera device among the adjacent camera devices is cropped from the target edge of the deformed image corresponding to the latter camera device among the adjacent camera devices to obtain the second cropping width.
[0174] In one example, the image expansion submodule is specifically used to:
[0175] According to the image width of the mask image, the deformed image corresponding to the latter camera device among the adjacent camera devices is expanded from the target edge of the deformed image corresponding to the latter camera device among the adjacent camera devices to obtain the second image.
[0176] In one example, the image construction submodule is specifically used to:
[0177] Determining a first mask width in the mask image according to the first cropping width and the fusion width, and determining a second mask width in the mask image according to the second cropping width and the fusion width; wherein the first mask width is the first cropping width minus half of the fusion width, and the second mask width is the second cropping width minus half of the fusion width;
[0178] The mask image is constructed according to the first mask width, the second mask width, and the fusion width; wherein the portion of the first mask width in the mask image is black, the portion of the second mask width is white, and the portion of the fusion width is a black-white gradient color.
[0179] In an example, the target image is represented as:
[0180] Result=I , 1×(1-Mask)+I , 2×Mask;
[0181] Among them, Result represents the target image, Mask represents the mask image, and I , 1 represents the first image, I , 2 represents the second image.
[0182] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device.
[0183] Fig.10 This is a structural block diagram of an electronic device provided in an embodiment of the present disclosure. The electronic device may be a terminal device, a processor or a server. Fig.10 As shown, the electronic device 1000 includes: at least one processor 1002; and a memory 1001 communicatively connected to the at least one processor 1002; wherein the memory stores instructions executable by the at least one processor 1002, and the instructions are executed by the at least one processor 1002 so that the at least one processor 1002 can perform the image stitching method disclosed in the present invention.
[0184] The electronic device 1000 further includes a receiver 1003 and a transmitter 1004. The receiver 1003 is used to receive instructions and data sent by other devices, and the transmitter 1004 is used to send instructions and data to external devices.
[0185] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0186] According to an embodiment of the present disclosure, the present disclosure also provides a computer program product, which includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.
[0187] Fig.11 A schematic block diagram of an example electronic device 1100 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0188] like Fig.11 As shown, the device 1100 includes a computing unit 1101, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1102 or a computer program loaded from a storage unit 1108 into a random access memory (RAM) 1103. In the RAM 1103, various programs and data required for the operation of the device 1100 can also be stored. The computing unit 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.
[0189] A number of components in the device 1100 are connected to the I / O interface 1105, including: an input unit 1106, such as a keyboard, a mouse, etc.; an output unit 1107, such as various types of displays, speakers, etc.; a storage unit 1108, such as a disk, an optical disk, etc.; and a communication unit 1109, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1109 allows the device 1100 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0190] The computing unit 1101 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1101 performs the various methods and processes described above, such as the method of image stitching. For example, in some embodiments, the method of image stitching may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 1108. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1100 via the ROM 1102 and / or the communication unit 1109. When the computer program is loaded into the RAM 1103 and executed by the computing unit 1101, one or more steps of the method of image stitching described above may be performed. Alternatively, in other embodiments, the computing unit 1101 may be configured to perform the image stitching method in any other appropriate manner (for example, by means of firmware).
[0191] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0192] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0193] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0194] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0195] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0196] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0197] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0198] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for image stitching, the method being applied to a processor, the processor being communicatively connected to a plurality of camera devices connected in series, the method include: Acquire an image captured by each of the adjacent camera devices; Performing deformation processing on the image captured by each of the adjacent camera devices to obtain a deformed image corresponding to the camera device; wherein the deformation processing is used to change the position of the pixel points in the image; The deformed images corresponding to each camera device in the adjacent camera devices are stitched together to obtain a target image; wherein the target image includes a scene in an image captured by a previous camera device in the adjacent camera devices and a scene in an image captured by a subsequent camera device in the adjacent camera devices.
2. The method according to claim 1, in, The step of performing deformation processing on the image captured by each of the adjacent camera devices to obtain a deformed image corresponding to the camera device includes: Determine respectively a deformation operator corresponding to each of the adjacent camera devices; wherein the deformation operator is a function for performing deformation processing; According to the deformation operator, deformation processing is performed on the image captured by each of the adjacent camera devices to obtain a deformed image corresponding to the camera device.
3. The method according to claim 2, in, The step of performing deformation processing on the image captured by each of the adjacent camera devices according to the deformation operator to obtain a deformed image corresponding to the camera device includes: Determine the coordinate position of a pixel point in the image captured by each of the adjacent camera devices, and use the coordinate position as the current position; Determine a target position corresponding to the current position according to the deformation operator; wherein the target position represents the coordinate position of the pixel point in the deformation image; According to the target position of the pixel point, a deformation image corresponding to the camera device is determined.
4. The method according to claim 2 or 3, in, The deformation operator corresponding to the previous camera device among the adjacent camera devices is a first operator, and the deformation operator corresponding to the next camera device among the adjacent camera devices is a second operator; the image captured by each camera device among the adjacent camera devices is deformed according to the deformation operator to obtain a deformed image corresponding to the camera device, including: According to the first operator, a deformation process is performed on the image captured by the previous camera device among the adjacent camera devices to obtain a deformed image corresponding to the previous camera device among the adjacent camera devices; and According to the second operator, deformation processing is performed on the image captured by the latter camera device among the adjacent camera devices to obtain a deformed image corresponding to the latter camera device among the adjacent camera devices.
5. The method according to any one of claims 2 to 4, further comprising: include: Acquire historical images captured by each of the adjacent camera devices; Determine, through a preset visualization interface, a first position and a second position confirmed by a user on the historical image; wherein the first position represents a coordinate position of a pixel point before deformation, and the second position represents a coordinate position of a pixel point after deformation; According to the first position and the second position, the deformation operator corresponding to each camera device in the adjacent camera devices is determined, and each camera device in the adjacent camera devices and the corresponding deformation operator are associated and stored; wherein the deformation operator corresponding to each camera device in the adjacent camera devices is used to transfer the coordinate position of the pixel point from the first position to the second position.
6. The method according to any one of claims 1 to 5, in, There is an overlapping area between the images captured by each of the adjacent camera devices; and the step of splicing the deformed images corresponding to each of the adjacent camera devices to obtain the target image includes: Obtaining a width of an overlapping area between a deformed image corresponding to a previous camera device among the adjacent camera devices and a deformed image corresponding to a subsequent camera device among the adjacent camera devices; wherein the width of the overlapping area includes a first offset, a second offset, and a fusion width, wherein the first offset represents a width of the deformed image corresponding to the previous camera device among the adjacent camera devices that needs to be cropped, the second offset represents a width of the deformed image corresponding to the subsequent camera device among the adjacent camera devices that needs to be cropped, and the fusion width represents a width of a transition portion between two images when the images are stitched; According to the width of the overlapping area, the deformed image corresponding to the previous camera device among the adjacent camera devices and the deformed image corresponding to the next camera device among the adjacent camera devices are spliced to obtain the target image.
7. The method according to claim 6, in, The step of performing splicing processing on the deformed image corresponding to the previous camera device among the adjacent camera devices and the deformed image corresponding to the next camera device among the adjacent camera devices according to the width of the overlapping area to obtain the target image includes: Acquire an image width of a deformed image corresponding to a preceding camera device among the adjacent camera devices as a first width, and acquire an image width of a deformed image corresponding to a succeeding camera device among the adjacent camera devices as a second width; A first cropping width is obtained according to the first width, the first offset, and the blending width, and a second cropping width is obtained according to the second width, the second offset, and the blending width; wherein the first cropping width is the first width minus the first offset, minus half of the blending width, and the second cropping width is the second width minus the second offset, minus half of the blending width; Constructing a mask image according to the first cropping width and the second cropping width; wherein the width of the mask image is the sum of the first cropping width and the second cropping width; According to the image width of the mask image, the deformed image corresponding to the previous camera device among the adjacent camera devices is expanded to obtain a first image, and the deformed image corresponding to the next camera device among the adjacent camera devices is expanded to obtain a second image; wherein the image widths of the first image, the second image, and the mask image are the same, and the expanded parts of the first image and the second image are black; The target image is obtained according to the first image, the second image, and the mask image.
8. The method according to claim 7, in, The obtaining of a first cropping width according to the first width, the first offset, and the blending width includes: Determine, according to the arrangement positions of the adjacent camera devices, a target edge of the deformed image corresponding to the preceding camera device among the adjacent camera devices; wherein the target edge represents an adjacent image edge in the deformed image corresponding to the preceding camera device and the deformed image corresponding to the succeeding camera device; The deformed image corresponding to the previous camera device among the adjacent camera devices is cropped from the target edge of the deformed image corresponding to the previous camera device among the adjacent camera devices according to the first width, the first offset, and the fusion width to obtain the first cropping width.
9. The method according to claim 8, in, The method of expanding the deformed image corresponding to the previous camera device among the adjacent camera devices according to the image width of the mask image to obtain the first image includes: According to the image width of the mask image, the deformed image corresponding to the previous camera device among the adjacent camera devices is expanded from the target edge of the deformed image corresponding to the previous camera device among the adjacent camera devices to obtain the first image.
10. The method according to claim 8 or 9, in, The obtaining of the second cropping width according to the second width, the second offset, and the blending width includes: Determining, according to the arrangement positions of the adjacent camera devices, a target edge of the deformed image corresponding to a subsequent camera device among the adjacent camera devices; According to the second width, the second offset, and the fusion width, the deformed image corresponding to the latter camera device among the adjacent camera devices is cropped from the target edge of the deformed image corresponding to the latter camera device among the adjacent camera devices to obtain the second cropping width.
11. The method according to claim 10, in, The step of expanding the deformed image corresponding to the latter camera device among the adjacent camera devices to obtain a second image includes: According to the image width of the mask image, the deformed image corresponding to the latter camera device among the adjacent camera devices is expanded from the target edge of the deformed image corresponding to the latter camera device among the adjacent camera devices to obtain the second image.
12. The method according to any one of claims 7 to 11, in, The step of constructing a mask image according to the first cropping width and the second cropping width includes: Determining a first mask width in the mask image according to the first cropping width and the fusion width, and determining a second mask width in the mask image according to the second cropping width and the fusion width; wherein the first mask width is the first cropping width minus half of the fusion width, and the second mask width is the second cropping width minus half of the fusion width; The mask image is constructed according to the first mask width, the second mask width, and the fusion width; wherein the portion of the first mask width in the mask image is black, the portion of the second mask width is white, and the portion of the fusion width is a black-white gradient color.
13. The method according to claim 12, in, The target image is represented as: Result=I , 1 ×(1-Mask)+I , 2 ×Mask; Among them, Result represents the target image, Mask represents the mask image, and I , 1 Characterize the first image, I , 2 Characterize the second image.
14. An image stitching device, the device is applied to a processor, the processor is connected to a plurality of camera devices connected in series, the device include: An image acquisition unit, used to acquire an image captured by each of the adjacent camera devices; A deformation unit, used for performing deformation processing on the image captured by each of the adjacent camera devices to obtain a deformed image corresponding to the camera device; wherein the deformation processing is used to change the position of the pixel points in the image; A stitching unit is used to stitch the deformed images corresponding to each camera device in the adjacent camera devices to obtain a target image; wherein the target image includes the scene in the image captured by the previous camera device in the adjacent camera devices and the scene in the image captured by the next camera device in the adjacent camera devices.
15. The device according to claim 14, in, The deformation unit comprises: An operator determination module, used to respectively determine a deformation operator corresponding to each of the adjacent camera devices; wherein the deformation operator is a function for performing deformation processing; The deformation processing module is used to perform deformation processing on the image captured by each camera device in the adjacent camera devices according to the deformation operator to obtain a deformed image corresponding to the camera device.
16. The device according to claim 15, in, The deformation processing module comprises: A current position determination submodule, used to determine the coordinate position of a pixel point in the image captured by each of the adjacent camera devices, and use the coordinate position as the current position; A target position determination submodule, used to determine the target position corresponding to the current position according to the deformation operator; wherein the target position represents the coordinate position of the pixel point in the deformation image; The deformable image determining submodule is used to determine the deformable image corresponding to the camera device according to the target position of the pixel point.
17. The device according to claim 15 or 16, in, The deformation operator corresponding to the previous camera device among the adjacent camera devices is a first operator, and the deformation operator corresponding to the next camera device among the adjacent camera devices is a second operator; the deformation processing module includes: A first deformation submodule is used to perform deformation processing on the image captured by the previous camera device among the adjacent camera devices according to the first operator to obtain a deformed image corresponding to the previous camera device among the adjacent camera devices; and The second deformation submodule is used to perform deformation processing on the image captured by the latter camera device among the adjacent camera devices according to the second operator to obtain a deformed image corresponding to the latter camera device among the adjacent camera devices.
18. The device according to any one of claims 15 to 17, further comprising: include: A history acquisition unit, used to acquire the historical images captured by each of the adjacent camera devices; A position determination unit, used to determine a first position and a second position confirmed by a user on the historical image through a preset visual interface; wherein the first position represents a coordinate position of a pixel point before deformation, and the second position represents a coordinate position of a pixel point after deformation; An operator storage unit is used to determine the deformation operator corresponding to each camera device in the adjacent cameras according to the first position and the second position, and associate and store each camera device in the adjacent cameras with the corresponding deformation operator; wherein the deformation operator corresponding to each camera device in the adjacent cameras is used to transfer the coordinate position of the pixel point from the first position to the second position.
19. The device according to any one of claims 14 to 18, in, There are overlapping areas between the images captured by each of the adjacent camera devices; The splicing unit comprises: an overlap determination module, used to obtain a width of an overlap area between a deformed image corresponding to a previous camera device among the adjacent camera devices and a deformed image corresponding to a subsequent camera device among the adjacent camera devices; wherein the width of the overlap area includes a first offset, a second offset, and a fusion width, wherein the first offset represents a width of the deformed image corresponding to the previous camera device among the adjacent camera devices that needs to be cropped, the second offset represents a width of the deformed image corresponding to the subsequent camera device among the adjacent camera devices that needs to be cropped, and the fusion width represents a width of a transition portion between two images when the images are stitched; The image stitching module is used to stitch the deformed image corresponding to the previous camera device among the adjacent camera devices and the deformed image corresponding to the next camera device among the adjacent camera devices according to the width of the overlapping area to obtain the target image.
20. The device according to claim 19, in, The image stitching module comprises: a width acquisition submodule, configured to acquire an image width of a deformed image corresponding to a preceding camera device among the adjacent camera devices, which is a first width, and to acquire an image width of a deformed image corresponding to a succeeding camera device among the adjacent camera devices, which is a second width; a cropping submodule, configured to obtain a first cropping width according to the first width, the first offset, and the blending width, and to obtain a second cropping width according to the second width, the second offset, and the blending width; wherein the first cropping width is the first width minus the first offset, minus half of the blending width, and the second cropping width is the second width minus the second offset, minus half of the blending width; An image construction submodule, configured to construct a mask image according to the first cropping width and the second cropping width; wherein the width of the mask image is the first cropping width plus the second cropping width; an image expansion submodule, configured to expand the deformed image corresponding to the previous camera device among the adjacent camera devices according to the image width of the mask image to obtain a first image, and to expand the deformed image corresponding to the next camera device among the adjacent camera devices to obtain a second image; wherein the image widths of the first image, the second image, and the mask image are the same, and the expanded parts of the first image and the second image are black; The target acquisition submodule is used to obtain the target image according to the first image, the second image, and the mask image.
21. The device according to claim 20, in, The cutting submodule is specifically used for: Determine, according to the arrangement positions of the adjacent camera devices, a target edge of the deformed image corresponding to the preceding camera device among the adjacent camera devices; wherein the target edge represents an adjacent image edge in the deformed image corresponding to the preceding camera device and the deformed image corresponding to the succeeding camera device; The deformed image corresponding to the previous camera device among the adjacent camera devices is cropped from the target edge of the deformed image corresponding to the previous camera device among the adjacent camera devices according to the first width, the first offset, and the fusion width to obtain the first cropping width.
22. The device according to claim 21, in, The image expansion submodule is specifically used for: According to the image width of the mask image, the deformed image corresponding to the previous camera device among the adjacent camera devices is expanded from the target edge of the deformed image corresponding to the previous camera device among the adjacent camera devices to obtain the first image.
23. The device according to claim 21 or 22, in, The cutting submodule is specifically used for: Determining, according to the arrangement positions of the adjacent camera devices, a target edge of the deformed image corresponding to a subsequent camera device among the adjacent camera devices; According to the second width, the second offset, and the fusion width, the deformed image corresponding to the latter camera device among the adjacent camera devices is cropped from the target edge of the deformed image corresponding to the latter camera device among the adjacent camera devices to obtain the second cropping width.
24. The device according to claim 23, in, The image expansion submodule is specifically used for: According to the image width of the mask image, the deformed image corresponding to the latter camera device among the adjacent camera devices is expanded from the target edge of the deformed image corresponding to the latter camera device among the adjacent camera devices to obtain the second image.
25. The device according to any one of claims 20 to 24, in, The image construction submodule is specifically used for: Determining a first mask width in the mask image according to the first cropping width and the fusion width, and determining a second mask width in the mask image according to the second cropping width and the fusion width; wherein the first mask width is the first cropping width minus half of the fusion width, and the second mask width is the second cropping width minus half of the fusion width; The mask image is constructed according to the first mask width, the second mask width, and the fusion width; wherein the portion of the first mask width in the mask image is black, the portion of the second mask width is white, and the portion of the fusion width is a black-white gradient color.
26. The device according to claim 25, in, The target image is represented as: Result=I , 1 ×(1-Mask)+I , 2 ×Mask; Among them, Result represents the target image, Mask represents the mask image, and I , 1 Characterize the first image, I , 2 Characterize the second image.
27. An electronic device, include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 13.
28. A non-transitory computer-readable storage medium storing computer instructions, in, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-13.
29. A computer program product, in, The invention comprises a computer program, which implements the steps of the method according to any one of claims 1 to 13 when being executed by a processor.
