Method, system and device for generating panoramic image through single image and medium
By performing a three-part perspective transformation and coordinate mapping on a single image, a panoramic image is generated, which solves the problems of complex processes and high costs in existing panoramic image generation technologies. This achieves high-quality, low-cost panoramic image generation and provides an immersive browsing experience.
Patent Information
- Application Number
- CN202510912283.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-03
- Publication Date
- 2025-10-17
AI Technical Summary
Existing panoramic image generation technologies suffer from problems such as high shooting costs, complex operation, obvious stitching gaps, high computational costs, high hardware requirements, and inconsistencies between the generated additional scenes and the original images.
By performing a three-part perspective transformation on a single image, the target extended space is determined. The mapping relationship between polar coordinates and Cartesian coordinates is used, combined with a linear mapping algorithm to generate a panoramic image, simplifying the process, preserving the original image texture and lighting, and reducing hardware requirements.
It enables panoramic unfolding of a single image, simplifies the shooting process, improves the quality and realism of panoramic images, reduces hardware costs and computational complexity, and provides an immersive two-dimensional panoramic browsing experience.
Smart Images

Figure CN120807685A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of image processing, and particularly relates to a single-image panoramic image generation method, system, device and medium. BACKGROUND
[0002] With the rapid development of computer graphics and image processing technology, panoramic images are increasingly widely used in virtual reality, augmented reality, film special effects, digital twin and many other fields. Panoramic images can provide users with immersive visual experiences and play an important role in various fields.
[0003] However, the traditional panoramic image acquisition method is usually obtained by splicing multiple images after shooting, which has many disadvantages. The shooting cost is high, the operation is complex, and cumulative errors are prone to occur during splicing, resulting in obvious splicing gaps, which seriously affects the overall quality and visual effect of the panoramic image. Although single-image panoramic technology has gradually emerged in recent years, the existing technology still has shortcomings. For example, multi-image fusion panoramic technology requires multiple image inputs, and the shooting process is tedious; single-image automatic generation of additional scene splicing technology may not be consistent in texture, lighting, etc. when processing complex scenes, and the naturalness and realism are lacking, and the calculation cost is high, requiring high hardware devices; three-dimensional reconstruction technology based on a single panoramic image mainly focuses on three-dimensional scene reconstruction, which requires a large amount of computing resources and complex algorithm support during processing.
[0004] In summary, the problems in the prior art need to be solved. SUMMARY
[0005] The present application provides a single-image panoramic image generation method, system, device and medium, aiming to simplify the generation process of panoramic images, improve the quality of panoramic images, enhance the naturalness and realism of the generated effect, improve the calculation efficiency, realize the panoramic expansion of a single image, and provide users with a more convenient, efficient and high-quality panoramic image browsing experience.
[0006] The present application provides a single-image panoramic image generation method, comprising:
[0007] obtaining a to-be-processed image;
[0008] segmenting the to-be-processed image into at least two image regions along a preset direction, performing geometric transformation on the image regions, and generating transformed regions;
[0009] determining a target expansion space based on the feature parameters of the transformed regions, and mapping the transformed regions to the target expansion space;
[0010] A mapping relationship between the source coordinate system and the target coordinate system is established, and pixel points in the target extended space are mapped from the source coordinate system to the target coordinate system based on a preset mapping rule.
[0011] The processed image regions are integrated to generate a panoramic image.
[0012] According to the single-image panoramic image generation method provided in the application, the geometric transformation comprises:
[0013] The selected image region is processed by three equal divisions, and perspective transformation is performed based on the middle equal division region to generate a transformed region.
[0014] According to the single-image panoramic image generation method provided in the application, the target extended space is determined based on the feature parameters of the transformed region, and specifically comprises:
[0015] The feature parameters comprise image width, image height, fan center position and fan radius, wherein the fan center position is the intersection point of the upper and lower radial rays after perspective transformation.
[0016] According to the fan radius, a vertical direction expansion pixel value is calculated, and the transformed region is mapped to a fan-shaped space corresponding to the vertically expanded pixel.
[0017] According to the single-image panoramic image generation method provided in the application, the mapping relationship between the source coordinate system and the target coordinate system is established, and specifically comprises:
[0018] The pixel mapping is performed by using a polar coordinate system, the polar coordinate length from the target pixel to the fan center position is calculated, and the target radian is determined based on the polar coordinate system.
[0019] The source radian is calculated based on the radian proportion before and after fan-shaped expansion, the polar coordinate system is converted into a Cartesian coordinate system, and the source pixel position is obtained.
[0020] The value of the source pixel position is mapped to the target pixel position by using a backward mapping mode.
[0021] According to the single-image panoramic image generation method provided in the application, after the transformed region is mapped to the target extended space, the method further comprises:
[0022] The mapped image is subjected to rotation transformation, the image is processed row by row, and the effective pixel is mapped to the whole row pixel range by using a linear mapping algorithm, so that horizontal extension is realized.
[0023] According to the single-image panoramic image generation method provided in the application, the calculation mode of the target radian is:
[0024] dDstRadians = atan ((nY-row) / (nX-col));
[0025] wherein row is the row coordinate of the target pixel, col is the column coordinate of the target pixel, and (nX, nY) is the coordinate of the intersection point of the upper and lower edge rays after perspective transformation.
[0026] According to the single-image panoramic image generation method provided by the application, the linear mapping algorithm specifically comprises the following steps.
[0027] determining a first coordinate interval of the source pixel region in the target mapping dimension and a second coordinate interval of the target mapping region;
[0028] establishing a mapping function of pixel coordinates based on the linear proportional relationship between the first coordinate interval and the second coordinate interval, and mapping any point in the source pixel region to a corresponding position of the target mapping region.
[0029] The application further provides a single-image panoramic image generation device, which comprises the following components.
[0030] an image acquisition module, configured to acquire a to-be-processed image;
[0031] a region processing module, configured to split the to-be-processed image into at least two image regions along a preset direction, and perform geometric transformation on the image regions to generate transformed regions;
[0032] a space expansion module, configured to determine a target expansion space based on feature parameters of the transformed regions, and map the transformed regions to the target expansion space;
[0033] a coordinate mapping module, configured to establish a mapping relationship between a source coordinate system and a target coordinate system, and map pixel points in the target expansion space from the source coordinate system to the target coordinate system based on a preset mapping rule;
[0034] an image integration module, configured to integrate the processed image regions to generate a panoramic image.
[0035] The application further provides an electronic device, which comprises a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor implements the single-image panoramic image generation method according to any one of the above-mentioned methods when executing the program.
[0036] The application further provides a non-transitory computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the single-image panoramic image generation method according to any one of the above-mentioned methods.
[0037] The single-image panoramic image generation method, system, device and medium provided by the application, through three-perspective transformation of the selected area, determine the target expansion space based on the characteristic parameters of the transformed area, establish the coordinate mapping relationship by using the polar coordinate system combined with the Cartesian coordinate backward mapping, realize the horizontal extension through the linear mapping algorithm, and finally integrate to generate a panoramic image. This process can complete the panoramic processing with only one image, simplifying the shooting process and reducing the cost; avoiding the cumulative error of multi-image stitching, improving the quality of panoramic image; through perspective transformation and accurate coordinate mapping, the original image texture and lighting are preserved, enhancing the naturalness and realism; by following the historical calculation results, the calculation efficiency is improved and the hardware requirements are reduced; realizing the panoramic expansion of a single image, providing an immersive two-dimensional panoramic browsing experience for users. BRIEF DESCRIPTION OF DRAWINGS
[0038] In order to more clearly illustrate the technical solutions of the present application, the following will briefly introduce the drawings needed in the embodiments. Obviously, the drawings described below are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0039] Figure 1 is a flowchart of a single-image panoramic image generation method provided by the application;
[0040] Figure 2 is a structural diagram of a single-image panoramic image generation device provided by the application;
[0041] Figure 3 is a structural diagram of an electronic device provided by the application; DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solutions and advantages of the present application more clear, the following will further describe the present application in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application. In addition, the technical features involved in each embodiment of the application described below can be combined with each other as long as they do not conflict with each other.
[0043] With the rapid development of computer graphics and image processing technology, panoramic images are increasingly widely used in virtual reality, augmented reality, film special effects, digital twin and many other fields. Panoramic images can provide users with an immersive visual experience and play an important role in various fields.
[0044] However, the traditional panoramic image acquisition method is usually obtained by splicing multiple images, which has many disadvantages. The shooting cost is high, the operation is complex, and the cumulative error is easy to occur in the splicing process, which leads to obvious splicing gap, seriously affecting the overall quality and visual effect of the panoramic image. Although the single-image panoramic technology has gradually emerged in recent years, the existing technology still has shortcomings. For example, the multi-image fusion panoramic technology needs multiple image inputs, and the shooting process is complicated; the single-image automatic generation of additional scene splicing technology may not be consistent in texture, lighting, etc. when processing complex scenes, the naturalness and realism are lacking, and the calculation cost is high, which requires high hardware devices; the new view synthesis three-dimensional reconstruction technology based on a single panoramic image mainly focuses on three-dimensional scene reconstruction, which requires a large amount of calculation resources and complex algorithm support in the processing process.
[0045] In order to solve the problems in the prior art, the present application provides a single-image panoramic image generation method, which aims to simplify the generation process of panoramic images, improve the quality of panoramic images, improve the naturalness and realism of the generation effect, improve the calculation efficiency, realize the panoramic expansion of a single image, and provide users with more convenient, efficient and high-quality panoramic image browsing experience, such as Figure 1 as shown, including but not limited to the following steps:
[0046] Step 110, acquiring an image to be processed;
[0047] Step 120, dividing the image to be processed into at least two image regions along a predetermined direction, performing geometric transformation on the image regions, and generating transformed regions.
[0048] Step 130, determining a target expansion space based on the feature parameters of the transformed regions, and mapping the transformed regions to the target expansion space.
[0049] Step 140, establishing a mapping relationship between a source coordinate system and a target coordinate system, and mapping the pixel points in the target expansion space from the source coordinate system to the target coordinate system based on a predetermined mapping rule.
[0050] Step 150, integrating the processed image regions to generate a panoramic image.
[0051] In this embodiment, the present application only needs a single image to complete the panoramic processing, without the need for multiple devices or multiple angle shooting to obtain materials, avoiding the complex shooting preparation and scene synchronization requirement in traditional panoramic splicing, greatly simplifying the operation process. At the same time, it reduces the dependence on professional shooting equipment, reduces the hardware investment and labor cost; through perspective transformation and accurate coordinate mapping, the texture, lighting and color information of the original image are effectively preserved, avoiding the loss of details caused by pixel fusion in traditional splicing, making the panoramic image more realistic and natural.
[0052] Further optional embodiments, the geometric transformation, comprising:
[0053] The selected image region is processed by three equal parts, and the perspective transformation is performed based on the middle equal part region to generate the transformed region.
[0054] In the embodiments of the present application, after inputting the picture to be processed, the image is evenly divided into left and right parts along the vertical direction, preparing for subsequent processing of the left and right parts. The left half of the image is kept unchanged, and the right half of the image is subjected to perspective transformation. The specific operation is to divide the right half of the image into three equal parts, take the middle part as the new right half, and generate a target rectangle based on it. After determining the target rectangle, the getPerspectiveTransform method of OpenCV is called to complete the perspective transformation, thereby realizing the preliminary adjustment of the right half of the image and laying a foundation for subsequent extension operation.
[0055] It can be understood that perspective transformation is a geometric transformation that projects an image from one perspective to another perspective, and is commonly used in scenarios such as correcting perspective distortion in images, creating panoramic images, and image alignment.
[0056] Further optional embodiments, the feature parameter based on the transformed region determines the target extension space, specifically comprising:
[0057] The feature parameters include image width, image height, fan heart position, and fan radius, wherein the fan heart position is the intersection point of the upper and lower edge rays after perspective transformation;
[0058] According to the fan radius, the vertical direction extension pixel value is calculated, and the transformed region is mapped to the fan-shaped space corresponding to the vertically extended pixels.
[0059] In the embodiments of the present application, in order to expand the image space and prepare for fan-shaped extension, the fan-shaped geometric parameters are determined and the image is expanded according to the following steps:
[0060] First, the fan heart position and the length of the fan edge are obtained, and the image width is set as cols and the height is set as rows. The fan heart coordinates (nX, nY) are the intersection points of the upper and lower edge rays of the perspective transformed rectangle, wherein nY takes half of the image height (i.e. nY = rows / 2), and nX is derived through geometric mapping relationship as nX = cols x rows / (2 x (rows / 3)). Next, the fan radius dR is calculated, which is the distance between the fan heart (nX, nY) and the upper left corner point (x1, y1) of the perspective transformed rectangle. Then, the height difference nAddHeight before and after fan-shaped extension is calculated through the Pythagorean theorem, and the formula is where (nX-colls) is the horizontal distance from the fan center to the right image boundary; and finally, the image is extended vertically by nAddHeight pixels to provide just enough height space for the subsequent fan extension.
[0061] In a further optional embodiment, the establishing of the mapping relationship between the source coordinate system and the target coordinate system comprises:
[0062] In a further optional embodiment, the calculating of the target radian comprises:
[0063] In a further optional embodiment, the calculating of the source radian comprises:
[0064] In a further optional embodiment, the mapping of the value of the source pixel position to the target pixel position is performed by backward mapping.
[0065] In a further optional embodiment, the calculating of the target radian comprises:
[0066] dDstRadians = atan((nY-row) / (nX-col));
[0067] where row is the row coordinate of the target pixel, col is the column coordinate of the target pixel, and (nX, nY) is the coordinate of the intersection point of the upper and lower edges after perspective transformation.
[0068] In a preferred embodiment, when performing the fan extension of the image, the following operations are performed:
[0069] First, the line connecting the upper edge vertex of the right half of the picture to the upper edge vertex of the left half is taken as the radius, and the line is rotated clockwise to the right side of the picture to form the fan extension region of the upper half; and then the line connecting the lower edge vertex of the right half to the lower edge vertex of the left half is taken as the radius, and the line is rotated counterclockwise to the right side of the picture to form the fan extension region of the lower half.
[0070] For each target pixel point (denoted by row and col), the mapping relationship thereof needs to be calculated based on the polar coordinate system: first, the distance dNewR of the point to the fan center (nX, nY) is calculated, and the formula is Then, dDstRadians = atan((nY-row) / (nX-col)) is used to calculate the target radian, where the fan center coordinate (nX, nY) is the intersection point of the extended upper and lower edges of the rectangle after perspective transformation.
[0071] Then, the radian ranges before and after the fan-shaped extension are calculated: the radian dRadians before the extension = atan(nNewHeight / cols) (nNewHeight is the height difference of the extended image), and the radian dRadiansBig after the extension = acos((nX-cols) / dR) (dR is the distance from the fan center to the upper left corner of the rectangle). The source radian dSrcRadians = (dDstRadians / dRadiansBig) x dRadians is obtained by combining the target radian through the proportional relationship of the two radian, and then the source radian is converted from the polar coordinate system to the Cartesian coordinate system to calculate the source pixel position (nSrcX, nSrcY) = (nX-dNewR x sin(dSrcRadians), nY-dNewR x cos(dSrcRadians)). Finally, the pixel value of (nSrcX, nSrcY) is mapped to the target point (col, row) in a backward mapping manner, so as to ensure accurate mapping of the pixel during the fan-shaped extension.
[0072] In a further optional embodiment, after the mapping of the transformed region to the target extension space, the method further comprises:
[0073] The mapped image is subjected to a rotation transformation, and the image is processed row by row, and the effective pixels are mapped to the whole row pixel range through a linear mapping algorithm to realize horizontal extension.
[0074] In a further optional embodiment, the linear mapping algorithm specifically comprises:
[0075] determining a first coordinate interval of the source pixel region in the target mapping dimension and a second coordinate interval of the target mapping region;
[0076] establishing a mapping function of the pixel coordinates based on the linear proportional relationship of the first coordinate interval and the second coordinate interval, and mapping any point in the source pixel region to the corresponding position of the target mapping region.
[0077] In a preferred embodiment, the image after the fan-shaped extension is rotated by 90 degrees in any direction, so as to subsequently process the image row by row. Then, the image is processed row by row: for each row of pixels, the effective pixels (i.e. non-black pixels) are first screened out, and the distribution of the effective pixels in the horizontal direction is regarded as a countable line segment, and the x coordinates of the left and right endpoints of the line segment constitute a first interval [a1, a2]; meanwhile, the horizontal distribution of the whole row of pixels is regarded as a target line segment, and the x coordinates of the left and right endpoints of the target line segment constitute a second interval [b1, b2]. Then, the interval mapping operation is performed through a linear mapping algorithm: for the x coordinate ax of any pixel point on the effective line segment, wherein ax is any value in the interval [a1, a2], the formula Calculate its mapping position bx on the whole row target line segment, wherein bx represents the distance from the left end point b1 after the effective pixel is mapped to the whole row line segment. By performing the above mapping calculation on each effective pixel row by row, all pixels in the effective line segment are mapped to the corresponding positions of the whole row pixels one by one, and finally the lateral extension conversion from the fan-shaped area to the rectangular area is completed, so that the image is further expanded in the horizontal direction.
[0078] Optionally, after the above series of transformations, the upper and lower vertices A and B of the right half of the image after perspective transformation will be displaced to a position close to the top of the image. Since the pixel area above the line connecting A and B has a significant difference between the actual length of the effective pixel row and the target length of the whole row pixel after stretching during the fan-shaped extension and the rectangular lateral extension, the pixels in this area are excessively stretched, resulting in texture blur, color misplacement or geometric distortion, which seriously affects the smoothness of the image transition. Therefore, the following specific steps are used to complete the cropping and splicing:
[0079] The coordinates of A and B points are located, the equation of the line connecting A and B is determined by linear fitting, all pixels above the line are directly removed, and the effective pixel area below the line is retained, and the image is directly cropped to optimize the image effect and improve the quality of the panoramic image.
[0080] The left half of the image is rotated 180° clockwise around the geometric center, so that the image is upside down, and the structure of the left half of the image is symmetrical with the initial state of the right half before processing; then the perspective transformation, spatial expansion, fan-shaped extension, rectangular lateral extension and cropping are performed according to the above steps, and the processed left half of the image is rotated 180° counterclockwise to restore to the original direction, and the right half of the image is spliced with the center line as the reference, and the pixel-level alignment algorithm is used during splicing to ensure the texture continuity of the left and right edges, and finally a 360° panoramic image is generated.
[0081] The single image panoramic image generation method, system, device and medium provided by the application can generate a panoramic image through three equal perspective transformation of a selected area, determine a target expansion space based on the characteristic parameters of the transformed area, establish a coordinate mapping relationship by using a polar coordinate system combined with a Cartesian coordinate backward mapping, realize lateral extension through a linear mapping algorithm, and finally integrate to generate a panoramic image. This process only needs a single image to complete the panoramic processing, simplifies the shooting process and reduces the cost; avoids the cumulative error of multi-image splicing, improves the quality of the panoramic image; preserves the original image texture and illumination through perspective transformation and accurate coordinate mapping, enhances the naturalness and realism; uses historical calculation results to improve the calculation efficiency and reduce the hardware requirements; realizes the panoramic expansion of a single image, and provides an immersive two-dimensional panoramic browsing experience for users.
[0082] A single-image generated panoramic image device is described below, as shown in Figure 2 The single-image generated panoramic image device described below can be correspondingly referenced with the single-image generated panoramic image method described above.
[0083] A single-image generated panoramic image device comprises:
[0084] An image acquisition module is configured to acquire a to-be-processed image.
[0085] A region processing module is configured to split the to-be-processed image into at least two image regions along a preset direction, perform geometric transformation on the image regions, and generate transformed regions.
[0086] A space expansion module is configured to determine a target expansion space based on feature parameters of the transformed regions, and map the transformed regions to the target expansion space.
[0087] A coordinate mapping module is configured to establish a mapping relationship between a source coordinate system and a target coordinate system, and map pixel points in the target expansion space from the source coordinate system to the target coordinate system based on a preset mapping rule.
[0088] An image integration module is configured to integrate the processed image regions, and generate a panoramic image.
[0089] Figure 3 An example of an electronic device is shown in the physical structure diagram, as shown in Figure 3 The electronic device can include a processor 310, a communications interface 320, a memory 330, and a communications bus 340, wherein the processor 310, the communications interface 320, and the memory 330 can communicate with each other through the communications bus 340. The processor 310 can invoke the logical instructions in the memory 330 to execute a single-image generated panoramic image method, which comprises:
[0090] Acquiring a to-be-processed image.
[0091] Splitting the to-be-processed image into at least two image regions along a preset direction, performing geometric transformation on the image regions, and generating transformed regions.
[0092] Determining a target expansion space based on feature parameters of the transformed regions, and mapping the transformed regions to the target expansion space.
[0093] Establishing a mapping relationship between a source coordinate system and a target coordinate system, and mapping pixel points in the target expansion space from the source coordinate system to the target coordinate system based on a preset mapping rule.
[0094] The processed image regions are integrated to generate a panoramic image.
[0095] In addition, the logic instructions in the memory 330 described above can be implemented in the form of a software function unit and sold or used as an independent product, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0096] In another aspect, the present application also provides a non-transitory computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement a single image panoramic image generation method provided by the above-mentioned methods.
[0097] The device embodiments described above are only schematic, and the units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e. they can be located in one place, or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the present embodiment according to actual needs. Those skilled in the art can understand and implement it without creative labor.
[0098] From the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be realized by means of software and the necessary general hardware platform, and of course it can also be realized by hardware. Based on such understanding, the above technical solutions essentially or the part that contributes to the prior art can be embodied in the form of a software product. The computer software product can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiment.
[0099] It should be pointed out finally that the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit the same; and although the present application has been described in detail with reference to the foregoing embodiments, it should be appreciated by those skilled in the art that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features thereof can be replaced equivalently; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for generating a panoramic image from a single image, characterized in that: include: Get the image to be processed; Splitting the image to be processed into at least two image regions along a preset direction, performing geometric transformation on the image regions to generate transformed regions; determining a target expansion space based on characteristic parameters of the transformed region, and mapping the transformed region to the target expansion space; Establishing a mapping relationship between a source coordinate system and a target coordinate system, and mapping pixel points in the target extended space from the source coordinate system to the target coordinate system based on a preset mapping rule; Integrate several processed image regions to generate a panoramic image.
2. The method for generating a panoramic image from a single image according to claim 1, wherein: The geometric transformation includes: The selected image area is divided into three equal parts, and a perspective transformation is performed based on the middle divided area to generate a transformed area.
3. The method for generating a panoramic image from a single image according to claim 1, wherein: The determining of the target expansion space based on the characteristic parameters of the transformed region specifically includes: The characteristic parameters include image width, image height, fan center position and fan radius, wherein the fan center position is the intersection point of the upper and lower edge rays after perspective transformation; The vertically expanded pixel value is calculated according to the fan radius, and the transformed area is mapped to the fan space of the vertically expanded corresponding pixels.
4. The method for generating a panoramic image from a single image according to claim 1, wherein: The establishing of the mapping relationship between the source coordinate system and the target coordinate system specifically includes: Use polar coordinate system for pixel mapping, calculate the polar coordinate length from the target pixel to the fan center position, and determine the target arc based on the polar coordinate system; Calculating the source arc based on the arc ratio before and after the fan-shaped expansion, converting the polar coordinate system into a Cartesian coordinate system to obtain the source pixel position; Maps the value of the source pixel position to the destination pixel position through backward mapping.
5. The method for generating a panoramic image from a single image according to claim 4, wherein: After mapping the transformed area to the target extended space, the method further includes: The mapped image is rotated and processed line by line, and the effective pixels are mapped to the entire row of pixels through a linear mapping algorithm to achieve horizontal extension.
6. The method for generating a panoramic image from a single image according to claim 4, wherein: The target arc is calculated as follows: dDstRadians=atan((nY-row) / (nX-col)); Where row is the row coordinate of the target pixel, col is the column coordinate of the target pixel, and (nX, nY) is the coordinate of the intersection of the upper and lower rays after perspective transformation.
7. The method for generating a panoramic image from a single image according to claim 5, wherein: The linear mapping algorithm specifically includes: Determining a first coordinate interval of the source pixel area in the target mapping dimension and a second coordinate interval of the target mapping area; Based on the linear proportional relationship between the first coordinate interval and the second coordinate interval, a mapping function of pixel coordinates is established to map any point in the source pixel area to a corresponding position in the target mapping area.
8. A device for generating a panoramic image from a single image, characterized in that: include: An image acquisition module, used for acquiring an image to be processed; A region processing module, configured to divide the image to be processed into at least two image regions along a preset direction, perform geometric transformation on the image regions, and generate transformed regions; a space expansion module, configured to determine a target expansion space based on characteristic parameters of the transformed region, and map the transformed region to the target expansion space; A coordinate mapping module, configured to establish a mapping relationship between a source coordinate system and a target coordinate system, and map pixels in the target extended space from the source coordinate system to the target coordinate system based on a preset mapping rule; The image integration module is used to integrate several processed image areas to generate a panoramic image.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for generating a panoramic image from a single image as described in any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating a panoramic image from a single image as claimed in any one of claims 1 to 7 is implemented.