An image stitching method, device, equipment and medium
By acquiring target image style information and determining the display area, efficient and seamless image stitching is achieved, solving the problem of high memory bandwidth requirements in traditional stitching methods and improving stitching efficiency and image quality.
Patent Information
- Application Number
- CN202411891263.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2044-12-20
AI Technical Summary
Traditional image stitching methods have high memory bandwidth requirements and cannot adapt to complex and ever-changing stitching environments, resulting in low image stitching efficiency and low memory bandwidth utilization.
By acquiring the target image style information, the display area and position of each image to be stitched in the target image are determined. The local display images are extracted and written into the memory for stitching, reducing unnecessary image data and improving stitching efficiency.
It achieves seamless stitching of multiple images, improves the quality and visual effect of the stitched target image, reduces the demand for memory bandwidth, and adapts to complex and ever-changing stitching environments.
Smart Images

Figure CN119762341B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to an image stitching method, apparatus, device, and medium. Background Technology
[0002] Image stitching is an increasingly popular research area and has become a hot topic in photogrammetry, computer vision, image processing, and computer graphics. Image stitching aims to create an image with a larger field of view than a single image by aligning a series of spatially overlapping images.
[0003] Currently, traditional image stitching methods typically involve first writing multiple images completely into memory, caching one complete frame of data for each image, then reading the data from multiple images and writing it back to the corresponding memory address to finally obtain the stitched image. However, traditional image stitching methods have high memory bandwidth requirements, cannot adapt to complex and ever-changing stitching environments, have low memory bandwidth utilization, and result in low image stitching efficiency. Summary of the Invention
[0004] This invention provides an image stitching method, apparatus, device, and medium to achieve efficient image stitching with low memory bandwidth requirements. It can adapt to complex and ever-changing stitching environments, improve memory bandwidth utilization, and thus greatly improve the efficiency of image stitching.
[0005] In a first aspect, embodiments of the present invention provide an image stitching method, comprising:
[0006] Obtain target image style information, which is the style information of the target image obtained by stitching together multiple images to be stitched together;
[0007] Based on the target image style information, determine the display area of each image to be stitched in the target image and the display position information of the display area in the target image;
[0008] Based on the display area, the corresponding display area is extracted from the image to be stitched output by each image source to obtain a local display image in each image to be stitched, wherein the image source corresponds one-to-one with the image to be stitched;
[0009] Based on the display position information of the display area in the target image, the storage position corresponding to each of the partial display images is determined, and based on the storage position, each of the partial display images is written into the memory for splicing to obtain the spliced target image.
[0010] Secondly, embodiments of the present invention also provide an image stitching device, comprising:
[0011] The style information acquisition module is used to acquire the style information of the target image, which is the style information of the target image obtained by stitching together multiple images to be stitched together.
[0012] The location information determination module is used to determine the display area of each image to be stitched in the target image and the display position information of the display area in the target image based on the target image style information;
[0013] The local image acquisition module is used to extract the corresponding display area of the image to be stitched from each image source based on the display area, so as to obtain a local display image in each image to be stitched, wherein the image source corresponds one-to-one with the image to be stitched;
[0014] The image stitching module is used to determine the storage location corresponding to each of the partial display images based on the display position information of the display area in the target image, and write each of the partial display images into the memory for stitching based on the storage location to obtain the stitched target image.
[0015] Thirdly, embodiments of the present invention also provide an electronic device, characterized in that the electronic device comprises: at least one processor; and
[0016] A memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the image stitching method provided in any embodiment of the present invention.
[0018] Fourthly, embodiments of the present invention also provide a computer-readable storage medium, characterized in that the computer-readable storage medium stores computer instructions, which are used to enable a processor to execute the image stitching method provided in any embodiment of the present invention.
[0019] The technical solution of this invention obtains target image style information, which is the style information of the target image obtained after stitching multiple images to be stitched together. This clarifies the expected style of the stitched image, providing a clear target and benchmark for subsequent steps. Based on the target image style information, the display area and display position information of each image to be stitched within the target image are determined, providing accurate positional information for subsequent extraction of local display images and writing to memory. Based on the display area, the corresponding display area is extracted from the image to be stitched output by each image source, obtaining a local display image in each image to be stitched. The image source and the image to be stitched correspond one-to-one, reducing unnecessary image data and improving stitching efficiency. Based on the display position information of the display area in the target image, the storage position corresponding to each local display image is determined. Based on the storage position, each local display image is written to memory for stitching to obtain the stitched target image. This achieves seamless stitching of multiple images to be stitched, improving the quality and visual effect of the stitched target image. By extracting local display images from outside the memory using target image style information, unnecessary image data inside the memory is greatly reduced, improving splicing efficiency and image quality. This allows the system to adapt to complex and ever-changing splicing environments and reduces the bandwidth requirements of the memory.
[0020] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart of an image stitching method provided according to Embodiment 1 of the present invention;
[0023] Figure 2 This is an example diagram of style information of a target image according to Embodiment 1 of the present invention;
[0024] Figure 3 This is a flowchart of an image stitching method provided according to Embodiment 2 of the present invention;
[0025] Figure 4This is a schematic diagram of a storage space region division according to Embodiment 2 of the present invention;
[0026] Figure 5 This is a schematic diagram of the structure of an image stitching device according to Embodiment 3 of the present invention;
[0027] Figure 6 This is a schematic diagram of the structure of an electronic device that implements the image stitching method of this invention. Detailed Implementation
[0028] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0029] It should be noted that the terms "target," "current," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0030] Example 1
[0031] Figure 1 This is a flowchart illustrating an image stitching method according to Embodiment 1 of the present invention. This embodiment is applicable to the stitching of multiple images. Figure 1 As shown, this method can be executed by an image stitching device, which can be implemented in hardware and / or software and can be configured in an electronic device. For example... Figure 1 As shown, the method specifically includes the following steps:
[0032] S110. Obtain target image style information. Target image style information is the style information of the target image obtained after stitching together multiple images to be stitched.
[0033] The target image style information refers to the style of the image to be obtained after stitching. For example, target image style information could be the aspect ratio of the image, the stitching method, etc. The image to be stitched refers to the image needed to obtain the target image after stitching. The target image refers to the image to be obtained after stitching.
[0034] Specifically, the expected style of the stitched target image can be defined and obtained in advance. Style information can be obtained through user input, preset parameters, or automatic generation by algorithms. Style information may include the image's aspect ratio, stitching method (e.g., horizontal, vertical, or irregular stitching), etc. By clearly defining the style information of the stitched target image, a clear target and benchmark can be provided for subsequent steps, helping to ensure that the stitched target image meets user requirements.
[0035] S120. Based on the target image style information, determine the display area of each image to be stitched in the target image and the display position information of the display area in the target image.
[0036] The display area refers to the specific area occupied and displayed by the image to be stitched within the target image. The display position information refers to the coordinates, size, shape, and other characteristic information of the display area within the target image.
[0037] Specifically, based on the target image style information, the display area of each image to be stitched in the target image is analyzed, and the display area of each image to be stitched in the target image is calculated. This display area can be a rectangle or an irregular shape, depending on the stitching method and the style of the target image. The display position information of the display area in the target image is determined, such as the coordinates of the upper left corner, width, height, etc., thus providing accurate position information for subsequent extraction of local display images and writing to memory.
[0038] For example, the target image style information includes the image position information corresponding to each image to be stitched; the "determining the display area of each image to be stitched in the target image based on the target image style information" in S120 includes: determining the stitching boundary corresponding to each image to be stitched based on the image position information corresponding to each image to be stitched; dividing the target image horizontally based on the stitching boundary to obtain all image display areas of the target image in each segment; and determining the display area of each image to be stitched in the target image based on all image display areas of the target image in each segment.
[0039] The image position information can refer to the relative or absolute position of each image to be stitched within the target image. The stitching boundary can refer to the boundary line between the display areas of two adjacent images to be stitched within the target image.
[0040] Specifically, based on the image position information of each image to be stitched in the target image style information, the stitching boundary of each image to be stitched in the target image is calculated. The image position information can include the coordinates of the image to be stitched in the target image (such as the coordinates of the top left or bottom right corner) and its dimensions (such as width and height). The stitching boundary defines the precise position and range of the image to be stitched in the target image. Based on the stitching boundary, the target image is divided into multiple segments horizontally. Each segment contains the display area of one or more images to be stitched. Within each segment, the display area of each image to be stitched in the target image is further determined from all the image display areas of the target image in each segment. By accurately calculating the stitching boundary of each image to be stitched in the target image, the accuracy of determining the display area of the image to be stitched in the target image is improved, thus improving the accuracy and efficiency of image stitching.
[0041] For example, the style information of the target image can be as follows: Figure 2 As shown, suppose there are 4 images to be stitched together, and according to... Figure 2 The image was stitched together using the Y-axis intersection coordinates (horizontal stitching boundary) of each image as a reference value to segment it. Within each segment, each image has an image display area, and the number of blocks in that display area corresponds to the same image to be stitched. Therefore, the entire target image can be divided into 5 segments. The segment numbers of each image to be stitched are sorted according to the number of its segments. For example, image 1 can be divided into 4 segments. The first segment is in segment 1, with only one block displayed, which can be a group; the second segment is in segment 3, with only one block displayed, which can be a group; the third segment is in segment 4, divided into two blocks displayed, which can be two groups; and the fourth segment is in segment 5, with only one block displayed, which can be a group.
[0042] For example, based on all image display areas of the target image in each segment, determining the display area of each image to be stitched in the target image includes: determining the image to be stitched corresponding to each image display area of the target image in each segment; and determining the target segment where each image to be stitched is located and its display area in the target segment based on the image to be stitched corresponding to each image display area in each segment.
[0043] Specifically, based on the display area of each image in each segment of the target image, the image to be stitched is determined for each display area. For each image to be stitched, based on the segment where its corresponding display area is located, the target segment corresponding to each image to be stitched is determined. The display area of the image to be stitched within that target segment is the display area of that image to be stitched within that target segment. By accurately calculating the display area of each image to be stitched within the target image, it is possible to ensure that the stitched image is visually more coherent and seamless.
[0044] S130. Based on the display area, extract the corresponding display area of the image to be stitched from each image source output to obtain a local display image in each image to be stitched, wherein the image source and the image to be stitched correspond one-to-one.
[0045] Among them, the partially displayed image can refer to the image located in a local area of the images to be stitched together.
[0046] Specifically, for each image source, based on its output image to be stitched and the determined display area, image processing algorithms (such as cropping, scaling, etc.) are used to extract a local display image, ensuring that the extracted local display image completely matches the display area, thereby reducing unnecessary image data and improving stitching efficiency.
[0047] S140. Based on the display position information of the display area in the target image, determine the storage position corresponding to each local display image, and based on the storage position, write each local display image into the memory for splicing to obtain the spliced target image.
[0048] Here, storage location can refer to the specific location or path where image data is stored in memory. For example, storage location can include memory address and mask information. Memory can refer to hardware devices used to store data, instructions, and information. For example, memory can be Double Data Rate Synchronous Dynamic Random Access Memory (DDR).
[0049] Specifically, based on the display position information of the display area in the target image and the position of the canvas corresponding to the target image in the memory, the storage position of each local display image is calculated. Based on the storage position, each local display image is written into the memory using an appropriate image file format and encoding method. In the memory, according to the previously determined display area and position information, the various local display images are stitched together to obtain the stitched target image. This achieves seamless stitching of multiple images to be stitched, improving the quality and visual effect of the stitched target image.
[0050] For example, in combination Figure 2 Each partial display image is written to memory for stitching. The specific process is as follows: Before data enters, parameters are prepared. Based on the segment number, group number, starting address relative to its own image, starting address relative to the canvas, and group width, the input data is judged as follows: the group number and group width are used to end the writing of one line of data for each group and switch to the next group. After the group width of the last group of each line of data is written, the segment height counter is incremented by 1 until the counter meets the segment height of the current segment, and then the parameters of the next segment are switched. After all segments are written, the image is finished.
[0051] The technical solution of this invention obtains target image style information, which is the style information of the target image obtained after stitching multiple images to be stitched together. This clarifies the expected style of the stitched image, providing a clear target and benchmark for subsequent steps. Based on the target image style information, the display area of each image to be stitched in the target image and the display position information of the display area in the target image are determined, providing accurate positional information for subsequent extraction of local display images and writing to memory. Based on the display area, the corresponding display area of each image source output to be stitched is extracted to obtain a local display image in each image to be stitched. The image source and the image to be stitched correspond one-to-one, reducing unnecessary image data and improving stitching efficiency. Based on the display position information of the display area in the target image, the storage position corresponding to each local display image is determined, and based on the storage position, each local display image is written to memory for stitching to obtain the stitched target image. This achieves seamless stitching of multiple images to be stitched, improving the quality and visual effect of the stitched target image. By extracting local display images from outside the memory using target image style information, unnecessary image data inside the memory is greatly reduced, improving splicing efficiency and image quality. This allows the system to adapt to complex and ever-changing splicing environments and reduces the bandwidth requirements of the memory.
[0052] Example 2
[0053] Figure 3 This is a flowchart of an image stitching method provided in Embodiment 2 of the present invention. Based on the above embodiments, this embodiment optimizes the step of "determining the storage location corresponding to each local display image based on the display position information of the display area in the target image". Explanations of terms that are the same as or corresponding to those in the above embodiments will not be repeated here.
[0054] See Figure 3 Another image stitching method provided in this embodiment specifically includes the following steps:
[0055] S210. Obtain target image style information. Target image style information is the style information of the target image obtained after stitching together multiple images to be stitched together.
[0056] S220. Based on the target image style information, determine the display area of each image to be stitched in the target image and the display position information of the display area in the target image.
[0057] S230. Based on the display area, extract the corresponding display area of the image to be stitched from each image source output to obtain a local display image in each image to be stitched, wherein the image source and the image to be stitched correspond one-to-one.
[0058] S240. For each display area, based on the display position information of the display area in the target image, determine the first image offset address of the display area in the target image.
[0059] The first image offset address can refer to the number of memory units that need to be traversed from the starting address of the target image to the upper left corner of the display area (or a specified reference point).
[0060] Specifically, the process involves parsing the display area's position information within the target image. This typically includes the coordinates of the top-left corner (or center point), width, and height of the display area. Based on the starting address (or reference address) of the target image and the display area's position information, the first image offset address of the display area within the target image is calculated. This offset address can be a relative address, representing the number of memory units required to reach the top-left corner (or a specified reference point) of the display area from the starting address of the target image. The calculation of the offset address provides the mathematical basis for determining the storage location, ensuring its accuracy.
[0061] S250. Based on the first image offset address and the local display image corresponding to the display area, determine the storage location corresponding to the local display image, and based on the storage location, write each local display image into the memory for splicing to obtain the spliced target image.
[0062] Specifically, based on the first image offset address and the dimensions (width and height) of the partial display image, the storage location of the partial display image in memory is calculated. This storage location is typically an absolute address, representing the starting position for storing the partial display image data in memory. Then, according to the storage location, each partial display image is written into memory for stitching to obtain the stitched target image. By accurately calculating the storage location, unnecessary image data movement and copying are avoided, improving stitching efficiency.
[0063] For example, the step of "determining the storage location corresponding to the local display image based on the first image offset address and the local display image corresponding to the display area" in S250 may include: determining a first image offset between the boundary of the display area and the boundary of the target image; determining a second image offset address and a second image offset between the boundary of the local display image and the boundary of the image to be stitched based on the local display image and the first image offset address; and determining the storage location corresponding to each local display image based on the first image offset, the second image offset, and the second image offset address.
[0064] The first image offset can refer to the offset of the display area (usually a rectangular area) relative to the starting position of the target image (i.e., the entire image). The second image offset can refer to the offset of the partial display image (i.e., the image corresponding to the display area cropped from the target image) relative to the image to be stitched (or a reference point on the storage medium). The second image offset address can refer to the starting position of the partial display image in the storage medium (or the offset address relative to a reference point). This address can be a memory address used to identify the specific location of the partial display image in memory.
[0065] Specifically, first, the position of the display area (i.e., the portion of the image the user wants to see) within the target image (i.e., the original image or the image to be processed) needs to be clearly defined. This is typically achieved by specifying the coordinates of the top-left and bottom-right corners (or the width and height, and the coordinates of the starting point) of the display area. Then, the offset between the boundary of the display area and the boundary of the target image is calculated, i.e., the first image offset. This offset can be positive or negative, representing the horizontal and vertical offset of the display area relative to the starting position of the target image. Based on the partial display image and the known first image offset address, the offset between the boundary of the partial display image and the boundary of the image to be stitched needs to be calculated, i.e., the second image offset. Simultaneously, the starting address of the partial display image in storage needs to be determined, i.e., the second image offset address. Combining the information from the first image offset, the second image offset, and the second image offset address, the storage location of each partial display image in memory can be calculated, thereby improving the accuracy of image stitching.
[0066] For example, determining the storage location corresponding to each partial display image based on the first image offset, the second image offset, and the second image offset address includes: determining the movement distance corresponding to the partial display image based on the first image offset and the second image offset; and shifting the second image offset address based on the movement distance to obtain the storage location corresponding to the partial display image.
[0067] The moving distance can refer to the difference between the first image offset and the second image offset.
[0068] Specifically, the difference between the first image offset and the second image offset is calculated, and this difference is determined as the movement distance corresponding to the local display image. This allows for a precise determination of how far the local display image needs to move to reach the desired position. The calculated movement distance is then used to shift the second image offset address. This shift operation typically involves converting the movement distance into the number of pixels in the image, and then adding the result to the second image offset address. This yields the new location of the local display image in the storage medium, i.e., its corresponding storage address.
[0069] For example, shifting the second image offset address based on the moving distance to obtain the storage location corresponding to the partially displayed image includes: if the first image offset is greater than the second image offset, then shifting the second image offset address to a higher bit based on the moving distance to obtain the storage location corresponding to the partially displayed image; if the first image offset is less than the second image offset, then shifting the second image offset address to a lower bit based on the moving distance to obtain the storage location corresponding to the partially displayed image.
[0070] Specifically, if the first image offset is greater than the second image offset, it means that the position of the partial display image in the original image is "farther" than the expected stitching or storage location (here, "farther" is relative to a reference point). Therefore, the second image offset address needs to be shifted to higher bits (in conventional memory address representation, this usually means increasing the address value) to "pull" the partial display image closer to the desired location. The specific shift operation can be: adjusting the second image offset address according to the shift distance (which may be a negative or positive complement, representing the amount of address to be reduced or "inverted"). If the first image offset is less than the second image offset, it means that the position of the partial display image in the original image is "closer" than the expected stitching or storage location. Therefore, we need to shift the second image offset address to lower bits (in conventional memory address representation, this usually means decreasing the address value) to "push" the partial display image further away to the desired location. The specific shift operation can be as follows: Adjust the second image offset address accordingly based on the shift distance (a positive value, representing the amount of address increase needed; however, since we are shifting to lower bits, this actually means decreasing the value of the second image offset address). By precisely comparing the first and second image offsets and determining the shift direction and distance based on the result, we can ensure that the partially displayed image is accurately stored in the desired location.
[0071] For example, the following judgment can be made: the starting address of the partially displayed image relative to its own image can be address 1, and the starting address relative to the canvas (target image) can be address 2. The lower 6 bits of these two addresses are compared. When address 1 is greater than address 2, it means that the data corresponding to the partially displayed image should be moved to the lower bits. When address 1 is less than address 2, it means that the data should be moved to the higher bits. The number of bytes moved is the larger value minus the smaller value.
[0072] The technical solution of this invention determines the specific location of each display area in the target image by determining its first image offset address based on its display position information within the target image. This provides a reference for subsequent storage of the local display image. Based on the first image offset address and the corresponding local display image, the storage location of the local display image is determined, achieving ordered storage of the local display image in memory, facilitating subsequent access and processing. Precise calculation of the storage location avoids unnecessary image data movement and copying, improving stitching efficiency. Reasonable selection of storage location and storage format helps reduce storage space usage and improve storage efficiency.
[0073] It should be noted that, taking a DDR data width of 512 as an example, the data is split for storage. 512 / 8 = 64, so each DDR data entry contains 64 single-component pixels. The group width, relative to its own image start address, relative to the canvas start address, and the three group width parameters determine the mask for the first and last data in each row within each group. Since the two start address parameters are not necessarily multiples of 64, a data shifting and concatenation operation is required to correctly write the data into the DDR memory, along with the mask. The start address relative to its own image is used to retrieve data from the data source, while the start address relative to the canvas determines the address to be written to the DDR, as well as the data shifting and masking. When the start address relative to its own image is not a multiple of 64, some of the lower-order data will be invalid. When the start address relative to the canvas is not a multiple of 64, a shift operation is performed, moving the data according to the start address. The invalid parts within the data are actually filled with data from another image in the DDR memory.
[0074] For example, the image sources corresponding to different objects to be stitched can be asynchronous. Therefore, when writing to DDR, the DDR storage space is divided into three regions, each with enough data storage space for the maximum load capacity of the network port. The region to be written to DDR is decided by the write arbitration module. After one frame is written, the region to be written for the next frame of that frame switches to the next region.
[0075] like Figure 4As shown, the image sources are not synchronous, so the completion of one region is determined by the slower image source. The third region serves as a buffer for the faster image sources. After image source three completes writing to region 1, all image sources in region 1 have finished writing, and DDR begins reading. The time to read the DDR network port output is 16.6ms, the same time image source three writes to region 2. At this point, the faster image source one completes writing to region 2 first, and then writes to region 3 without affecting region 1, which is currently being read. When region 1 is finished outputting, image source one has not yet completed writing to region 3. After image source three completes writing to region 2, it begins reading from region 2, at which point region 1 is freed up. After the faster image source one completes writing to region 3, it can then write to region 1 again.
[0076] Example 3
[0077] Figure 5 This is a schematic diagram of the structure of an image stitching device provided in Embodiment 3 of the present invention. Figure 5 As shown, the device includes: a style information acquisition module 310, a position information determination module 320, a local image acquisition module 330, and an image stitching module 340.
[0078] The style information acquisition module 310 is used to acquire target image style information, which is the style information of the target image obtained by splicing multiple images to be spliced.
[0079] The location information determination module 320 is used to determine the display area of each image to be stitched in the target image and the display position information of the display area in the target image based on the target image style information;
[0080] The local image acquisition module 330 is used to extract the corresponding display area of the image to be stitched output by each image source based on the display area, so as to obtain a local display image in each image to be stitched, wherein the image source corresponds one-to-one with the image to be stitched;
[0081] The image stitching module 340 is used to determine the storage location corresponding to each of the partial display images based on the display position information of the display area in the target image, and write each of the partial display images into the memory for stitching based on the storage location to obtain the stitched target image.
[0082] The technical solution of this embodiment obtains target image style information, which is the style information of the target image obtained after stitching multiple images to be stitched together. This clarifies the expected style of the stitched image, providing a clear target and benchmark for subsequent steps. Based on the target image style information, the display area and display position information of each image to be stitched within the target image are determined, providing accurate positional information for subsequent extraction of local display images and writing to memory. Based on the display area, the corresponding display area is extracted from the image to be stitched output by each image source, obtaining a local display image in each image to be stitched. The image source and the image to be stitched correspond one-to-one, reducing unnecessary image data and improving stitching efficiency. Based on the display position information of the display area in the target image, the storage position corresponding to each local display image is determined. Based on the storage position, each local display image is written to memory for stitching to obtain the stitched target image. This achieves seamless stitching of multiple images to be stitched, improving the quality and visual effect of the stitched target image. By extracting local display images from outside the memory using target image style information, unnecessary image data inside the memory is greatly reduced, improving splicing efficiency and image quality. This allows the system to adapt to complex and ever-changing splicing environments and reduces the bandwidth requirements of the memory.
[0083] Optionally, the target image style information includes image position information corresponding to each image to be stitched; the position information determination module 320 includes:
[0084] The boundary determination unit is used to determine the stitching boundary of each image to be stitched based on the image position information corresponding to each image to be stitched.
[0085] The first display area determination unit is used to horizontally segment the target image based on the splicing boundary to obtain all image display areas of the target image in each segment;
[0086] The second display area determination unit is used to determine the display area of each image to be stitched in the target image based on all image display areas of the target image in each segment.
[0087] Optionally, the second display area determining unit is specifically used to: determine the image to be stitched corresponding to each image display area in each segment of the target image; and determine the target segment where each image to be stitched is located and the display area in the target segment based on the image to be stitched corresponding to each image display area in each segment.
[0088] Optionally, the image stitching module 340 includes:
[0089] The offset address determination unit is used to determine, for each of the display areas, a first image offset address in the target image based on the display position information of the display area in the target image;
[0090] The storage location determination unit is used to determine the storage location corresponding to the local display image based on the first image offset address and the local display image corresponding to the display area.
[0091] Optionally, the storage location determination unit includes:
[0092] The first offset determination subunit is used to determine the first image offset between the boundary of the display area and the boundary of the target image;
[0093] The second offset determination subunit is used to determine the second image offset address and the second image offset amount between the boundary of the local display image and the boundary of the image to be stitched, based on the local display image and the first image offset address.
[0094] The storage location determination subunit is used to determine the storage location corresponding to each of the partial display images based on the first image offset, the second image offset, and the second image offset address.
[0095] Optionally, the storage location determination subunit is specifically used to: determine the movement distance corresponding to the partial display image based on the first image offset and the second image offset; and shift the second image offset address based on the movement distance to obtain the storage location corresponding to the partial display image.
[0096] Optionally, the storage location determination subunit is specifically used for: if the first image offset is greater than the second image offset, then shifting the second image offset address to a higher bit based on the moving distance to obtain the storage location corresponding to the partial display image; if the first image offset is less than the second image offset, then shifting the second image offset address to a lower bit based on the moving distance to obtain the storage location corresponding to the partial display image.
[0097] The image stitching device provided in the embodiments of the present invention can execute the image stitching method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.
[0098] Figure 6A schematic diagram of an electronic device 12 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as desktop computers, workbenches, servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0099] like Figure 6 As shown, the electronic device 12 is represented in the form of a general-purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and bus 18 connecting different system components (including system memory 28 and processing unit 16).
[0100] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0101] Electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0102] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (… Figure 6 Not shown; usually referred to as a "hard drive"). Although Figure 6Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0103] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of the present invention.
[0104] Electronic device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with electronic device 12, and / or with any device that enables electronic device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 22. Furthermore, electronic device 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with other modules of electronic device 12 via bus 18. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0105] Processing unit 16 executes various functional applications and data processing by running programs stored in system memory 28, such as implementing the steps of an image stitching method provided in this embodiment, the method including:
[0106] Obtain target image style information, which is the style information of the target image obtained by stitching together multiple images to be stitched together;
[0107] Based on the target image style information, determine the display area of each image to be stitched in the target image and the display position information of the display area in the target image;
[0108] Based on the display area, the corresponding display area is extracted from the image to be stitched output by each image source to obtain a local display image in each image to be stitched, wherein the image source corresponds one-to-one with the image to be stitched;
[0109] Based on the display position information of the display area in the target image, the storage position corresponding to each of the partial display images is determined, and based on the storage position, each of the partial display images is written into the memory for splicing to obtain the spliced target image.
[0110] Of course, those skilled in the art will understand that the processor can also implement the technical solutions of the image stitching method provided in any embodiment of the present invention.
[0111] This embodiment provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the program implements the image stitching method steps provided in any embodiment of the present invention. The method includes:
[0112] Obtain target image style information, which is the style information of the target image obtained by stitching together multiple images to be stitched together;
[0113] Based on the target image style information, determine the display area of each image to be stitched in the target image and the display position information of the display area in the target image;
[0114] Based on the display area, the corresponding display area is extracted from the image to be stitched output by each image source to obtain a local display image in each image to be stitched, wherein the image source corresponds one-to-one with the image to be stitched;
[0115] Based on the display position information of the display area in the target image, the storage position corresponding to each of the partial display images is determined, and based on the storage position, each of the partial display images is written into the memory for splicing to obtain the spliced target image.
[0116] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0117] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0118] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0119] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0120] Those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computing device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0121] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. An image stitching method, characterized in that, include: Obtain target image style information, which is the style information of the target image obtained by stitching together multiple images to be stitched together; Based on the target image style information, determine the display area of each image to be stitched in the target image and the display position information of the display area in the target image; Based on the display area, the corresponding display area is extracted from the image to be stitched output by each image source to obtain a local display image in each image to be stitched, wherein the image source corresponds one-to-one with the image to be stitched; Based on the display position information of the display area in the target image, the storage position corresponding to each of the local display images is determined, and based on the storage position, each of the local display images is written into the memory for splicing to obtain the spliced target image; Determining the storage location corresponding to each of the local display images based on the display position information of the display area in the target image includes: For each of the display areas, a first image offset address of the display area in the target image is determined based on the display position information of the display area in the target image; Determine a first image offset between the boundary of the display area and the boundary of the target image; Based on the partially displayed image and the first image offset address, a second image offset address and a second image offset amount are determined between the boundary of the partially displayed image and the boundary of the image to be stitched. Based on the first image offset, the second image offset, and the second image offset address, the storage location corresponding to each of the partial display images is determined.
2. The method according to claim 1, characterized in that, The target image style information includes the image position information corresponding to each image to be stitched together; The step of determining the display area of each image to be stitched within the target image based on the target image style information includes: Based on the image position information corresponding to each image to be stitched, the stitching boundary corresponding to each image to be stitched is determined; Based on the stitching boundary, the target image is horizontally segmented to obtain all image display areas of the target image in each segment; Based on the display areas of all images in each segment of the target image, determine the display area of each image to be stitched in the target image.
3. The method according to claim 2, characterized in that, The step of determining the display area of each image to be stitched within the target image based on all image display areas in each segment of the target image includes: Determine the image to be stitched corresponding to each image display area in each segment of the target image; Based on the image to be stitched corresponding to each image display area in each segment, the target segment where each image to be stitched is located and the display area in the target segment are determined.
4. The method according to claim 1, characterized in that, The step of determining the storage location corresponding to each of the partially displayed images based on the first image offset, the second image offset, and the second image offset address includes: Based on the first image offset and the second image offset, determine the movement distance corresponding to the local display image; Based on the moving distance, the second image offset address is shifted to obtain the storage location corresponding to the partially displayed image.
5. The method according to claim 4, characterized in that, The step of shifting the second image offset address based on the moving distance to obtain the storage location corresponding to the partially displayed image includes: If the first image offset is greater than the second image offset, then based on the moving distance, the second image offset address is shifted to a higher bit to obtain the storage location corresponding to the local display image; If the first image offset is less than the second image offset, then based on the moving distance, the second image offset address is shifted to a lower bit to obtain the storage location corresponding to the local display image.
6. An image stitching device, characterized in that, include: The style information acquisition module is used to acquire the style information of the target image, which is the style information of the target image obtained by stitching together multiple images to be stitched together. The location information determination module is used to determine the display area of each image to be stitched in the target image and the display position information of the display area in the target image based on the target image style information; The local image acquisition module is used to extract the corresponding display area of the image to be stitched from each image source based on the display area, so as to obtain a local display image in each image to be stitched, wherein the image source corresponds one-to-one with the image to be stitched; The image stitching module is used to determine the storage location corresponding to each of the partial display images based on the display position information of the display area in the target image, and write each of the partial display images into the memory for stitching based on the storage location to obtain the stitched target image; The image stitching module includes: The offset address determination unit is used to determine, for each of the display areas, a first image offset address in the target image based on the display position information of the display area in the target image; The storage location determination unit is used to determine the storage location corresponding to the local display image based on the first image offset address and the local display image corresponding to the display area; The storage location determination unit includes: The first offset determination subunit is used to determine the first image offset between the boundary of the display area and the boundary of the target image; The second offset determination subunit is used to determine the second image offset address and the second image offset amount between the boundary of the local display image and the boundary of the image to be stitched, based on the local display image and the first image offset address. The storage location determination subunit is used to determine the storage location corresponding to each of the partial display images based on the first image offset, the second image offset, and the second image offset address.
7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the image stitching method according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the image stitching method according to any one of claims 1-5.
Citation Information
Patent Citations
Image splicing method and device, equipment and storage medium
CN109712076A
Image splicing method and device and readable storage medium
CN110246081A