Image stitching method, device, system and computer-readable storage medium
By customizing the arrangement and stitching instructions of rectangular boxes on the configuration device and sending business protocol information to the camera device for image stitching, the problem of restricted synthesis styles in the prior art is solved, and image stitching of custom synthesis styles is realized , improves applicability and simplicity.
Patent Information
- Application Number
- CN202210303566.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-24
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2042-03-24
AI Technical Summary
The existing image stitching method is limited by the preset synthesis style, making it difficult to implement custom synthesis styles, resulting in high modification costs and poor applicability.
By customizing the arrangement and stitching instructions of rectangular boxes on the configuration interface of the configuration device, a synthesis style is generated and the business protocol information is sent to the camera device. The stitching image is stitched based on the serial number and position information to generate a matching match with the custom synthesis style. composite image.
It realizes the custom synthesis style of image stitching, avoids the problem of restricted synthesis styles, reduces modification costs, and improves the applicability and simplicity of stitching operations.
Smart Images

Figure CN114881840B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image stitching method, device, system and computer-readable storage medium. Background Art
[0002] The existing image stitching method arranges multiple images according to a conventional synthesis style to obtain a composite image. The conventional synthesis styles are some pre-set styles provided by the device. For each preset style, there is a corresponding stitching logic, so different stitching logics are selected according to different preset styles. If the customer customizes other synthesis styles, the stitching logic must be modified according to the customized synthesis style. The cost of modification is high, resulting in the problem of limited synthesis styles. Summary of the invention
[0003] The present application provides an image stitching method, device, system and computer-readable storage medium, which can stitch images according to a customized synthesis style.
[0004] In order to solve the above technical problems, the technical solution adopted in the present application is: to provide an image stitching method, the image stitching method is applied to an image stitching system, the image stitching system includes a configuration device and a camera device, the method includes: stitching at least two rectangular frames according to the stitching instruction on the configuration interface of the configuration device to obtain a synthetic style, at least one side of any rectangular frame coincides with at least one side of the other rectangular frames; sending business protocol information to the camera device, the business protocol information includes the serial number of the image to be stitched corresponding to each rectangular frame and the first position information of the image to be stitched in the normalized coordinate system; wherein the camera device is used to stitch all the images to be stitched based on the serial number and the first position information to obtain a synthetic image matching the synthetic style.
[0005] To solve the above technical problems, another technical solution adopted in the present application is: to provide a configuration device, which includes a memory and a processor connected to each other, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, it is used to implement the image stitching method in the above technical solution.
[0006] To solve the above technical problems, another technical solution adopted in the present application is: to provide a camera device, which includes a memory and a processor connected to each other, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, it is used to implement the image stitching method in the above technical solution.
[0007] To solve the above-mentioned technical problems, another technical solution adopted in the present application is: to provide an image stitching system, which includes a configuration device and a camera device connected to each other, the configuration device is used to send business protocol information to the camera device, so that the camera device generates a composite image based on the business protocol information and the image to be stitched, wherein the configuration device is the configuration device in the above-mentioned technical solution, and the camera device is the camera device in the above-mentioned technical solution.
[0008] To solve the above technical problem, another technical solution adopted in the present application is: providing a computer-readable storage medium, which is used to store a computer program. When the computer program is executed by a processor, it is used to implement the image stitching method in the above technical solution.
[0009] Through the above scheme, the beneficial effects of the present application are: by splicing at least two rectangular frames according to the splicing instruction on the configuration interface of the configuration device, a composite style is obtained; then the business protocol information is sent to the camera device, so that the camera device splices all the images to be spliced based on the serial number and the first position information, thereby obtaining a composite image matching the composite style; through the interaction between the configuration interface and the user, the composite style can be customized without being limited to the inherent composite style, thereby solving the problem of limited composite style; and, the images to be spliced corresponding to the rectangular frames in the composite style are projected into a normalized coordinate system, and the positions of the images to be spliced are unified using the normalized coordinates, without changing the splicing logic, and the stitching operation can be implemented based on the customized composite style, thereby improving the applicability of the scheme and being simple to implement. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0011] Figure 1 It is a flowchart of an embodiment of an image stitching method provided by the present application;
[0012] Figure 2 It is a schematic diagram of the conventional synthesis style provided by this application;
[0013] Figure 3 is a schematic diagram of the custom synthesis style provided by this application;
[0014] Figure 4 It is a schematic diagram of sending business protocol information provided by this application;
[0015] Figure 5 is a flowchart of another embodiment of the image stitching method provided by the present application;
[0016] Figure 6 is a schematic diagram of the upper left corner coordinates and the lower right corner coordinates in the custom synthesis style provided by this application;
[0017] Figure 7 It is a schematic diagram of the structure of the violation evidence collection module provided by this application;
[0018] Figure 8 is a flowchart of another embodiment of the image stitching method provided by the present application;
[0019] Fig. 9 It is a structural diagram of an embodiment of a configuration device provided by the present application;
[0020] Fig.10 It is a structural schematic diagram of an embodiment of a camera device provided by the present application;
[0021] Fig.11 It is a structural schematic diagram of an embodiment of an image stitching system provided by the present application;
[0022] Fig.12 It is a structural schematic diagram of an embodiment of a computer-readable storage medium provided by the present application. DETAILED DESCRIPTION
[0023] The present application is further described in detail below in conjunction with the accompanying drawings and examples. It is particularly noted that the following examples are only used to illustrate the present application, but are not intended to limit the scope of the present application. Similarly, the following examples are only some embodiments of the present application rather than all embodiments, and all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0024] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0025] It should be noted that the terms "first", "second" and "third" in this application are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first", "second" and "third" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In addition, the terms "including" and "having" and any of their variations 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 limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices.
[0026] See also Figure 1 , Figure 1 1 is a flow chart of an embodiment of an image stitching method provided by the present application. The method is applied to an image stitching system. The image stitching system includes a configuration device and a camera device. The method includes:
[0027] Step 11: On the configuration interface of the configuration device, stitch at least two rectangular frames according to the stitching instruction to obtain a composite pattern.
[0028] The configuration device may be a computer device, and a configuration interface may be displayed on the configuration device so as to interact with the user through the configuration interface and receive stitching instructions input by the user; specifically, the configuration interface may provide a rectangular frame that can be dragged, stretched and edited by the user, and the user may customize the rectangular frame to obtain a composite style, and at least one side of any rectangular frame overlaps with at least one side of other rectangular frames; it can be understood that the user may customize the number, size and arrangement of the rectangular frames, and the rectangular frames may indicate the positions of the images to be stitched, and the number of the rectangular frames is the same as the number of the images to be stitched, that is, each rectangular frame corresponds to an image to be stitched, and the arrangement of the rectangular frames indicates the relative positions between each image to be stitched, and the size of the rectangular frames may be customized according to actual conditions, and the size of each rectangular frame may be the same or different, and when the sizes of the rectangular frames are different, the size of the image to be stitched corresponding to the rectangular frame may be scaled in the subsequent stitching process, so that the images to be stitched of the same size may be reused for stitching.
[0029] like Figure 2 As shown, Figure 2 (a) to (e) are five existing conventional synthesis styles. Conventional synthesis styles are pre-set by the system, but since they cannot be customized or set, there is a problem of limited synthesis styles. Figure 3 For example, Figure 3It is a user-defined synthesis style. Three rectangular frames of the same size can be set. The three rectangular frames form a genuine font. One rectangular frame is set parallel to another rectangular frame in the horizontal direction. The remaining rectangular frames are set on the upper side of the above two rectangular frames, and the edges of the three rectangular frames overlap.
[0030] Step 12: Send the service agreement information to the camera device.
[0031] The business agreement information includes the serial number of the image to be spliced corresponding to each rectangular frame and the first position information of the image to be spliced in the normalized coordinate system; the normalized coordinate may include the x-axis in the horizontal direction and the y-axis in the vertical direction, the horizontal direction is the width direction of the rectangular frame, and the vertical direction is the height direction of the rectangular frame. Specifically, each rectangular frame may correspond to an image to be spliced, and the image to be spliced may be a single-channel video image or a local magnified image, which may be specifically subdivided into a distant view image, a close-up view image, and a close-up view image. Taking the vehicle as an example, the distant view image may be a video image image obtained by the camera device at a small magnification, through which the relative position of the target vehicle and the surrounding scenery can be seen; the close-up view image is a video image image obtained by the camera device at a large magnification, through which the detailed features such as the license plate or body of the target vehicle can be clearly seen; the close-up view image is a video image image obtained by the camera device at a large magnification, and then the target vehicle is presented according to the user-set ratio after being processed by the software.
[0032] Furthermore, when acquiring each image to be stitched, the original image information corresponding to each image to be stitched can be acquired at the same time. Taking the scene of illegal parking as an example, the original image information can include time information, violation type and violation location, etc. The serial number of the image to be stitched can be used to indicate the time information of the image to be stitched. The larger the serial number, the later the acquisition time of the image to be stitched. In a specific implementation manner, the user can customize the serial number of each rectangular frame (i.e. Figure 2 The number in each rectangular box in the sequence number indicates the time information of the image to be stitched corresponding to each rectangular box. The number in the rectangular box with the sequence number 1 may indicate the first captured image to be stitched, the number in the rectangular box with the sequence number 2 may indicate the second captured image to be stitched, and the number in the rectangular box with the sequence number 3 may indicate the third captured image to be stitched.
[0033] like Figure 4As shown, the configuration device can send the business protocol information to the camera device, so that the camera device can stitch all the images to be stitched based on the serial number and the first position information, so as to obtain a composite image matching the synthesis style; specifically, the first position information may include the upper left corner coordinates and the lower right corner coordinates of the rectangular frame in the normalized coordinate system, and the position of each rectangular frame is determined by using the upper left corner coordinates and the lower right corner coordinates, so as to realize the stitching of the images to be stitched corresponding to the rectangular frame; since each image to be stitched may be acquired by different acquisition devices, the use of normalized coordinates can unify the position information of each image to be stitched into the same coordinate system, thereby reducing the difficulty of stitching of the camera device and improving the stitching efficiency.
[0034] In the solution adopted in this embodiment, the configuration device stitches at least two rectangular frames according to the stitching instruction on the configuration interface to obtain a composite style; then the configuration device sends the business protocol information to the camera device, so that the camera device stitches all the images to be stitched based on the serial number and the first position information, thereby obtaining a composite image matching the composite style; through the interaction between the configuration interface and the user, the composite style can be customized without being limited to the inherent composite style, thereby solving the problem of limited composite style; moreover, the images to be stitched corresponding to the rectangular frames in the composite style are projected into a normalized coordinate system, and the positions of the images to be stitched are unified using the normalized coordinates, without changing the stitching logic, and the stitching operation can be implemented based on the customized composite style, thereby improving the applicability of the solution and being simple to implement.
[0035] See also Figure 5 , Figure 5 1 is a flow chart of another embodiment of the image stitching method provided by the present application. The method is applied to an image stitching system. The image stitching system includes a configuration device and a camera device. The method includes:
[0036] Step 51: Receive the service protocol information sent by the configuration device.
[0037] The business protocol information includes the serial number of the image to be stitched corresponding to each rectangular box on the configuration interface of the configuration device and the first position information of the image to be stitched in the normalized coordinate system; the configuration device can also stitch at least two rectangular boxes according to the stitching instruction on the configuration interface to obtain a synthetic style matching the synthetic image, and at least one side of any rectangular box coincides with at least one side of other rectangular boxes.
[0038] Step 52: Based on the sequence number and the first position information, all the images to be stitched are stitched together to obtain a composite image.
[0039] The camera device may obtain the image to be stitched corresponding to the sequence number, and then stitch all the images to be stitched using the corresponding first position information to obtain a composite image matching the synthesis pattern; specifically, the first position information may include the upper left corner coordinates and the lower right corner coordinates of the image to be stitched in the normalized coordinate system. Figure 6 For example, A1~A3 are the upper left corner coordinates of each image to be stitched, and B1~B3 are the lower right corner coordinates of each image to be stitched. The relative position of the image to be stitched in the composite image is determined by using each upper left corner coordinate and lower right corner coordinate to stitch all the images to be stitched, thereby obtaining a composite image.
[0040] It can be understood that the maximum values of the x-axis and the y-axis in the normalized coordinate system can be customized by the configuration device, or can be set according to the maximum value of the coordinate values of all the images to be stitched in the normalized coordinate system, and the maximum value of the horizontal coordinate of the lower right corner of all the images to be stitched (i.e., the coordinate value on the x-axis) is added by one as the maximum value of the x-axis in the normalized coordinate system, and the maximum value of the vertical coordinate of the lower right corner of all the images to be stitched (i.e., the coordinate value on the y-axis) is added by one as the maximum value of the y-axis in the normalized coordinate system; specifically, taking a coordinate system of size 8192×8192 as an example, the coordinate value range is within 0 to 8191, that is, the maximum value of the coordinate value differs from the actual size of the coordinate system by one in value, then when calculating the maximum value of the y-axis in the normalized coordinate system, the maximum values of the horizontal coordinate of the lower right corner (i.e., the coordinate value on the x-axis) and the vertical coordinate of the lower right corner (i.e., the coordinate value on the y-axis) of all the images to be stitched are added by one.
[0041] In a specific implementation, the camera device may first shoot the current monitoring scene to obtain multiple captured images, and then perform target detection processing on the captured images to obtain detection results; determine whether the target object appears or the target event occurs in the detection results; if the target object appears or the target event occurs in the detection results, the captured image is determined as the image to be stitched; specifically, the camera device may be a network camera (IP CAMERA, IPC), such as a spherical camera, etc., which is not limited here.
[0042] For example, in the application scenario of illegal evidence collection (such as illegal parking), a camera device can be used to capture a vehicle that has violated the traffic rules, and then the captured image is used as the image to be stitched, so as to use the image to be stitched for illegal evidence collection; specifically, Figure 7As shown, the traffic violation evidence collection module used for traffic violation evidence collection may include a target detection module, an evidence chain control module, an evidence chain synthesis module, a pan / tilt control module and a capture module. The evidence chain synthesis module is mainly responsible for arranging and splicing the captured images to be spliced according to a synthesis style to obtain a composite image; it can be understood that the image stitching method in this embodiment can be applied to the evidence chain synthesis module, and the camera equipment can participate in the capture process of the capture module.
[0043] After receiving the business protocol information sent by the configuration device, the camera device in this embodiment can determine the relative position of each image to be stitched in the composite image based on the sequence number and the first position information, using the upper left corner coordinates and the lower right corner coordinates of each image to be stitched; then all the images to be stitched are stitched together to obtain a composite image, thereby realizing customized stitching of images according to the business protocol information sent by the configuration device, and the stitching method is more diversified; moreover, the image stitching method in this embodiment can also be applied to the scenario of traffic violation evidence collection, which is conducive to the synthesis of the chain of evidence.
[0044] See also Figure 8 , Figure 8 : is a flow chart of another embodiment of the image stitching method provided by the present application. The image stitching method is applied to a camera device in an image stitching system. The method includes:
[0045] Step 81: Receive the service protocol information sent by the configuration device.
[0046] Step 81 is the same as the above step 51 and will not be described again.
[0047] After receiving the service agreement information, the camera device may stitch all the images to be stitched together based on the sequence number and the first position information to obtain a composite image, which is described in detail below.
[0048] Step 82: Obtain a preset baseline policy set.
[0049] The preset benchmark strategy set includes at least one benchmark determination strategy, and the benchmark determination strategy is a pre-specified strategy for calculating benchmark width and height values (including a height benchmark value and a width benchmark value).
[0050] Step 83: Select a benchmark determination strategy from multiple benchmark determination strategies as the current strategy, and use the current strategy to determine the benchmark width and height values.
[0051] A benchmark determination strategy can be selected from a plurality of benchmark determination strategies as a current strategy, and the current strategy is used to determine the benchmark width and height values. Specifically, the preset benchmark strategy set includes the following multiple benchmark determination strategies:
[0052] 1) The width and height values of the image to be stitched with the specified sequence number are used as the reference width and height values.
[0053] 2) The minimum value of the height of all the images to be stitched and the minimum value of the width of all the images to be stitched are taken as the reference width and height values.
[0054] 3) The maximum value of the height of all the images to be stitched and the maximum value of the width of all the images to be stitched are taken as the reference width and height values.
[0055] 4) The height of the image to be stitched corresponding to the maximum value of the height of all rectangular frames and the width of the image to be stitched corresponding to the maximum value of the width of all rectangular frames are taken as reference width and height values.
[0056] 5) The height of the image to be stitched corresponding to the minimum value of the heights of all the rectangular boxes and the width of the image to be stitched corresponding to the minimum value of the widths of all the rectangular boxes are taken as reference width and height values.
[0057] It can be understood that the benchmark determination strategy can be selected according to actual conditions. When the sizes of the rectangular frames customized by the user are the same, a benchmark determination strategy can be selected from the above benchmark determination strategies 1), 2) and 3) as the current strategy, that is, the benchmark width and height values can be determined according to the width and height values of the images to be stitched; when the sizes of the rectangular frames customized by the user are different, a benchmark determination strategy can be selected from the above benchmark determination strategies 4) and 5) as the current strategy, that is, the corresponding images to be stitched can be obtained according to the maximum / minimum values of the width and height values of the rectangular frames, and the width and height values of the corresponding images to be stitched can be used as the benchmark width and height values.
[0058] Step 84: Calculate the width and height of the image to be stitched in the composite image based on the reference width and height values and the width and height values of all rectangular frames.
[0059] After obtaining the reference width and height values, the reference width and height values can be used as a reference to adjust the width and height values of the images to be spliced corresponding to the rectangular frames, thereby obtaining the width and height values of all the images to be spliced in the composite image. Specifically, the rectangular frame corresponding to the reference width and height values can be referred to as the reference rectangular frame, and all the rectangular frames except the reference rectangular frame can be referred to as other rectangular frames. The ratio of the width of the other rectangular frames to the width of the reference rectangular frame is calculated to obtain a first ratio, and the product of the first ratio and the width reference value is calculated to obtain the width of the images to be spliced corresponding to the other rectangular frames in the composite image; then the ratio of the height of the other rectangular frames to the height of the reference rectangular frame is calculated to obtain a second ratio, and the product of the second ratio and the height reference value is calculated to obtain the height of the images to be spliced corresponding to the other rectangular frames in the composite image. Finally, based on the width and height of all the images to be spliced in the composite image, a composite image is generated.
[0060] by Figure 6Taking the synthesis style shown as an example, to stitch three images to be stitched, the three rectangular frames are set to the same size. The image to be stitched corresponding to the rectangular frame with sequence number 1 can be called the first image to be stitched, the image to be stitched corresponding to the rectangular frame with sequence number 2 can be called the second image to be stitched, and the image to be stitched corresponding to the rectangular frame with sequence number 3 can be called the third image to be stitched. If the user selects the benchmark determination strategy 1) to set the benchmark width and height values, the actual width and height values of the first image to be stitched are used as the benchmark width and height values, and the benchmark rectangular frame is the rectangular frame corresponding to the first image to be stitched.
[0061] Assume that the width of the reference rectangular frame (i.e., the width reference value) is w, the height of the reference rectangular frame (i.e., the height reference value) is h, the coordinates of the upper left corner of the first image to be stitched in the normalized coordinate system are (x10, y10), and the coordinates of the lower right corner are (x11, y11), the coordinates of the upper left corner of the second image to be stitched in the normalized coordinate system are (x20, y20), and the coordinates of the lower right corner are (x21, y21); the coordinates of the upper left corner of the third image to be stitched in the normalized coordinate system are (x30, y30), the coordinates of the lower right corner are (x31, y31); through the above calculation method, it can be calculated that the width of the second image to be stitched in the composite image is w*(x21-x20) / (x11-x10), and the height is h*(y21-y20) / (y11-y10), and the width of the third image to be stitched in the composite image is w*(x31-x30) / (x11-x10), and the height is h*(y31-y30) / (y11-y10).
[0062] Step 85: Generate a composite image based on the width and height values of all the images to be stitched in the composite image.
[0063] Based on the width and height of the image to be spliced in the composite image, the width and height of the composite image are calculated; the first position information is mapped to the composite image to obtain the second position information, which is the position information of each image to be spliced in the composite image; then based on the pixel value of the image to be spliced, the second position information, and the width and height of the composite image, a composite pixel value is generated; the composite pixel value is encoded to obtain a composite image. It can be understood that the pixel value can be the pixel data of the image to be spliced in the YUV format, and the composite image is a regular rectangle. When performing image splicing, the blank part that does not contain the pixel value of the image to be spliced can be filled with black pixels.
[0064] Furthermore, Figure 6For example, the width and height of the composite image can be obtained according to the width and height of the three images to be stitched in the composite image. It can be seen that the width of the composite image is the sum of the widths of the second image to be stitched and the third image to be stitched, that is, w*(x21-x20) / (x11-x10)+w*(x31-x30) / (x11-x10), and the height of the composite image is the sum of the heights of the first image to be stitched and the second image to be stitched / the third image to be stitched, that is, h+h*(y31-y30) / (y11-y10); it can be understood that when the sizes of the second image to be stitched and the third image to be stitched are different, the second image to be stitched and the third image to be stitched can be stitched together. The sum of the maximum height between the stitched images and the first image to be stitched is taken as the height of the composite image, i.e., h+max(h*(y21-y20) / (y11-y10), h*(y31-y30) / (y11-y10)). Then, the upper left corner coordinates and the lower right corner coordinates of all the images to be stitched are mapped to the composite image to obtain the second position information of each image to be stitched in the composite image, that is, the position of the pixel value in each image to be stitched in the composite image is obtained, so that the pixel values of all the images to be stitched are merged according to the second position information to obtain the composite pixel value, and then the composite pixel value is encoded to finally obtain the composite image.
[0065] In a specific implementation, when the user customizes the synthesis style, there may be a situation where the size of the set rectangular frame is different, resulting in a situation where the size of the image to be spliced in the synthesized image is different. In this case, the image to be spliced can be scaled to unify the size of each image to be spliced in the synthesized image; specifically, it can be determined whether the width and height of the image to be spliced in the synthesized image are the same as the width and height of the image to be spliced; if the width and height of the image to be spliced in the synthesized image are different from the width and height of the image to be spliced, the image to be spliced can be scaled according to the width and height of the image to be spliced in the synthesized image to obtain the scaled image to be spliced, thereby generating a synthesized pixel value based on the pixel value of the scaled image to be spliced, the second position information, and the width and height of the synthesized image. For example: the user sets three rectangular frames in the configuration interface, and sets the size of the first rectangular frame to 1 / 2 of the size of the second rectangular frame and the third rectangular frame. The size of the second rectangular frame and the third rectangular frame is the same. At this time, the size of the image to be spliced corresponding to the first rectangular frame can be reduced by 1 / 2, and then spliced with the images to be spliced corresponding to the other two rectangular frames.
[0066] This embodiment selects a reference determination strategy from a plurality of reference determination strategies as the current strategy; then the current strategy is used to determine the reference width and height values, and based on the reference width and height values and the width and height values of all rectangular frames, the width and height values of the image to be spliced in the composite image are calculated, thereby obtaining the width and height of the composite image; by mapping the first position information to the composite image, the second position information of each image to be spliced in the composite image is obtained; finally, encoding is performed according to the second position information, the pixel value, and the width and height of the composite image to obtain the final composite image; by mapping the positions of the images to be spliced, the images to be spliced are spliced according to the arrangement in the composite style, without changing the splicing logic, and the images to be spliced can be adaptively spliced according to any custom composite style, thereby solving the problem of limited composite style; in addition, the size of the image to be spliced can be adaptively adjusted according to the rectangular frames of different sizes set by the user, thereby further improving the diversity of the synthesis.
[0067] See also Fig. 9 , Fig. 9 It is a structural diagram of an embodiment of a configuration device provided in the present application. The configuration device 90 includes a memory 91 and a processor 92 connected to each other. The memory 91 is used to store a computer program. When the computer program is executed by the processor 92, it is used to implement the image stitching method in the above embodiment.
[0068] See also Fig.10 , Fig.10 It is a structural diagram of an embodiment of a camera device provided in the present application. The camera device 100 includes a memory 101 and a processor 102 connected to each other. The memory 101 is used to store a computer program. When the computer program is executed by the processor 102, it is used to implement the image stitching method in the above embodiment.
[0069] See also Fig.11 , Fig.11 It is a structural diagram of an embodiment of an image stitching system provided by the present application. The image stitching system 110 includes a configuration device 111 and a camera device 112 that are interconnected. The configuration device 111 is used to send business protocol information to the camera device 112, so that the camera device 112 generates a composite image based on the business protocol information and the images to be stitched, wherein the configuration device 111 is the configuration device in the above embodiment, and the camera device 112 is the camera device in the above embodiment.
[0070] See also Fig.12 , Fig.12 It is a structural diagram of an embodiment of a computer-readable storage medium provided in the present application. The computer-readable storage medium 120 is used to store a computer program 121. When the computer program 121 is executed by a processor, it is used to implement the image stitching method in the above embodiment.
[0071] The computer-readable storage medium 120 may be a server, a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., which may store program codes.
[0072] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only illustrative, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0073] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0074] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0075] The above descriptions are merely embodiments of the present application and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. An image stitching method, characterized in that: Applied to an image stitching system, the image stitching system includes a configuration device and a camera device, and the method includes: At least two rectangular frames are spliced according to the splicing instruction on the configuration interface of the configuration device to obtain a composite pattern, at least one side of any of the rectangular frames overlaps with at least one side of the other rectangular frames, and a rectangular frame that can be dragged, stretched and edited is provided on the configuration interface; Sending service agreement information to the camera device, the service agreement information including the serial number of the image to be stitched corresponding to each rectangular frame and the first position information of the image to be stitched in the normalized coordinate system; The camera device is used to stitch all the images to be stitched based on the sequence number and the first position information to obtain a composite image matching the composite pattern.
2. An image stitching method, characterized in that: Applied to an image stitching system, the image stitching system includes a configuration device and a camera device, and the method includes: Receiving the service protocol information sent by the configuration device, the service protocol information including the serial number of the image to be stitched corresponding to each rectangular box on the configuration interface of the configuration device and the first position information of the image to be stitched in the normalized coordinate system; Based on the sequence number and the first position information, all the images to be stitched are stitched together to obtain a composite image; Among them, the configuration device is also used to splice at least two rectangular boxes according to the splicing instructions on the configuration interface to obtain a synthetic style that matches the synthetic image, at least one side of any one of the rectangular boxes overlaps with at least one side of the other rectangular boxes, and a rectangular box that can be dragged, stretched and edited is provided on the configuration interface.
3. The image stitching method according to claim 2, characterized in that: The step of stitching all the images to be stitched based on the sequence number and the first position information to obtain a synthetic image matching the synthetic pattern includes: Obtaining a preset benchmark strategy set, wherein the preset benchmark strategy set includes multiple benchmark determination strategies; Selecting a reference determination strategy from the multiple reference determination strategies as a current strategy, and using the current strategy to determine reference width and height values; Based on the reference width and height values and the width and height values of all the rectangular frames, the width and height values of the image to be stitched in the composite image are calculated.
4. The image stitching method according to claim 3, characterized in that: The method further comprises: Using the width and height values of the to-be-joined image with a specified sequence number as the reference width and height values; or The minimum value of the heights of all the images to be stitched and the minimum value of the widths of all the images to be stitched are used as the reference width and height values; or The maximum value of the heights of all the images to be stitched and the maximum value of the widths of all the images to be stitched are used as the reference width and height values; or The height of the image to be stitched corresponding to the maximum value of the heights of all the rectangular frames and the width of the image to be stitched corresponding to the maximum value of the widths of all the rectangular frames are used as the reference width and height values; or The height of the image to be stitched corresponding to the minimum value of the heights of all the rectangular frames and the width of the image to be stitched corresponding to the minimum value of the widths of all the rectangular frames are used as the reference width and height values.
5. The image stitching method according to claim 3, characterized in that: The reference width and height values include a width reference value and a height reference value. The step of calculating the width and height values of the image to be spliced in the composite image based on the reference width and height values and the width and height values of all the rectangular frames includes: Calculating the ratio of the width of other rectangular frames to the width of the reference rectangular frame to obtain a first ratio, wherein the reference rectangular frame is a rectangular frame corresponding to the reference width and height value, and the other rectangular frames are rectangular frames among all the rectangular frames except the reference rectangular frame; Calculate the product of the first ratio and the width reference value to obtain the width of the image to be spliced corresponding to the other rectangular frames in the composite image; Calculating the ratio of the height of the other rectangular frame to the height of the reference rectangular frame to obtain a second ratio; Calculate the product of the second ratio and the high reference value to obtain the height of the image to be stitched corresponding to the other rectangular frames in the composite image; The composite image is generated based on the widths and heights of all the images to be stitched in the composite image.
6. The image stitching method according to claim 5, characterized in that: The step of generating the composite image based on the widths and heights of all the images to be stitched in the composite image comprises: Calculating the width and height of the composite image based on the width and height of the image to be stitched in the composite image; Mapping the first position information to the composite image to obtain second position information, where the second position information is position information of each image to be stitched in the composite image; Generate a synthesized pixel value based on the pixel value of the image to be stitched, the second position information, and the width and height of the synthesized image; The synthesized pixel values are encoded to obtain the synthesized image.
7. The image stitching method according to claim 6, characterized in that: The method further comprises: Determining whether the width and height of the image to be stitched in the composite image are respectively the same as the width and height of the image to be stitched; If not, scaling the image to be spliced according to the width and height of the image to be spliced in the composite image to obtain a scaled image to be spliced; The synthesized pixel value is generated based on the pixel value of the scaled image to be stitched, the second position information, and the width and height of the synthesized image.
8. The image stitching method according to claim 2, characterized in that: The method further comprises: Shoot the current monitoring scene to obtain multiple images; Performing target detection processing on the captured image to obtain a detection result; Determining whether a target object appears or a target event occurs in the detection result; If so, the captured image is determined as the image to be stitched.
9. A configuration device, characterized in that: The invention comprises a memory and a processor connected to each other, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, it is used to implement the image stitching method according to claim 1.
10. A camera device, characterized in that: The invention comprises a memory and a processor connected to each other, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, it is used to implement the image stitching method according to any one of claims 2 to 8.
11. An image stitching system, characterized in that: It includes a configuration device and a camera device that are connected to each other, wherein the configuration device is used to send business protocol information to the camera device so that the camera device generates a composite image based on the business protocol information and the image to be stitched, wherein the configuration device is the configuration device described in claim 9, and the camera device is the camera device described in claim 10.
12. A computer-readable storage medium for storing a computer program, characterized in that: When the computer program is executed by a processor, it is used to implement the image stitching method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Traffic image splicing system and method
CN111510731A