Image stitching method and apparatus, and electronic device and computer-readable storage medium
By matching and automatically splicing edge data of UI elements in game art design drawings, the problems of inefficient stitching efficiency and high labor costs are solved, and efficient and accurate image splicing is achieved.
Patent Information
- Application Number
- PCT/CN2025/071834
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-20
- Filing Date
- 2025-01-10
- Publication Date
- 2025-08-28
AI Technical Summary
In the prior art, the UI elements splicing of game art design drawings is inefficient and consumes huge labor costs.
By acquiring the first image and a plurality of second images to be stitched, edge data is extracted and matched, the position information of the matching edge data in the first image is determined, and image stitching is performed automatically.
It significantly improves image stitching efficiency, reduces labor time cost, and avoids manual stitching errors to ensure stitching quality.
Smart Images

Figure CN2025071834_28082025_PF_FP_ABST
Abstract
Description
Image stitching method, device, electronic device and computer-readable storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to Chinese patent application number 202410189986.5, filed on February 20, 2024, entitled “Image stitching method, device, electronic device and computer-readable storage medium”, the entire contents of which are incorporated herein by reference. Technical Field
[0003] The present disclosure relates to the field of computer technology, and in particular to an image stitching method, device, electronic device, and computer-readable storage medium. Background Art
[0004] In the gaming industry, image stitching refers to stitching together multiple UI elements with reference to the game art design drawings to obtain a game screen with the same appearance as the game art design drawings.
[0005] In the related art, multiple UI elements are usually spliced together manually. However, since any game art design drawing often contains a large number of UI elements, this requires huge labor costs and has the problem of low splicing efficiency. Summary of the Invention
[0006] The present disclosure provides an image stitching method, device, electronic device, and computer-readable storage medium to improve image stitching efficiency and reduce labor costs.
[0007] In a first aspect, an embodiment of the present disclosure provides an image stitching method, the method comprising:
[0008] Acquire a first image and a plurality of second images to be stitched, wherein the first image contains the same image elements as those in the second image;
[0009] Extracting edge data from the first image and the second image respectively to obtain first edge data of the first image and second edge data of the second image;
[0010] matching the first edge data and the second edge data, and determining edge data in the first edge data that matches the second edge data as matching edge data;
[0011] determining the position information of the position of the matching edge data in the first edge data as the target position information corresponding to the second image; the target position information is used to indicate the matching position of the corresponding second image in the first image;
[0012] The second images are spliced according to the target position information corresponding to the second images to obtain a spliced target spliced image.
[0013] In a second aspect, an embodiment of the present disclosure provides an image stitching device, the device comprising:
[0014] an acquisition module configured to acquire a first image and a plurality of second images to be stitched, wherein the first image contains the same image elements as those in the second image;
[0015] a processing module configured to extract edge data from the first image and the second image respectively to obtain first edge data of the first image and second edge data of the second image;
[0016] a matching module configured to match the first edge data with the second edge data, and determine edge data in the first edge data that matches the second edge data as matching edge data;
[0017] a determination module configured to determine position information of a position of the matching edge data in the first edge data as target position information corresponding to the second image; the target position information is used to indicate a matching position of the corresponding second image in the first image;
[0018] The stitching module is configured to stitch the second images together according to target position information corresponding to the second images to obtain a stitched target stitched image.
[0019] In a third aspect, an embodiment of the present disclosure provides an electronic device, the electronic device comprising:
[0020] A memory and a processor, wherein the memory and the processor are coupled;
[0021] The memory is used to store one or more computer instructions;
[0022] The processor is used to execute the one or more computer instructions to implement the image stitching method described in any one of the first aspects above.
[0023] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having one or more computer instructions stored thereon, characterized in that the instructions are executed by a processor to implement the image stitching method described in any one of the first aspects above.
[0024] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the image stitching method described in any one of the first aspects above.
[0025] The image stitching method provided by the present disclosure obtains a first image and multiple second images to be stitched, wherein the first image contains the same image elements as those of the second image. Edge data of the first image and the second image are extracted to obtain first edge data of the first image and second edge data of the second image. The first edge data and the second edge data are matched, and the edge data in the first edge data that matches the second edge data is determined as the matching edge data. The position information of the position of the matching edge data in the first edge data is determined as the target position information corresponding to the second image. The target position information is used to indicate the matching position of the corresponding second image in the first image. According to the target position information corresponding to each second image, each second image is stitched to obtain a stitched target stitched image.
[0026] Compared with the prior art, the present disclosure has the following advantages: The present disclosure finds matching edge data that matches the second edge data from the first edge data by adopting a method of position matching the second edge data of the second image with the first edge data of the first image. The position of the matching edge data in the first edge data is used as the target position information corresponding to the second image. In other words, the target position information corresponding to the second image indicates the matching position of the second image in the first image. Subsequently, the second images are spliced together according to the target position information corresponding to each second image to obtain a target spliced image after splicing. In the present disclosure, the splicing of the second images can be automatically achieved to obtain a target spliced image with the same image content as the first image. This automated method can significantly improve the efficiency of image splicing and greatly reduce the manpower and time costs. In addition, stitching errors caused by manual stitching are avoided, so that the image stitching quality can be better controlled. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The drawings described herein are used to provide a further understanding of the present disclosure and constitute a part of the present disclosure. The exemplary embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute an improper limitation of the present disclosure. In the drawings:
[0028] FIG1 is a schematic diagram of a flow chart of an image stitching method provided by one embodiment of the present disclosure;
[0029] FIG2 is a schematic diagram of a first image provided by one embodiment of the present disclosure;
[0030] FIG3 is a schematic diagram of a plurality of second images provided in one embodiment of the present disclosure;
[0031] FIG4 is a schematic diagram of a target stitched image provided by one embodiment of the present disclosure;
[0032] FIG5 is a schematic diagram of a first image provided by one embodiment of the present disclosure;
[0033] FIG6 is a schematic diagram of a plurality of second images and the number of matches corresponding to each second image provided by one embodiment of the present disclosure;
[0034] FIG7 is a schematic diagram of a target stitched image provided by one embodiment of the present disclosure;
[0035] FIG8 is a schematic diagram of an interface of a game interface splicing tool provided by one embodiment of the present disclosure;
[0036] FIG9 is a schematic structural diagram of an image stitching device provided by one embodiment of the present disclosure;
[0037] FIG10 is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present disclosure.
[0038] The above drawings illustrate specific embodiments of the present disclosure, which will be described in more detail below. These drawings and textual descriptions are not intended to limit the scope of the present disclosure in any way, but rather to illustrate the concepts of the present disclosure to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0039] To make the purposes, advantages, and features of the present disclosure more clear, the present disclosure is described clearly and completely below in conjunction with the accompanying drawings and specific embodiments. In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure. However, the described embodiments are only some of the embodiments of the present disclosure, not all of them. All other embodiments obtained by persons of ordinary skill in the art without inventive effort are within the scope of protection of the present disclosure.
[0040] It should be noted that, in the description of the present disclosure, the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance, or a specific order or precedence. For those skilled in the art, the specific meanings of the above terms in the present disclosure can be understood in specific circumstances. In addition, in the description of the present disclosure, unless otherwise specified, the term "plurality" refers to two or more. The term "and / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. The terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0041] It should be noted that the above application of the image stitching method to a gaming scenario is merely an example of a scenario, one of many scenarios in which the image stitching method provided by this disclosure can be applied, and this example scenario is not intended to be limiting. In actual applications, this image stitching method can also be used for drawing architectural designs in architectural design scenarios, drawing product promotional posters and product packaging design drawings in product marketing scenarios, and so on. This is merely an example, and the present disclosure does not impose any limitations on this.
[0042] To address the problems of the related art, the present disclosure provides an image stitching method, an image stitching device corresponding to the method, an electronic device capable of implementing the image stitching method, and a computer-readable storage medium. The following examples provide detailed descriptions of the method, device, electronic device, and computer-readable storage medium.
[0043] In order to make the purpose and technical solution of the present disclosure clearer and more intuitive, the method provided by the embodiment of the present disclosure will be described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present disclosure and are not used to limit the present disclosure. It is understood that the following embodiments can exist separately, and the following embodiments and features in the embodiments can be combined with each other when there is no conflict between the embodiments provided in the present disclosure. For the same or similar content, it will not be repeated in different embodiments. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation. In some cases, the steps shown or described can be performed in a different order.
[0044] The present disclosure provides an image stitching method, device, electronic device, and computer-readable storage medium. Specifically, the image stitching method of one embodiment of the present disclosure can be executed by a computer device, wherein the computer device can be a terminal or server device. The terminal can be a terminal device such as a smartphone, tablet computer, laptop computer, touch screen, etc., and can also include a client, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms.
[0045] It should be understood that the above application scenarios are merely examples and are not limitations of the present disclosure. In addition, for any content not disclosed in the application scenarios, please refer to the following embodiments.
[0046] The image stitching method provided by one embodiment of the present disclosure is described below with reference to FIG1 . FIG1 is a flow chart of the image stitching method provided by one embodiment of the present disclosure.
[0047] As shown in FIG1 , the image stitching method includes steps S10 to S50:
[0048] S10: Acquire a first image and a plurality of second images to be stitched, wherein the first image contains the same image elements as those in the second images.
[0049] As described above, the image content of the first image includes multiple image elements. The image content of each of the multiple second images to be stitched together is a type of image element included in the first image. The image content of each second image is different, meaning each second image has its own unique image content, and no two second images have exactly the same image content.
[0050] For example, the first image is an art design depicting a beach scene. The image elements in the first image include the beach, water, a person, coconut trees, seagulls, the sun, and a bench. Then, the multiple second images to be stitched together corresponding to the first image can be images of the beach, water, a person, coconut trees, seagulls, the sun, and a bench, respectively.
[0051] As mentioned above, the first image and each second image are all rectangular in shape. Some of the second images contain transparent pixels. For example, a second image containing an apple may have transparent pixels in the image area between the edge of the apple and the rectangular frame of the second image. Thus, when a human eye observes this second image, they can only see the apple, but cannot see the pixels in the image area between the edge of the apple and the rectangular frame. For another example, a second image containing a tire may have transparent pixels in the image area between the outer rim of the tire and the rectangular frame of the second image, as well as transparent pixels in the image area encompassed by the inner rim of the tire. Thus, when a human eye observes this second image, they can only see the tire, but cannot see the pixels in the image area between the outer rim of the tire and the rectangular frame, or the pixels in the image area encompassed by the inner rim of the tire.
[0052] As mentioned above, the size and direction of the image elements in the first image that are identical to those in the second image are identical to the size and direction of the second image. In this way, when stitching the second images together, there is no need to perform rotation transformation on the second images, which helps to reduce the amount of data calculations during the image stitching process. Taking the first and second images in the above example as an example, for example, the size of the coconut tree (i.e., one of the image elements) in the first image is identical to the size of the second image (i.e., the coconut tree image) whose image content is the coconut tree; and the direction of the coconut tree (i.e., one of the image elements) in the first image is identical to the direction of the coconut tree in the coconut tree image. For another example, the size of the seagull (i.e., one of the image elements) in the first image is identical to the size of the second image (i.e., the seagull image) whose image content is the seagull; and the direction of the seagull (i.e., one of the image elements) in the first image is identical to the direction of the seagull in the image whose image content is the seagull.
[0053] S20 , extracting edge data from the first image and the second image to obtain first edge data of the first image and second edge data of the second image.
[0054] In the embodiment of the present disclosure, a preset edge detection algorithm may be used to extract edge data from the first image and each second image, respectively, to obtain first edge data for the first image and second edge data for each second image. The preset edge detection algorithm may be a Canny algorithm, a Sobel algorithm, a Prewitt algorithm, or the like, which are examples only and are not limited in the embodiment of the present disclosure.
[0055] As described above, edge data extraction is performed on the first image to obtain first edge data. The first edge data is a first edge matrix of the same size as the first image, and the first edge matrix is used to represent the edge information of the first image. In this first edge matrix (i.e., the first edge data), the value of each pixel represents the edge strength or gradient size of the position where the pixel is located in the first image, usually a grayscale value. This first edge matrix can be regarded as a description of the edge image corresponding to the first image. Similarly, edge data extraction is performed on the second image to obtain second edge data. The second edge data is a second edge matrix of the same size as the second image, and the second edge matrix is used to represent the edge information of the second image. In this second edge matrix (i.e., the second edge data), the value of each pixel represents the edge strength or gradient size of the position where the pixel is located in the second image, usually a grayscale value. This second edge matrix can be regarded as a description of the edge image corresponding to the second image.
[0056] Exemplarily, the size or resolution of image 1 is 1024*1024, that is, the image 1 has 1024 pixels in both the horizontal and vertical directions. The 1024*1024 image 1 can be represented by a 1024*1024 pixel matrix. The pixel matrix contains the pixel value of each pixel in image 1. For example, in the 1024*1024 pixel matrix, the value of the pixel (1,2) in the 1st row and 2nd column represents the color or grayscale value of the pixel. If image 1 is a grayscale image, the pixel value of each pixel is usually an integer between 0 and 255, representing the grayscale value of the pixel. If image 1 is an RGB color image, the pixel value of each pixel is usually a vector composed of the values of the three channels of red, green, and blue, and the value of each channel is an integer between 0 and 255. Then, the size of the pixel matrix of the image 1 with a size of 1024*1024 is 1024*1024, and the size of the edge data (ie, the edge matrix) corresponding to the image 1 is also 1024*1024.
[0057] S30 , matching the first edge data with the second edge data, and determining edge data in the first edge data that matches the second edge data as matching edge data.
[0058] In the disclosed embodiment, matching processing is performed on the first edge data of the first image and the second edge data of each second image. For each second image, edge data that matches the second image is obtained from the first edge data, thereby obtaining matched edge data that matches the second edge data of each second image.
[0059] In an optional embodiment, an image registration algorithm is used to match the first edge data with the second edge data. Edge data that matches the second edge data is found from the first edge data and used as the matching edge data corresponding to the second edge data. The image registration algorithm can be an affine transformation algorithm, which is merely an example and is not limited in this disclosure.
[0060] In the embodiment of the present disclosure, the size of the first image is larger than the size of each second image.
[0061] Exemplarily, the size of the first image is 1024*1024, and the size of the first edge data of the first image, such as image 1, is 1024*1024. The three second images are image 2, image 3, and image 4, and their respective sizes are 200*300, 100*200, and 400*500, respectively. Correspondingly, the sizes of the second edge data of the three second images are 200*300, 100*200, and 400*500, respectively.
[0062] For example, to match 1024*1024 first edge data with 200*300 second edge data, we need to find a 200*300 piece of edge data within the 1024*1024 first edge data. This piece of edge data matches the 200*300 second edge data, indicating similarity. For example, in the 1024*1024 first edge data (referred to as matrix N), the edge data in the region containing coordinates (701,201), (701,500), (901,201), and (900,500) matches the 200*300 second edge data. The matching edge data for this second edge data is matrix N[701:900,201:500]. N[701:900,201:500] represents the data block from columns 201 to 500 and rows 701 to 900 in matrix N.
[0063] S40: Determine the position information of the position of the matching edge data in the first edge data as the target position information corresponding to the second image. The target position information is used to indicate the matching position of the corresponding second image in the first image.
[0064] In the disclosed embodiment, for each second image, the position information of the location of the matching edge data corresponding to the second edge data in the first edge data is determined as the target position information corresponding to the second image, wherein the target position information is used to indicate the matching position of the corresponding second image in the first image.
[0065] For example, in the above example, the first edge data (referred to as matrix N) is 1024*1024, and the matching edge data that matches the second edge data is matrix N[701:900,201:500]. Then the position information of the matching edge data in matrix N is [701:900,201:500]. That is, the target position information corresponding to the second image is [701:900,201:500].
[0066] S50 , stitching the second images according to the target position information corresponding to the second images to obtain a stitched target stitched image.
[0067] In the embodiment of the present disclosure, the target position information corresponding to each second image is obtained based on the above steps.
[0068] A possible implementation method is to create a blank image with the same size as the first image. The blank image can be understood as an image without any image information. The pixel value of each pixel in the blank image can be 255 or other specific values. This is only an example, and the present disclosure does not impose any restrictions on this. Subsequently, for each second image, the pixel value of the pixel area corresponding to the target position information in the blank image is replaced with the pixel value of the second image (that is, the second image is spliced into the blank image) to obtain an intermediate spliced image in the splicing process. After the splicing process is completed for all the second images, the obtained spliced image is the target spliced image.
[0069] Below, in combination with Figures 2, 3, and 4, an exemplary description of the image stitching effect provided by one embodiment of the present disclosure is provided. Figure 2 is a schematic diagram of a first image provided by one embodiment of the present disclosure, Figure 3 is a schematic diagram of multiple second images provided by one embodiment of the present disclosure, and Figure 4 is a schematic diagram of a target stitched image provided by one embodiment of the present disclosure.
[0070] As shown in Figure 2, the first image can be a schematic diagram of a game scene designed by an art designer, and the image elements in the first image include a house, a forest, a cluster of balloons, a running figure, a football, and a small flower. As shown in Figure 3, the multiple second images are respectively an image of a house, an image of a forest, an image of a balloon, an image of a running figure, an image of a football, and an image of a small flower. It should be noted that the size of each second image is the same as the size of the corresponding image element in the first image, and the second images used in the embodiment of the present disclosure have no black borders. Each second image in Figure 2 has a black border, which is to facilitate observation of the size and shape (i.e., rectangle) of the second image. For example, the size of the football image in Figure 3 is the same as the size of the football (image element) in the first image in Figure 2. Taking Figure 2 as the first image, according to the image stitching method provided in the embodiment of the present disclosure, the target stitching image obtained by stitching the multiple second images in Figure 3 is shown in Figure 4. It can be seen that the target stitching image in Figure 4 is completely consistent with the image content and the position of each image element of the first image in Figure 2.
[0071] In the image stitching method provided by the embodiment of the present disclosure, a first image and a plurality of second images to be stitched are obtained, and the first image contains the same image elements as those of the second image. Edge data of the first image and the second image are extracted to obtain first edge data of the first image and second edge data of the second image. The first edge data and the second edge data are matched, and the edge data in the first edge data that matches the second edge data is determined as the matching edge data. The position information of the position of the matching edge data in the first edge data is determined as the target position information corresponding to the second image. The target position information is used to indicate the matching position of the corresponding second image in the first image. According to the target position information corresponding to each second image, each second image is stitched to obtain a target stitched image after stitching.
[0072] Compared with the above-mentioned related technologies, the present disclosure adopts a method of position matching the second edge data of the second image with the first edge data of the first image to find the matching edge data that matches the second edge data from the first edge data. The position of the matching edge data in the first edge data is used as the target position information corresponding to the second image. In other words, the target position information corresponding to the second image indicates the matching position of the second image in the first image. Subsequently, according to the target position information corresponding to each second image, each second image is spliced to obtain a target spliced image after splicing. In the present disclosure, the splicing of each second image can be automatically achieved to obtain a target spliced image with the same image content as the first image. This automated method can significantly improve the efficiency of image splicing and greatly reduce the manpower and time costs. In addition, it also avoids the problem of poor splicing effect due to manual splicing errors and inaccuracies, thereby better controlling the quality of image splicing.
[0073] Based on the above embodiments, the image stitching method provided by the embodiments of the present disclosure is further described below.
[0074] In an optional implementation, before edge data extraction is performed on the first image and the second image, the method further includes the step of adjusting the color of transparent pixels in each second image to a target color.
[0075] In the above description, the target color is a pure color, such as black, dark blue, etc. This is only an example. The embodiment of the present disclosure does not impose any limitation on the target color, as long as the image edge of the second image after color adjustment can be made more obvious.
[0076] In the embodiment of the present disclosure, the shapes of the first image and the second image are both rectangular. Among them, the edges of some second images appear irregular, or there is semi-transparent image content in the second image, or there is a hollow area in the second image. Among them, there is a second image with a hollow area (transparent pixels in the middle area of the image content), for example, a second image of a tire, in which the pixels in the hollow area in the middle of the tire are transparent pixels. It should be noted that such irregular edges, semi-transparent pixels, and transparent pixels will affect the accuracy of edge data extraction of the second image. Among them, there are transparent pixels in the area between the irregular edge and the rectangle. Semi-transparent images have pixels with a gradual transition process, such as images of scarves, soap bubbles, etc., which have a semi-transparent effect. For images with a semi-transparent effect (such as soap bubble images), if its edge data is directly extracted, the extracted edge data will be inaccurate due to the influence of the semi-transparent pixels in its pixels. Therefore, all fully transparent pixels are also changed to black pixels. When edge data is extracted from the adjusted second image in this way, the accuracy of edge data extraction can be improved.
[0077] In an optional implementation manner, an implementation of step S30 includes steps S301-S303:
[0078] S301 : Divide the first edge data into a plurality of edge data blocks, where the size of the edge data blocks is the same as the size of the second edge data.
[0079] As described above, the first edge data is divided into a plurality of edge data blocks having the same size as the second edge data.
[0080] In an optional embodiment, the first edge data is divided into a plurality of data blocks (i.e., edge data blocks) of the same size as the second edge data. A sliding window or other segmentation method can be used to move on the first edge data and intercept data blocks of the same size as the second edge data.
[0081] For example, the size of a first image is 1024*1024, and the size of the first edge data of this first image, such as Image 1, is also 1024*1024. The size of one of the second images is 400*500, and the size of the second edge data corresponding to this second image is also 400*500. Therefore, a sliding window approach can be used to segment the 1024*1024 first edge data into multiple 400*500 edge data blocks.
[0082] S302: Calculate the matching degree between each edge data block and the second edge data.
[0083] In the disclosed embodiment, similarities between each edge data block and the second edge data can be calculated, such as Euclidean distance, cosine similarity, etc. These similarities can be used to characterize the degree of similarity between the edge data block and the second edge data. The degree of matching between them is then determined based on the similarity. The matching degree is positively correlated with the similarity, i.e., the greater the similarity, the greater the matching degree, and conversely, the smaller the similarity, the smaller the matching degree.
[0084] S303 : Determine a target edge data block from all edge data blocks according to a matching degree between the edge data block and the second edge data as matching edge data.
[0085] In the embodiment of the present disclosure, the edge data block with the greatest matching degree with the second edge data is determined as the target edge data block, and the target edge data block is used as the matching edge data corresponding to the second edge data.
[0086] In the embodiment of the present disclosure, since the first edge data of a larger size is divided into multiple edge data blocks of the same size as the second edge data, it is possible to more accurately find edge data blocks with a high degree of matching with the second edge data from the first edge data, and the multiple edge data blocks after the division can be matched with the second edge data at the same time and the matching degree between them can be calculated, which greatly improves the accuracy and speed of the matching degree calculation.
[0087] In an optional embodiment, each edge data block corresponds to a piece of first position information, and the first position information corresponding to the edge data block is used to indicate the position of the edge data block in the first edge data. For example, if the first edge data is a matrix, the first position information corresponding to the edge data block is the position of the edge data block in the matrix, such as the position from which row to which row, and from which column to which column.
[0088] An implementation of step S40 may include step S401:
[0089] S401: Determine first position information corresponding to the matched edge data as target position information corresponding to the second image.
[0090] In the disclosed embodiment, the above steps implement finding the matching edge data for each second edge data in the first edge data for each second image. This indicates that the position of the second image in the first image is the same as the position of its corresponding matching edge data in the first edge data. Therefore, the first position information corresponding to the matching edge data is determined as the target position information corresponding to the second image. This helps to accurately locate the position of the second image in the first image, which provides a strong guarantee for subsequently stitching together multiple second images to obtain a target stitched image that has the same or similar appearance as the first image.
[0091] In an optional implementation manner, an implementation of step S303 may include steps S3031-S3032:
[0092] S3031. Among the matching degrees between all edge data blocks and the second edge data, if there is a matching degree greater than a first matching threshold, determine the edge data block with the greatest matching degree with the second edge data as the target edge data block.
[0093] As mentioned above, the first matching threshold is a matching threshold used to indicate a successful match between the second edge data and the edge data block.
[0094] In the embodiment of the present disclosure, when there is a degree of match greater than a first matching threshold, the edge data block with the greatest degree of match with the second edge data, from among at least one edge data block having a degree of match with the second edge data greater than the first matching threshold, is determined as the target edge data block. A higher degree of match means that the second edge data and the edge data block are more similar in data (i.e., the second image and the image content corresponding to the edge data block are more similar). Determining the edge data block with the greatest degree of match with the second edge data as the target edge data block can increase the reliability and accuracy of the matching result.
[0095] S3032: If no matching degree greater than a first matching threshold exists among all the matching degrees between the edge data blocks and the second edge data, feature extraction is performed on each of the first image and the second image to obtain first feature point data for the first image and second feature point data for the second image. A target edge data block is determined based on the matching degrees between the edge data blocks and the second edge data, as well as the first feature point data and the second feature point data.
[0096] In the embodiment of the present disclosure, a preset feature extraction algorithm may be used to extract feature points from the first image and each second image to obtain first feature point data for the first image and second feature point data for the second image. The preset feature extraction algorithm may be SIFT, SURF, ORB, etc. These are examples only and are not limited in the embodiment of the present disclosure.
[0097] In the embodiment of the present disclosure, among the matching degrees between all edge data blocks and the second edge data, there is no matching degree greater than the first matching threshold, which indicates that the matching degrees of all edge data blocks and the second edge data are low. In other words, the edge data matching method alone cannot find the edge data block that matches the second edge data in the first edge data of the first image. In view of this situation, it is considered to further adopt the feature point matching method to find the edge data block that matches the second edge data. Specifically, feature extraction is performed on the first image and the second image respectively to obtain the first feature point data of the first image and the second feature point data of the second image. Based on the matching degree between the edge data block and the second edge data, as well as the first feature point data and the second feature point data, the target edge data block is determined.
[0098] In the embodiment of the present disclosure, considering that the edge data does not include the color information of the image, color matching is not performed during the process of matching the edge data block with the second edge data. In the case that all the above-mentioned edge data blocks fail to successfully match the second edge data, it is considered to use feature point matching to make up for the deficiency of the edge data matching lacking color matching. In combination with feature point matching, the feature point data in the image area corresponding to each edge data block is matched with the second feature point data of the second image. The edge data block corresponding to the feature point data with the highest degree of feature point matching with the second feature point data of the second image is determined as the target edge data block corresponding to the second edge data, that is, the matching edge data corresponding to the second edge data.
[0099] In an optional embodiment, a possible implementation of "determining the target edge data block based on the matching degree between the edge data block and the second edge data, and the first feature point data and the second feature point data" in step S3032 includes the following steps S3032-1 to S3032-5:
[0100] S3032-1. Sort the matching degrees in descending order to obtain a first ranking.
[0101] In an embodiment of the present disclosure, among the matching degrees between all edge data blocks and the second edge data, if there is no matching degree greater than a first matching threshold, the matching degrees between all edge data blocks and the second edge data are sorted in descending order to obtain a first sorting of the matching degrees.
[0102] S3032-2: Determine the edge data blocks corresponding to the preset number of matching degrees before the first sort as the first edge data blocks.
[0103] In the disclosed embodiment, edge data blocks corresponding to a preset number of matching degrees before the first sort are determined as first edge data blocks. Subsequently, feature point matching is performed on the image regions corresponding to the preset number of first edge data blocks and the second image. This allows the image region with the highest degree of feature point matching with the second image to be quickly found, and the edge data block corresponding to this image region is determined as the target edge data block. In addition, since only the feature points of the image regions corresponding to a small number of edge data blocks need to be matched with the second feature points, the computational complexity is greatly reduced, further improving the efficiency and accuracy of feature point matching.
[0104] S3032-3. From the first feature point data of the first image, determine the feature point data located in the first image region indicated by the first edge data block as the feature point data corresponding to the first edge data block.
[0105] In the embodiment of the present disclosure, feature extraction is performed on the first image or the second image, and the obtained feature point data generally includes feature point position, scale, direction angle, feature vector (or feature descriptor), etc.
[0106] The following is an example of feature point data obtained by feature extraction of an image, which can be seen in Table 1.
[0107] Table 1
[0108] In the embodiment of the present disclosure, from the first feature point data of the first image, the feature point data located in the first image region indicated by the first edge data block is determined as the feature point data corresponding to the first edge data block.
[0109] For example, in conjunction with Table 1, the feature points in Table 1 are used as the first feature point data for the first image. For example, if the first image region indicated by one of the second edge data is a region defined by the position coordinates (100, 200), (200, 200), (100, 300), and (200, 300), then the feature points in Table 1 located within the first image region are the feature points numbered 3 and 4. Therefore, the feature point data for the feature points numbered 3 and 4 are determined as the feature point data corresponding to the first edge data block.
[0110] S3032-4. Match the feature point data corresponding to the first edge data block with the second feature point data of the second image, and determine the number of feature points in the feature point data corresponding to the first edge data block that match the second feature point data.
[0111] In the embodiment of the present disclosure, a preset feature point matching algorithm can be used to match the feature point data corresponding to the first edge data block with the second feature point data of the second image, and determine the number of feature points in the feature point data corresponding to the first edge data block that match the second feature point data. The preset feature point matching algorithm can be a nearest neighbor matching algorithm, an approximate nearest neighbor matching algorithm, or the like, which are examples only and are not limited in the embodiment of the present disclosure.
[0112] S3032-5. From a preset number of first edge data blocks, determine the first edge data block having the largest number of feature points matching the second image as the target edge data block.
[0113] In the disclosed embodiment, for each of the preset number of first edge data blocks, the feature point data corresponding to each first edge data block is matched with the second feature point data of the second image, and the number of feature points in the feature point data corresponding to each first edge data block that match the second feature point data is determined. Finally, the first edge data block with the largest number of feature points matching the second image is determined as the target edge data block. This ensures that the image content corresponding to the target edge data block has the highest degree of match with the second image, thereby improving the accuracy and reliability of the matching results.
[0114] In an optional implementation manner, after the step of “stitching the second images to obtain a target stitched image”, the image stitching method provided in the embodiment of the present disclosure further includes steps S601-S605:
[0115] S601: Determine whether the second images have an overlapping relationship based on target position information corresponding to each second image, where the overlapping relationship indicates that overlapping display areas exist between display areas of different second images in a target spliced image.
[0116] In the disclosed embodiment, in the target stitched image, based on the target position information corresponding to each second image, it is determined whether any two second images have an overlapping relationship in the target stitched image. If there is an overlapping display area between the display areas of the two second images in the target stitched image, it indicates that the two second images have an overlapping relationship. Conversely, if there is no overlapping display area between the display areas of the two second images in the target stitched image, it indicates that the two second images do not have an overlapping relationship.
[0117] It should be noted that the second images are stitched together according to the target position information 1 corresponding to the second images. That is, the second image is displayed in the area corresponding to the target position information 1 in the target stitched image obtained after stitching. Therefore, the area where the second image is displayed in the target stitched image is the same area as the area corresponding to the target position information in the target stitched image.
[0118] Exemplarily, the two second images are image 11 and image 12, the display area of image 11 in the target stitched image is [100:200, 200:300] (i.e., the area determined by the position coordinates (100, 200), (200, 200), (100, 300), (200, 300)), and the display area of image 12 in the target stitched image is [50:150, 150:220] (i.e., the area determined by the position coordinates (50, 150), (150, 150), (50, 220), (150, 220)). Then, there is an overlapping area [100:150, 200:220] (i.e., the area determined by the position coordinates (100, 200), (150, 200), (100, 220), (150, 220)). Therefore, the image 11 and the image 12 are in an overlapping relationship.
[0119] In the disclosed embodiment, determining whether any second images have an overlapping relationship can be performed by obtaining a relationship matrix K of size k*k. Here, k is the number of second images. The value of K(i, j) in the matrix K is used to indicate whether there is an overlapping relationship between the i-th second image and the j-th second image. For example, the value of K(i, j) can be 0 or 1, where 1 indicates an overlapping relationship and 0 indicates no overlapping relationship. This is merely an example and is not limited in the disclosed embodiment.
[0120] S602: For two target second images that have an overlapping relationship, determine an occlusion area between the two target second images.
[0121] In the above description, the two target second images refer to two second images having an overlapping relationship.
[0122] In the embodiment of the present disclosure, the occlusion region between two target second images refers to a region where the image content of one target second image is occluded by the image content of the other target second image.
[0123] S603: Determine whether the image in the target stitched image located in the occlusion area is consistent with the image in the first image located in the occlusion area. If they are consistent, execute step S604; if not, execute step S605.
[0124] S604: Retain and use the display levels of the two current target second images.
[0125] S605 : Adjust the display levels of the two target second images until the images in the two target second images located in the occlusion area are consistent with the image in the first image located in the occlusion area.
[0126] In the disclosed embodiment, when there is an overlapping relationship between two second images in the target stitched image, the occlusion region between the two overlapping target second images is first determined. A determination is made as to whether the image of the occlusion region in the target stitched image is consistent with the image of the occlusion region in the first image. If they are consistent, the display levels of the two target second images are retained and used. If they are inconsistent, the display levels of the two target second images are adjusted until the images of the occlusion regions in the two target second images are consistent with the images of the occlusion regions in the first image.
[0127] Exemplarily, there is an overlapping area [100:150,200:220] between Figure 11 and Figure 12 (i.e., the area determined by the position coordinates (100,200), (150,200), (100,220), and (150,220)). Moreover, the occlusion area between Figure 11 and Figure 12 is the area determined by [110:125,210:215]. At this time, the display level of Figure 11 in the target image is 1, and the display level of Figure 12 is 2. Among them, the larger the value of the display level, the higher the display level. On the contrary, the smaller the value of the display level, the lower the display level. In other words, the current Figure 12 is displayed on the upper layer of Figure 11. An image located in the occlusion area [110:125, 210:215] in the target stitched image is acquired, and an image located in the occlusion area [110:125, 210:215] in the first image is acquired.
[0128] Determine whether the image content in the occlusion area [110:125, 210:215] of the target stitched image is consistent with the image content in the occlusion area [110:125, 210:215] of the first image. If they are consistent, it indicates that the image content in the occlusion area [110:125, 210:215] of the target stitched image is currently the same as the image content in the occlusion area [110:125, 210:215] of the first image. In this case, the display levels of the two target second images are retained and continued to be used. If they are consistent, it indicates that the image content in the occlusion area [110:125, 210:215] of the target stitched image is currently different from the image content in the occlusion area [110:125, 210:215] of the first image. In this case, the display levels of the two target second images are adjusted. For example, the display level of image 11 is adjusted from 1 to 2, and the display level of image 12 is adjusted from 2 to 1.
[0129] After adjustment, the current image 11 is displayed on the upper layer of image 12. In this way, after the display level is adjusted, it is determined again whether the image content located in the occlusion area [110:125,210:215] in the target stitched image is consistent with the image content located in the occlusion area [110:125,210:215] in the first image. If they are consistent, the display level of each current target second image is retained. If they are inconsistent, it is necessary to further determine whether there are other second images in the occlusion area. In other words, after adjusting the display level, there is still a situation where the image content located in the occlusion area in the target stitched image is inconsistent with the image content located in the occlusion area in the first image. This is because there are other second images displayed in this occlusion area. A solution to this situation may be to adjust the display level of the other second images.
[0130] In an optional implementation manner, the implementation of “determining the occlusion region between the two target second images” in the above step 602 includes step S6021:
[0131] S6021: In the overlapping display area between the two target second images, determine an area between the two target second images where non-transparent pixels are occluded as an occluded area between the two target second images.
[0132] In the embodiment of the present disclosure, in the overlapping display area between the two target second images, an area (referred to as area 1) where non-transparent pixels exist in one target second image and an area (referred to as area 2) where non-transparent pixels exist in the other target second image are found, and the overlapping area between area 1 and area 2 is referred to as overlapping area 1. In other words, overlapping area 1 is the area between the two target second images where non-transparent pixels obstruct each other, and therefore overlapping area 1 is determined as the obstructed area between the two target second images.
[0133] In the embodiment of the present disclosure, only the area where non-transparent pixels are occluded between the two target second images is determined as the occluded area between the two target second images. In this way, if an area (called area 3) of transparent pixels in a second image (called image 3) is occluded by another second image (called image 4), in this case, there is no need to adjust the display levels of the two second images. Because no matter which of the two second images is on top and which is on the bottom of the display level, in area 3 of the target spliced image, image 3 has no substantial image content (i.e., transparent pixels, no image content), and the content that is always displayed in area 3 is the content of image 4. Therefore, this can avoid the need for display level adjustment for a part, thereby further reducing the amount of calculation, saving computing resources, and improving computing efficiency.
[0134] In an optional embodiment, the second images are different from each other, and each second image appears at least once in the first image. Each second image corresponds to a matching number, and the matching number is equal to the number of times the corresponding second image appears in the first image. A possible implementation of "determining the target edge data block based on the matching degree between the edge data block and the second edge data" in step S303 includes step S3034:
[0135] S3034: Determine a matching number of target edge data blocks based on the matching degree between the edge data block and the second edge data, wherein each second image includes a corresponding matching number of target edge data blocks.
[0136] In the disclosed embodiments, some second images may appear multiple times in the first image, each in different regions. To ensure that the target stitched image after stitching the second images is completely consistent with the image content of the first image, it is necessary to stitch the second images multiple times for each second image that appears multiple times in the first image. For example, if the second image (referred to as image 5) appears three times in the first image, then image 5 needs to be stitched three times, each stitched into the corresponding region.
[0137] Therefore, it is necessary to obtain a matching number corresponding to each second image, where the matching number is equal to the number of times the corresponding second image appears in the first image. Subsequently, a matching number of target edge data blocks is determined based on the degree of matching between the edge data block and the second edge data. In this way, a matching number of target edge data blocks can be determined for the second edge data of each second image based on the number of times each second image appears in the first image, that is, the matching number of target edge data blocks corresponding to the second image. This can subsequently avoid the problem of missing a second image in a certain display area of the target spliced image, thereby improving the consistency of the target spliced image with the first image.
[0138] In an optional implementation manner, an implementation of step 3034 includes steps S3034-1 to S3034-2:
[0139] S3034-1. Sort the matching degrees between all edge data blocks and the second edge data from largest to smallest to obtain a second sort.
[0140] S3034-2. Determine the edge data blocks corresponding to the first matching number of matching degrees in the second sort as target edge data blocks.
[0141] In the disclosed embodiment, the number of matches corresponding to each second image is obtained. For each second edge data block in the second edge data of each second image, the matching degrees between all edge data blocks and the second edge data block are sorted from largest to smallest to obtain a second sort. The edge data blocks corresponding to the first matching number of matching degrees in the second sort are determined as the matching number of target edge data blocks corresponding to the second image.
[0142] In an optional implementation manner, another implementation of step 3034 includes steps S3034-3 to S3034-5:
[0143] S3034-3. Sort the matching degrees between all edge data blocks and the second edge data from largest to smallest to obtain a third sort.
[0144] S3034-4. Determine a first number of matching degrees greater than a second matching threshold based on the matching degrees between all edge data blocks and the second edge data.
[0145] S3034-5. Determine a matching number of target edge data blocks according to the first number, the matching number, and the third ranking.
[0146] In an embodiment of the present disclosure, a matching number of target edge data blocks is determined for the second image from the third sorting according to the first number and the size of the matching data.
[0147] In an optional implementation manner, a possible implementation of step S3034-5 includes steps A1-A4:
[0148] A1. When the first number is greater than or equal to the matching number, the edge data blocks corresponding to the first matching number of matching degrees in the third sort are determined as target edge data blocks.
[0149] A2. Perform feature extraction on the first image and the second image to obtain third feature point data of the first image and fourth feature point data of the second image.
[0150] A3. If the first number is less than the matching number and greater than zero, determine the edge data blocks corresponding to the first matching number of matching degrees in the third sort as the matching number of target edge data blocks. Furthermore, determine a second number of target edge data blocks based on the matching degree between the edge data block and the second edge data, as well as the third feature point data and the fourth feature point data, where the second number is the difference between the first number and the matching number.
[0151] In the disclosed embodiment, the description and explanation of the step "determining the target edge data block based on the degree of match between the edge data block and the second edge data, as well as the third feature point data and the fourth feature point data" can be referred to the description and explanation of steps S3032-2 to S3032-5 above. The implementation method is similar and will not be repeated here. In specific implementation, the "first feature data point" in steps S3032-2 to S3032-5 is replaced with the "third feature data point", and the "second feature data point" is replaced with the "fourth feature data point".
[0152] It should also be noted that step S3032-5 needs to be adjusted here, and the adjustment is: from the preset number of first edge data blocks, the first second number of first edge data blocks with the largest number of matching feature points with the second image are determined as target edge data blocks.
[0153] A4. When the first number is zero, determine a matching number of target edge data blocks based on the matching degree between the edge data block and the second edge data, as well as the third feature point data and the fourth feature point data.
[0154] In the disclosed embodiment, the description and explanation of the step "determining the target edge data block based on the degree of match between the edge data block and the second edge data, as well as the third feature point data and the fourth feature point data" can be referred to the description and explanation of steps S3032-2 to S3032-5 above. The implementation method is similar and will not be repeated here. In specific implementation, the "first feature data point" in steps S3032-2 to S3032-5 is replaced with the "third feature data point", and the "second feature data point" is replaced with the "fourth feature data point".
[0155] It should also be noted that step S3032-5 needs to be adjusted here, and the adjustment is: from the preset number of first edge data blocks, the first edge data blocks with a larger number of matching feature points with the second image are determined as target edge data blocks.
[0156] Below, in conjunction with Figures 5 to 7, an exemplary description of the image stitching effect provided by one embodiment of the present disclosure is provided. Figure 5 is a schematic diagram of a first image provided by another embodiment of the present disclosure, Figure 6 is a schematic diagram of multiple second images and the corresponding matching numbers of each second image provided by another embodiment of the present disclosure, and Figure 7 is a schematic diagram of a target stitched image provided by another embodiment of the present disclosure.
[0157] As shown in Figure 5, the first image can be a schematic diagram of a game scene designed by an art designer. The image elements in the first image include a house, a forest, three clusters of balloons, three running figures, a football, and two small flowers. As shown in Figure 6, multiple second images and the number of matches corresponding to each second image are shown. The multiple second images are respectively an image of a house, an image of a forest, an image of a cluster of balloons, an image of a running figure, an image of a football, and an image of a small flower. The number of matches corresponding to the multiple images is: 1, 1, 3, 3, 1, 2. It should be noted that the size of each second image is the same as the size of the corresponding image element in the first image, and the second images used in the embodiment of the present disclosure do not have a black border. Each second image in Figure 6 has a black border. This is to facilitate observation of the size and shape (i.e., a rectangle) of the second image. For example, the size of the football image in Figure 6 is the same as the size of the football (image element) in the first image in Figure 5. Taking Figure 5 as the first image, the target spliced image obtained by splicing the multiple second images in Figure 5 using the image splicing method provided by the embodiment of the present disclosure is shown in Figure 7. It can be seen that the target stitched image in FIG7 is completely consistent with the first image in FIG5 in terms of image content and the position and number of each image element.
[0158] In an optional implementation manner, the image stitching method provided in the embodiment of the present disclosure further includes the following steps S701-S703:
[0159] S701: Obtain UI elements corresponding to each second image.
[0160] S702: Determine the target position information and display level of the second image as the target position information and display level of the UI element corresponding to the second image.
[0161] S703 : Creating a resource node for each UI element in a rendering engine according to the target position information and display level of each UI element, and obtaining a target UI interface corresponding to the target spliced image.
[0162] As mentioned above, a rendering engine is a specialized engine for processing and presenting 3D graphics. It provides a series of functions and algorithms for converting 3D geometric models, materials, lighting, and other data into realistic 2D images or animations. Common 3D rendering engines include Unity3D, Unreal Engine, OpenGL, and DirectX. These engines are widely used in game development, film special effects production, virtual reality, and other fields, enabling highly realistic 3D graphics rendering and interactive experiences.
[0163] In the disclosed embodiment, the UI elements corresponding to each second image are first obtained. By obtaining the target position information and display level of each second image, the UI elements corresponding to each second image can be placed in the correct position and rendered at the correct level. This can prevent overlapping, misaligned, or blocked UI elements, providing a more accurate and intuitive target UI interface.
[0164] Furthermore, by placing UI elements into a rendering engine for processing, the UI elements are mapped to resource nodes in the rendering engine. With the help of the rendering engine technology, the efficiency of image stitching can be significantly improved.
[0165] In addition, it is also convenient for dynamic updating and interactive operations of the UI interface. For example, the properties and status of UI elements can be modified according to user input or program logic, and reflected in the target mosaic image in real time, increasing the interactivity and real-time nature of the interface.
[0166] Next, the game interface splicing tool provided by an embodiment of the present disclosure will be described in conjunction with FIG8 . FIG8 is a schematic diagram of an interface of the game interface splicing tool provided by one embodiment of the present disclosure.
[0167] In an embodiment of the present disclosure, a stitching tool for assisting in drawing a UI interface for implementing the image stitching method provided by an embodiment of the present disclosure in a rendering engine such as Unity in the form of a plug-in is also provided. As shown in Figure 8, it includes an interface before importing (a first image and multiple second images), and an interface after importing (a first image and multiple second images). The interface of each stitching tool includes an area for importing the first image, and an area for importing the second image and the image information of the second image. Among them, the image information includes the display level and matching quantity information corresponding to the first and second images. After the first image and multiple second images are successfully imported, the target stitched image can be automatically generated by triggering the "OK" control.
[0168] The image stitching device provided by the present disclosure is described below. The image stitching device described below and the image stitching method described above can be referenced to each other.
[0169] FIG9 is a schematic diagram of the structure of an image stitching device provided by one embodiment of the present disclosure. As shown in FIG9 , the image stitching device 900 includes: an acquisition module 901 , a processing module 902 , a matching module 903 , a determination module 904 , and a stitching module 905 .
[0170] an acquisition module configured to acquire a first image and a plurality of second images to be stitched, wherein the first image contains the same image elements as those in the second image;
[0171] a processing module configured to extract edge data from the first image and the second image respectively to obtain first edge data of the first image and second edge data of the second image;
[0172] a matching module configured to match the first edge data and the second edge data, and determine edge data in the first edge data that matches the second edge data as matching edge data;
[0173] a determination module configured to determine position information of a position of the matching edge data in the first edge data as target position information corresponding to the second image; the target position information is used to indicate a matching position of the corresponding second image in the first image;
[0174] The stitching module is configured to stitch the second images together according to target position information corresponding to the second images to obtain a stitched target stitched image.
[0175] Optionally, the matching module is specifically configured to:
[0176] dividing the first edge data into a plurality of edge data blocks, wherein the size of the edge data blocks is the same as the size of the second edge data;
[0177] Calculating a matching degree between each edge data block and the second edge data;
[0178] From all the edge data blocks, a target edge data block is determined according to a matching degree between the edge data block and the second edge data as matching edge data.
[0179] Optionally, the matching module is specifically configured to:
[0180] Among the matching degrees between all the edge data blocks and the second edge data, if there is a matching degree greater than a first matching threshold, determining the edge data block with the greatest matching degree with the second edge data as the target edge data block; or
[0181] If, among all the matching degrees between the edge data blocks and the second edge data, no matching degree is greater than the first matching threshold, performing feature extraction on the first image and the second image to obtain first feature point data of the first image and second feature point data of the second image;
[0182] A target edge data block is determined according to the matching degree between the edge data block and the second edge data, and the first feature point data and the second feature point data.
[0183] Optionally, the matching module is specifically configured to:
[0184] Sorting the matching degrees in descending order to obtain a first ranking;
[0185] Determining edge data blocks corresponding to a preset number of matching degrees before the first sort as first edge data blocks;
[0186] determining, from the first feature point data of the first image, feature point data located in the first image region indicated by the first edge data block as feature point data corresponding to the first edge data block;
[0187] Matching the feature point data corresponding to the first edge data block with the second feature point data of the second image, and determining the number of feature points in the feature point data corresponding to the first edge data block that match the second feature point data;
[0188] From the preset number of first edge data blocks, a first edge data block having the largest number of feature points matching the second image is determined as a target edge data block.
[0189] Optionally, the determining module is further configured to:
[0190] determining, based on target position information corresponding to each second image, whether the second images have an overlapping relationship, wherein the overlapping relationship indicates that there is an overlapping display area between display areas of different second images in the target stitched image;
[0191] For two target second images having an overlapping relationship, determining an occlusion area between the two target second images;
[0192] determining whether the image located in the occlusion area in the target stitched image is consistent with the image located in the occlusion area in the first image;
[0193] If they are consistent, retaining and using the respective display levels of the two current target second images;
[0194] If they are inconsistent, the display levels of the two target second images are adjusted until the images in the two target second images located in the occlusion area are consistent with the image in the first image located in the occlusion area.
[0195] Optionally, the determining module is further configured to:
[0196] In the overlapping display area between the two target second images, an area between the two target second images where non-transparent pixels are occluded is determined as an occlusion area between the two target second images.
[0197] Optionally, the second images are different from each other, and each second image appears at least once in the first image. Each second image corresponds to a matching number, and the matching number is equal to the number of times the corresponding second image appears in the first image.
[0198] The matching module is further configured to:
[0199] The matching number of target edge data blocks is determined according to the matching degree between the edge data block and the second edge data; wherein each second image includes a corresponding matching number of target edge data blocks.
[0200] Optionally, the matching module is specifically configured to:
[0201] Among the matching degrees between all the edge data blocks and the second edge data, sorting the matching degrees from largest to smallest to obtain a second sorting;
[0202] The edge data blocks corresponding to the aforementioned matching number of matching degrees in the second sorting are determined as target edge data blocks.
[0203] Optionally, the matching module is specifically configured to:
[0204] sorting the matching degrees between all the edge data blocks and the second edge data from largest to smallest to obtain a third sorting;
[0205] determining a first number of matching degrees greater than a second matching threshold based on matching degrees between all the edge data blocks and the second edge data;
[0206] The matching number of target edge data blocks is determined according to the first number, the matching number, and the third ranking.
[0207] Optionally, the matching module is specifically configured to:
[0208] In the case where the first number is greater than or equal to the matching number, the edge data blocks corresponding to the matching number in the third sorting are determined as target edge data blocks; or
[0209] performing feature extraction on the first image and the second image respectively to obtain third feature point data of the first image and fourth feature point data of the second image;
[0210] When the first number is less than the matching number and greater than zero, determining the edge data blocks corresponding to the first matching number of matching degrees in the third sort as the matching number of target edge data blocks; and determining a second number of target edge data blocks based on the matching degree between the edge data block and the second edge data, and the third feature point data and the fourth feature point data, where the second number is the difference between the first number and the matching number;
[0211] When the first number is zero, the matching number of target edge data blocks is determined according to the matching degree between the edge data block and the second edge data, and the third feature point data and the fourth feature point data.
[0212] Optionally, the device further includes a rendering module, and the rendering module is specifically configured to:
[0213] Obtaining UI elements corresponding to each second image;
[0214] Determining the target position information and display level of the second image as the target position information and display level of the UI element corresponding to the second image;
[0215] According to the target position information and display level of each UI element, a resource node is created for each UI element in a rendering engine to obtain a target UI interface corresponding to the target spliced image.
[0216] Optionally, each edge data block corresponds to a first position information, and the first position information corresponding to the edge data block is configured to indicate a position of the edge data block in the first edge data;
[0217] The determining module is specifically configured to:
[0218] The first position information corresponding to the matching edge data is determined as the target position information corresponding to the second image.
[0219] Optionally, the processing module is specifically configured to:
[0220] Adjust the color of the transparent pixels in the second image to the target color.
[0221] The image stitching device provided in this embodiment can be used to implement the technical solution of the above-mentioned image stitching method embodiment. Its implementation principle and technical effects are similar and will not be described in detail in this embodiment.
[0222] FIG10 is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present disclosure. As shown in FIG10 , the electronic device 1000 of this embodiment includes: a processor 1001 and a memory 1002;
[0223] Memory 1002, for storing computer-executable instructions;
[0224] The processor 1001 is configured to execute computer-executable instructions stored in the memory to implement the various steps of the image stitching method in the above embodiment. For details, please refer to the relevant description in the above method embodiment.
[0225] Optionally, the memory 1002 may be independent or integrated with the processor 1001 .
[0226] When the memory 1002 is independently provided, the electronic device further includes a bus 1003 for connecting the memory 1002 and the processor 1001 .
[0227] One embodiment of the present disclosure further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the technical solution corresponding to the image stitching method in any of the above embodiments is implemented by the electronic device.
[0228] One embodiment of the present disclosure further provides a computer program product, which includes: a computer program, which is stored in a readable storage medium. At least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the technical solution corresponding to the image stitching method in any of the above embodiments.
[0229] Although the present disclosure is disclosed as above in terms of preferred embodiments, it is not intended to limit the present disclosure. Any person skilled in the art may make possible changes and modifications without departing from the spirit and scope of the present disclosure. Therefore, the scope of protection of the present disclosure shall be based on the scope defined by the claims of the present disclosure.
[0230] In the several embodiments provided in the present disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is merely a logical function division. In actual implementation, there may be other division methods, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or module, which can be electrical, mechanical or other forms.
[0231] The integrated modules implemented in the form of software functional modules can be stored in a computer-readable storage medium. The software functional modules stored in a storage medium include instructions for causing an electronic device (which can be a personal computer, server, or network device, etc.) or a processor to perform some of the steps of the methods described in various embodiments of the present disclosure.
[0232] It should be understood that the processor described above may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), or application-specific integrated circuits (ASICs). A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly executed by a hardware processor or by a combination of hardware and software modules within the processor.
[0233] The memory may include a high-speed RAM memory, and may also include non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk.
[0234] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, the buses in the figures of this disclosure are not limited to just one bus or just one type of bus.
[0235] The storage medium may be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0236] Those skilled in the art will appreciate that all or part of the steps in the above-described method embodiments can be implemented using hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0237] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. An image stitching method, comprising: Acquire a first image and a plurality of second images to be stitched, wherein the first image contains the same image elements as those in the second image; Extracting edge data from the first image and the second image respectively to obtain first edge data of the first image and second edge data of the second image; matching the first edge data and the second edge data, and determining edge data in the first edge data that matches the second edge data as matching edge data; determining the position information of the position of the matching edge data in the first edge data as the target position information corresponding to the second image; the target position information is used to indicate the matching position of the corresponding second image in the first image; The second images are spliced according to the target position information corresponding to the second images to obtain a spliced target spliced image.
2. The method according to claim 1, wherein The matching of the first edge data and the second edge data, and determining edge data in the first edge data that matches the second edge data as matching edge data, includes: dividing the first edge data into a plurality of edge data blocks, wherein the size of the edge data blocks is the same as the size of the second edge data; Calculating a matching degree between each edge data block and the second edge data; From all the edge data blocks, a target edge data block is determined according to a matching degree between the edge data block and the second edge data as matching edge data.
3. The method according to claim 2, wherein: The step of determining a target edge data block from all the edge data blocks according to a matching degree between the edge data block and the second edge data includes: Among the matching degrees between all the edge data blocks and the second edge data, if there is a matching degree greater than a first matching threshold, determining the edge data block with the greatest matching degree with the second edge data as the target edge data block; or Among the matching degrees between all the edge data blocks and the second edge data, if there is no matching degree greater than the first matching threshold, feature extraction is performed on the first image and the second image respectively to obtain first feature point data of the first image and second feature point data of the second image; and a target edge data block is determined based on the matching degree between the edge data block and the second edge data, as well as the first feature point data and the second feature point data.
4. The method according to claim 3, wherein: The determining of a target edge data block according to the matching degree between the edge data block and the second edge data, and the first feature point data and the second feature point data, includes: Sorting the matching degrees in descending order to obtain a first ranking; Determining edge data blocks corresponding to a preset number of matching degrees before the first sort as first edge data blocks; determining, from the first feature point data of the first image, feature point data located in the first image region indicated by the first edge data block as feature point data corresponding to the first edge data block; Matching the feature point data corresponding to the first edge data block with the second feature point data of the second image, and determining the number of feature points in the feature point data corresponding to the first edge data block that match the second feature point data; From the preset number of first edge data blocks, a first edge data block having the largest number of feature points matching the second image is determined as a target edge data block.
5. The method according to claim 1, wherein After stitching the second images to obtain a stitched target image, the method further includes: determining, based on target position information corresponding to each second image, whether the second images have an overlapping relationship, wherein the overlapping relationship indicates that there is an overlapping display area between display areas of different second images in the target stitched image; For two target second images having an overlapping relationship, determining an occlusion area between the two target second images; determining whether the image located in the occlusion area in the target stitched image is consistent with the image located in the occlusion area in the first image; If they are consistent, retaining and using the respective display levels of the two current target second images; If they are inconsistent, the display levels of the two target second images are adjusted until the images in the two target second images located in the occlusion area are consistent with the image in the first image located in the occlusion area.
6. The method according to claim 5, wherein: The determining of the occlusion area between the two target second images includes: In the overlapping display area between the two target second images, an area between the two target second images where non-transparent pixels are occluded is determined as an occlusion area between the two target second images.
7. The method according to claim 2, wherein: The second images are different from each other, and each second image appears at least once in the first image. Each second image corresponds to a matching number, and the matching number is equal to the number of times the corresponding second image appears in the first image. The determining of the target edge data block according to the matching degree between the edge data block and the second edge data includes: The matching number of target edge data blocks is determined according to the matching degree between the edge data block and the second edge data; wherein each second image includes a corresponding matching number of target edge data blocks.
8. The method according to claim 7, wherein: The determining the matching number of target edge data blocks according to the matching degree between the edge data block and the second edge data includes: Among the matching degrees between all the edge data blocks and the second edge data, sorting the matching degrees from largest to smallest to obtain a second sorting; The edge data blocks corresponding to the aforementioned matching number of matching degrees in the second sorting are determined as target edge data blocks.
9. The method according to claim 7, wherein: The determining the matching number of target edge data blocks according to the matching degree between the edge data block and the second edge data includes: sorting the matching degrees between all the edge data blocks and the second edge data from largest to smallest to obtain a third sorting; determining a first number of matching degrees greater than a second matching threshold based on matching degrees between all the edge data blocks and the second edge data; The matching number of target edge data blocks is determined according to the first number, the matching number, and the third ranking.
10. The method according to claim 9, wherein: Determining the matching number of target edge data blocks according to the first number, the matching number, and the third ranking includes: In the case where the first number is greater than or equal to the matching number, the edge data blocks corresponding to the matching number in the third sorting are determined as target edge data blocks; or performing feature extraction on the first image and the second image respectively to obtain third feature point data of the first image and fourth feature point data of the second image; When the first number is less than the matching number and greater than zero, determining the edge data blocks corresponding to the first matching number of matching degrees in the third sort as the matching number of target edge data blocks; and determining a second number of target edge data blocks based on the matching degree between the edge data block and the second edge data, and the third feature point data and the fourth feature point data, where the second number is the difference between the first number and the matching number; When the first number is zero, the matching number of target edge data blocks is determined according to the matching degree between the edge data block and the second edge data, and the third feature point data and the fourth feature point data.
11. The method according to claim 5, wherein: The method further comprises: Obtaining UI elements corresponding to each of the second images; Determining the target position information and display level of the second image as the target position information and display level of the UI element corresponding to the second image; According to the target position information and display level of each UI element, a resource node is created for each UI element in a rendering engine to obtain a target UI interface corresponding to the target spliced image.
12. The method according to claim 2, wherein: Each edge data block corresponds to a first position information, and the first position information corresponding to the edge data block is used to indicate the position of the edge data block in the first edge data; The determining the position information of the position of the matching edge data in the first edge data as the target position information corresponding to the second image includes: The first position information corresponding to the matching edge data is determined as the target position information corresponding to the second image.
13. The method according to claim 1, wherein Before extracting edge data from the first image and the second image respectively, the method further includes: Adjust the color of the transparent pixels in the second image to the target color.
14. An image stitching device, comprising: an acquisition module configured to acquire a first image and a plurality of second images to be stitched, wherein the first image contains the same image elements as those of the second image; a processing module configured to extract edge data from the first image and the second image respectively to obtain first edge data of the first image and second edge data of the second image; a matching module configured to match the first edge data and the second edge data, and determine edge data in the first edge data that matches the second edge data as matching edge data; a determination module configured to determine position information of a position of the matching edge data in the first edge data as target position information corresponding to the second image; The target position information is used to indicate a matching position of the corresponding second image in the first image; The stitching module is configured to stitch the second images together according to target position information corresponding to the second images to obtain a stitched target stitched image.
15. An electronic device, comprising: processor; as well as The memory is configured to store a data processing program. After the electronic device is powered on and the program is run by the processor, the image stitching method according to any one of claims 1 to 13 is executed.
16. A computer-readable storage medium storing a data processing program, wherein the program is executed by a processor to perform the image stitching method according to any one of claims 1 to 13.
Citation Information
Patent Citations
Collage generation with occlusion costing
CN101536038A
Game interface generation method and system, electronic equipment and storage medium
CN115080035A
Image processing method and device, medium and equipment
CN115564976A
Image splicing method and device, electronic equipment and computer readable storage medium
CN118195890A
Image feature matching method, computer device, and storage medium
US20230386055A1