CN110738599B - Image stitching method and device, electronic equipment and storage medium - Google Patents

Image stitching method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110738599B
CN110738599B CN201910974743.1A CN201910974743A CN110738599B CN 110738599 B CN110738599 B CN 110738599B CN 201910974743 A CN201910974743 A CN 201910974743A CN 110738599 B CN110738599 B CN 110738599B
Authority
CN
China
Prior art keywords
images
image
horizontal
splicing
stitching
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910974743.1A
Other languages
Chinese (zh)
Other versions
CN110738599A (en
Inventor
胡勇波
徐彬彬
李曙鹏
谢永康
施恩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201910974743.1A priority Critical patent/CN110738599B/en
Publication of CN110738599A publication Critical patent/CN110738599A/en
Application granted granted Critical
Publication of CN110738599B publication Critical patent/CN110738599B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4038Image mosaicing, e.g. composing plane images from plane sub-images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/14Transformations for image registration, e.g. adjusting or mapping for alignment of images

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The application discloses an image stitching method, an image stitching device, electronic equipment and a storage medium, and relates to the field of image processing. The specific implementation scheme is as follows: performing horizontal correction on each original image in the image sequence to be spliced to obtain horizontal images corresponding to each original image; wherein the image sequence is a sequence composed of a plurality of original images which are aimed at a predetermined target and are photographed in a predetermined order; and splicing the horizontal images corresponding to the original images to obtain a first image. The method and the device can reduce the requirements on shooting modes and shooting angles and improve the splicing effect.

Description

Image stitching method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of data, and in particular, to the field of image processing.
Background
The existing image stitching generally adopts a global alignment method, images are aligned by a homography matrix, then camera parameters of each image are solved, the images are deformed by adopting cylindrical or spherical projection, and finally the deformed images are fused to obtain a final stitched image. This approach requires that the overlapping area between the images can be approximated to a plane, and that the optical centers of the cameras need to be nearly coincident at each shot, and that the shot image level needs to be ensured as much as possible, and that the requirements on the shooting mode and the shooting angle are high, so that the stitching effect is poor.
Disclosure of Invention
In a first aspect, an embodiment of the present application provides an image stitching method, including:
performing horizontal correction on each original image in the image sequence to be spliced to obtain horizontal images corresponding to each original image; wherein the image sequence is a sequence composed of a plurality of original images which are aimed at a predetermined target and are photographed in a predetermined order;
and splicing the horizontal images corresponding to the original images to obtain a first image.
According to the embodiment of the application, the original images to be spliced are subjected to horizontal correction firstly, and then the horizontal images after horizontal correction are spliced, so that requirements on shooting modes and shooting angles are not high, and the splicing effect can be improved.
In one embodiment, the level correction is performed in the following manner:
acquiring two first line segments in an original image, wherein the first line segments are line segments corresponding to actual horizontal lines in a preset target;
constructing a quadrangle by using the endpoints of the two first line segments;
constructing a horizontal rectangle obtained by perspective transformation of the quadrangle;
determining an image perspective transformation matrix for realizing perspective transformation according to the quadrangle and the horizontal rectangle;
and carrying out horizontal correction on the original image by adopting an image perspective transformation matrix.
According to the method and the device, the quadrilateral is constructed by adopting the end point of the first line segment in the original image, and the first line segment in the image corresponds to the actual horizontal line in the preset target, so that the image perspective transformation matrix for transforming the quadrilateral into the horizontal rectangle is found, and the image perspective transformation matrix can be used for carrying out horizontal correction on the original image.
In one embodiment, the image sequence is an image sequence for at least one of the multi-tier shelves, the predetermined order being a lateral order;
splicing the horizontal images corresponding to the original images to obtain a first image, wherein the method comprises the following steps:
grouping the horizontal images;
the horizontal images in each group are spliced left and right to obtain intermediate images corresponding to each group;
and splicing the intermediate images left and right to obtain a first image aiming at least one layer of the multi-layer shelf.
Grouping the horizontal images, firstly splicing the horizontal images in each group to obtain each group intermediate image; and splicing all the intermediate images corresponding to the packets to obtain a first image of the whole image sequence. The grouping and step-by-step splicing mode can improve the calculation speed, and the time consumption of the splicing process, particularly the step of solving the camera parameters, is avoided.
In one embodiment, in the left-right stitching of the horizontal images in each group, the manner of stitching the two adjacent horizontal images is:
determining a homography matrix between two adjacent horizontal images;
determining parameters of shooting cameras of two horizontal images according to the homography matrix;
respectively projecting two horizontal images to a spherical surface with one point as a coordinate center according to parameters of a shooting camera;
and splicing the projected images.
According to the method and the device for the image processing, the homography matrix between the adjacent horizontal images is calculated, and parameters of a shooting camera are calculated by using the homography matrix, so that the rapid splicing of the two adjacent horizontal images is achieved.
In one embodiment, determining a homography matrix between two adjacent horizontal images includes:
extracting feature points and feature vectors of the feature points of the two horizontal images respectively;
according to the feature vectors of the feature points, determining feature point pairs with matching relations in the two horizontal images;
and calculating a homography matrix between the two horizontal images by adopting the characteristic point pairs.
According to the method and the device, the homography matrix between the adjacent images is calculated by determining the characteristic point pairs with the matching relation in the adjacent images and adopting the characteristic point pairs, so that the homography matrix is determined rapidly.
In one embodiment, the method further comprises:
and stitching the first images obtained by the at least two image sequences to be stitched to obtain an integral image aiming at the preset target.
According to the embodiment of the application, the first images obtained by the image sequences are spliced again, so that the step-by-step splicing of the whole images of the preset targets is realized, and the image splicing can be simply, conveniently and efficiently realized.
In a second aspect, an embodiment of the present application provides an image stitching device, including:
the horizontal correction module is used for carrying out horizontal correction on each original image in the image sequence to be spliced to obtain horizontal images corresponding to each original image; wherein the image sequence is a sequence composed of a plurality of original images which are aimed at a predetermined target and are photographed in a predetermined order;
and the first splicing module is used for splicing the horizontal images corresponding to the original images to obtain a first image.
In one embodiment, the level correction module includes:
the acquisition sub-module is used for acquiring two first line segments in the original image, wherein the first line segments are line segments corresponding to actual horizontal lines in a preset target;
the quadrilateral construction submodule is used for constructing a quadrilateral by utilizing the endpoints of the two first line segments;
the horizontal rectangle construction submodule is used for constructing a horizontal rectangle obtained by perspective transformation of the quadrangle;
the determining submodule is used for determining an image perspective transformation matrix for realizing perspective transformation according to the quadrangle and the horizontal rectangle;
and the correction submodule is used for carrying out horizontal correction on the original image by adopting the image perspective transformation matrix.
In one embodiment, the image sequence is an image sequence for at least one of the multi-tier shelves, the predetermined order being a lateral order;
the first splice module includes:
a grouping sub-module for grouping the horizontal images;
the preliminary stitching sub-module is used for stitching the horizontal images in each group left and right to obtain intermediate images corresponding to each group;
and the splicing sub-module is used for splicing all the intermediate images left and right to obtain a first image aiming at least one layer of goods shelf in the multi-layer goods shelf.
In one embodiment, the preliminary stitching sub-module is configured to determine a homography matrix between two adjacent horizontal images in the group; determining parameters of shooting cameras of two horizontal images according to the homography matrix; respectively projecting two horizontal images to a spherical surface with one point as a coordinate center according to parameters of a shooting camera; and splicing the projected images.
In one embodiment, the preliminary stitching submodule is used for respectively extracting feature points of two horizontal images and feature vectors of the feature points; according to the feature vectors of the feature points, determining feature point pairs with matching relations in the two horizontal images; and calculating a homography matrix between the two horizontal images by adopting the characteristic point pairs.
In one embodiment, the method further comprises:
and the integral splicing module is used for splicing the first images obtained by the at least two image sequences to be spliced to obtain an integral image aiming at the preset target.
In a third aspect, an embodiment of the present application proposes an electronic device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of the first aspects.
In a fourth aspect, embodiments of the present application provide a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method of any one of the first aspects.
One embodiment of the above application has the following advantages or benefits: according to the embodiment of the application, the original images to be spliced are subjected to horizontal correction firstly, and then the horizontal images after horizontal correction are spliced, so that requirements on shooting modes and shooting angles are not high, and the splicing effect can be improved.
Other effects of the above alternative will be described below in connection with specific embodiments.
Drawings
The drawings are for better understanding of the present solution and do not constitute a limitation of the present application. Wherein:
FIG. 1 is a flowchart I of an image stitching method implementation according to an embodiment of the present application;
FIG. 2 is a second flowchart of an image stitching method according to an embodiment of the present application;
fig. 3 is a flowchart of implementation of horizontal correction in step S101 in the image stitching method according to the embodiment of the present application;
FIG. 4 is a schematic view of an original image for one shelf according to an embodiment of the present application;
fig. 5 is a flowchart of an implementation of step S102 in an image stitching method according to an embodiment of the present application;
FIG. 6 is a schematic diagram of an overall stitching sequence of an image stitching method according to an embodiment of the present application;
fig. 7 is a flowchart of an implementation of stitching two adjacent horizontal images in the image stitching method according to an embodiment of the present application;
fig. 8 is a flowchart illustrating an implementation of step S701 in an image stitching method according to an embodiment of the present application;
FIG. 9 is a flowchart of a specific implementation of stitching two adjacent images in an image stitching method according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an image stitching device according to an embodiment of the present application;
fig. 11 is a second schematic structural diagram of an image stitching device according to an embodiment of the present application;
fig. 12 is a block diagram of an electronic device for implementing an image stitching method according to an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present application to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
An embodiment of the present application proposes an image stitching method, and fig. 1 is a flowchart for implementing the image stitching method according to an embodiment of the present application, including:
step S101: performing horizontal correction on each original image in the image sequence to be spliced to obtain horizontal images corresponding to each original image; wherein the image sequence is a sequence composed of a plurality of original images which are aimed at a predetermined target and are photographed in a predetermined order;
step S102: and splicing the horizontal images corresponding to the original images to obtain a first image.
The predetermined order in step S101 described above may be a lateral order, for example, a lateral left-to-right order, or a lateral right-to-left order. Accordingly, the stitching in step S102 may be left-right stitching. The first image obtained after the left-right stitching may correspond to a portion of the predetermined target lateral direction, and the plurality of image sequences may correspond to respective portions of the predetermined target lateral direction. In this way, the plurality of image sequences are respectively spliced left and right to obtain a plurality of first images; and then splicing the obtained first images up and down to obtain a global image aiming at the whole range of the preset target.
Specifically, as shown in fig. 2, fig. 2 is a flowchart two of implementation of the image stitching method according to an embodiment of the present application. As shown in fig. 2, after the above step S101, further includes:
step S203: and stitching the first images obtained by the at least two image sequences to be stitched to obtain an integral image aiming at the preset target.
The embodiment of the application can adopt a scheme of splicing left and right firstly and splicing up and down afterwards, and can also adopt a scheme of splicing up and down firstly and splicing left and right afterwards. The specific way of stitching the images is the same for the two schemes except for the stitching order. The following embodiments are described by taking the left-right splicing and then the up-down splicing as examples.
Fig. 3 is a flowchart of implementing horizontal correction in step S101 in an image stitching method according to an embodiment of the present application, including:
step S301: acquiring two first line segments in an original image, wherein the first line segments are line segments corresponding to actual horizontal lines in a preset target;
step S302: constructing a quadrangle by using the endpoints of the two first line segments;
step S303: constructing a horizontal rectangle obtained by perspective transformation of the quadrangle;
step S304: determining an image perspective transformation matrix for realizing perspective transformation according to the quadrangle and the horizontal rectangle;
step S305: and carrying out horizontal correction on the original image by adopting an image perspective transformation matrix.
In one possible embodiment, the predetermined target may be an object, such as a shelf, a bookcase, a building, etc., where there are many horizontal line segments. In the following embodiments, a shelf is described as an example of a predetermined object.
Fig. 4 is a schematic diagram of an original image for one shelf according to an embodiment of the present application. In fig. 4, the black bold lines indicate the compartments of the shelves of each tier, and fig. 4 shows three tiers of shelves with no display of goods in the shelves for clarity. The dashed rectangle represents the original image taken of the shelf. In fig. 4, P101 to P110 are image sequences corresponding to the first layer shelf, P201 to P210 are image sequences corresponding to the second layer shelf, and P301 to P310 are image sequences corresponding to the third layer shelf; each image sequence is taken in a left-to-right or right-to-left lateral order. According to the embodiment of the application, the image sequences of the shelves at each layer can be spliced left and right respectively, and then the spliced images are spliced up and down to obtain the whole image of the shelf. To achieve accurate stitching, there is an overlap region between adjacent original images, as shown in fig. 4.
In actual photographing, it is difficult to ensure the level at the photographing angle. Since the embodiment of the present invention is applied to an object such as a shelf where many horizontal line segments exist, the captured image may be horizontally corrected with reference to the horizontal line segments in the real object and the line segments of the horizontal line segments in the image, that is, the content in steps S301 to S305 described above. It should be emphasized that the "first line segment" in the above step S301 is a line segment corresponding to an actual horizontal line in the real object; in the original image, the first line segment is likely not horizontal. Taking the shelf as an example, the step S301 may obtain a first line segment belonging to the shelf horizontal interlayer in the original image, such as a line segment obtained by cutting a black thick line in fig. 4.
In one embodiment, the step S301 may include:
the first step: and (3) detecting the straight line of the goods shelf:
firstly, carrying out Gaussian filtering and edge detection on an original image, and then taking the obtained edge image as the input of Hough transformation (Hough transformation); and setting proper parameters, such as a minimum line length (minLineLength) parameter and a maximum line interval (maxLinegap) parameter, and detecting all line segments of the input original image by using the cumulative probability Hough transformation.
And a second step of: determining a line segment:
and (3) carrying out de-duplication and screening on the line segments detected in the first step, and only keeping the line segments belonging to the goods shelf. Then, two longest and farthest line segments are selected from the line segments to be used as the first line segments for constructing the quadrangle.
Wherein all segments may be deduplicated and screened according to at least one of the length, slope, intercept, and location of the segments.
In one embodiment, in the step S305, each pixel of the input original image may be transformed according to the solved image perspective transformation matrix, so as to complete horizontal correction of the whole original image, and eliminate the influence of inclination of the shooting angle.
In one embodiment, the sequence of images is a sequence of images for at least one of the multi-tier shelves, and the predetermined order is a lateral order.
Fig. 5 is a flowchart of an implementation of step S102 in an image stitching method according to an embodiment of the present application, including:
step S501: grouping the horizontal images;
step S502: splicing the horizontal images in the groups left and right to obtain intermediate images corresponding to the groups;
step S503: and splicing the intermediate images left and right to obtain a first image aiming at least one layer of the multi-layer shelf.
In one embodiment, the sequence of horizontal pictures of adjacent packets may have a certain overlap, i.e. adjacent two packets contain at least one identical horizontal image. For example, after the original images P101 to P110 of the first-tier pallet in fig. 4 are respectively subjected to horizontal correction, horizontal images P101 'to P110' are obtained. If each group is set to include 7 horizontal images and the overlap ratio of adjacent groups is 2, the horizontal images P101 'to P110' may be divided into two groups, the first group including the horizontal images P101 'to P107', the second group including the horizontal images P106 'to P110', and both groups including the horizontal images P106 'and P107'.
Fig. 6 is a schematic diagram of an overall stitching sequence of an image stitching method according to an embodiment of the present application. As shown in fig. 6, for the input shelf image sequences, stitching is performed on the single-row shelf image sequences respectively to obtain single-row stitched images; and then, splicing all the single-row spliced images up and down to obtain the panoramic shelf image. When splicing the single-row shelf image sequences, firstly carrying out horizontal correction on each original image; grouping the horizontally corrected images, and splicing the images in each group left and right respectively; and finally, splicing all the single-group spliced images obtained by grouping left and right again to obtain a single-row spliced image of the single-row shelf.
Fig. 7 is a flowchart of an implementation of stitching two adjacent horizontal images in an image stitching method according to an embodiment of the present application, including:
step S701: determining a homography matrix between two adjacent horizontal images;
step S702: determining parameters of shooting cameras of two horizontal images according to the homography matrix;
step S703: respectively projecting two horizontal images to a spherical surface with one point as a coordinate center according to parameters of a shooting camera;
step S704: and splicing the projected images.
Fig. 8 is a flowchart of an implementation of step S701 in an image stitching method according to an embodiment of the present application, including:
step S801: extracting feature points and feature vectors of the feature points of the two horizontal images respectively;
step S802: according to the feature vectors of the feature points, determining feature point pairs with matching relations in the two horizontal images;
step S803: and calculating a homography matrix between the two horizontal images by adopting the characteristic point pairs.
Referring now to fig. 9, the implementation of stitching two adjacent horizontal images is described in detail in one particular embodiment. Fig. 9 is a flowchart of a specific implementation of stitching two adjacent images in the image stitching method according to an embodiment of the present application, and in fig. 9, the specific implementation of fig. 7 and fig. 8 is described in detail, including:
step S901: for an input image, feature points of the image are calculated first, and feature vectors of the feature points are obtained. According to the embodiment of the application, the Surf algorithm can be adopted to extract the characteristic points of the image. The Surf algorithm firstly constructs a scale space of an image by changing the size and sigma value of a Gaussian blur kernel, then extracts characteristic points of the image by calculating the value and non-maximum value suppression of Hessian matrix determinant, and finally obtains a 64-dimensional characteristic vector of each characteristic point by counting Haar (Haar) wavelet characteristics in the neighborhood range of each characteristic point.
Step S902: in order to ensure the splicing effect, the shelf image sequence input by the embodiment of the application is continuously shot, the adjacent images are set to be in a matching relationship, and the adjacent images have an overlapping area. After the feature points and the feature vectors of the images are obtained, a homography matrix between the images is required to be calculated through the matching relation of the feature points of the image overlapping area. Specifically, the feature vector of the feature point in each image can be matched with the feature vector of the feature point in other images by adopting a nearest neighbor algorithm (2-NN) to obtain a matching point pair between the two images. Modeling the matching point pairs by adopting an Affine (Affine) transformation matrix, and calculating to obtain a homography matrix between the two images.
Step S903: after the homography matrix between the images is obtained, the internal parameters and the external parameters of each image during shooting can be solved according to the small-hole imaging model of the camera. Specifically, in the embodiment of the application, the initial value of the camera parameter can be calculated through the relation between the homography matrix and the internal and external parameters of the camera, and then the camera parameter is further optimized by adopting a beam adjustment method (Bundle Adjustment), so that the accurate values of the internal and external parameters of the camera are solved.
Step S904: in order to ensure the visual consistency of the actual field of view after stitching, the projection transformation of the images is also required before stitching. Specifically, the image may be transformed by spherical projection, and each pixel point on the image plane is projected onto a spherical surface with a point as a coordinate center according to the spherical projection model by using the internal parameters and the external parameters of the camera solved in step S903, so as to distort the image.
Step S905: when the projected images are spliced, the overlapping area of the matched images is processed by adopting a multi-band fusion method. Specifically, the multi-band fusion method includes the steps of firstly, respectively establishing Laplacian pyramids of each image, then merging identical layers of the image pyramids according to overlapping areas among the images, enabling information of all frequency bands to be reserved and fused together, and finally, carrying out inverse Laplacian transformation on the merged pyramids to obtain a final fusion image.
The embodiments described above with respect to fig. 7, 8 and 9 describe a specific way of stitching two adjacent images. In the embodiment of the present application, the adjacent two horizontal images in each group are spliced in the above manner, and in the embodiment of the present application, the intermediate images obtained after each group is spliced in the above manner may be spliced again to obtain a first image corresponding to an image sequence; further, in the embodiment of the present application, the above manner may also be adopted to splice each first image, so as to obtain an overall image for a predetermined target.
An embodiment of the present application further provides an image stitching device, fig. 10 is a schematic structural diagram of the image stitching device according to the embodiment of the present application, and the image stitching device 1000 shown in fig. 10 includes:
the horizontal correction module 1010 is configured to perform horizontal correction on each original image in the image sequence to be stitched, so as to obtain horizontal images corresponding to each original image; the image sequence is a sequence composed of a plurality of original images for a predetermined target and photographed in a predetermined order;
and the first stitching module 1020 is configured to stitch the horizontal images corresponding to the original images to obtain a first image.
Fig. 11 is a second schematic structural diagram of an image stitching device according to an embodiment of the present application, in an image stitching device 1100 shown in fig. 11, a horizontal correction module 1010 includes:
an obtaining submodule 1011, configured to obtain two first line segments in an original image, where the first line segments are line segments corresponding to actual horizontal lines in a predetermined target;
a quadrilateral construction sub-module 1012, configured to construct a quadrilateral using endpoints of the two first line segments;
a horizontal rectangle construction submodule 1013 for constructing a horizontal rectangle obtained by perspective transformation of the quadrangle;
a determination submodule 1014 for determining an image perspective transformation matrix for realizing perspective transformation from the quadrangle and the horizontal rectangle;
a correction submodule 1015 for performing horizontal correction on the original image by using the image perspective transformation matrix.
In one possible embodiment, the image sequence is an image sequence for at least one of the multi-tier shelves, the predetermined order being a lateral order;
as shown in fig. 11, the first splicing module 1020 may include:
a grouping sub-module 1021 for grouping the horizontal images;
a preliminary stitching sub-module 1022, configured to stitch the horizontal images in each group left and right to obtain intermediate images corresponding to each group;
and a re-stitching sub-module 1023, configured to stitch each intermediate image left and right, so as to obtain a first image for at least one layer of the multi-layer shelves.
In one possible implementation, the preliminary stitching sub-module 1022 is configured to determine a homography matrix between two adjacent horizontal images in the group; determining parameters of shooting cameras of two horizontal images according to the homography matrix; respectively projecting two horizontal images to a spherical surface with one point as a coordinate center according to parameters of a shooting camera; and splicing the projected images.
In one possible implementation, the preliminary stitching sub-module 1022 is configured to extract feature points of two horizontal images and feature vectors of the feature points, respectively; according to the feature vectors of the feature points, determining feature point pairs with matching relations in the two horizontal images; and calculating a homography matrix between the two horizontal images by adopting the characteristic point pairs.
As shown in fig. 11, the apparatus may further include:
and the overall stitching module 1130 is configured to stitch the first images obtained by the at least two image sequences to be stitched to obtain an overall image for the predetermined target.
The functions of each module in each device in the embodiments of the present application may be referred to the corresponding descriptions in the above methods, and are not repeated herein.
According to embodiments of the present application, an electronic device and a readable storage medium are also provided.
As shown in fig. 12, a block diagram of an electronic device according to an image stitching method according to an embodiment of the present application is shown. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the application described and/or claimed herein.
As shown in fig. 12, the electronic device includes: one or more processors 1201, memory 1202, and interfaces for connecting the various components, including a high-speed interface and a low-speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions executing within the electronic device, including instructions stored in or on memory to display graphical information of a graphical user interface (Graphical User Interface, GUI) on an external input/output device, such as a display device coupled to the interface. In other embodiments, multiple processors and/or multiple buses may be used, if desired, along with multiple memories and multiple memories. Also, multiple electronic devices may be connected, each providing a portion of the necessary operations (e.g., as a server array, a set of blade servers, or a multiprocessor system). One processor 1201 is illustrated in fig. 12.
Memory 1202 is a non-transitory computer-readable storage medium provided herein. Wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the method of image stitching provided herein. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the method of image stitching provided herein.
The memory 1202 is used as a non-transitory computer readable storage medium for storing non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules (e.g., the level correction module 1010 and the first stitching module 1020 shown in fig. 10) corresponding to the image stitching method in the embodiments of the present application. The processor 1201 performs various functional applications of the server and data processing, i.e., a method of implementing image stitching in the above-described method embodiments, by running non-transitory software programs, instructions, and modules stored in the memory 1202.
Memory 1202 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created according to the use of the image stitched electronic device, etc. In addition, memory 1202 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 1202 optionally includes memory remotely located with respect to processor 1201, which may be connected to the image stitching electronics via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the image stitching method may further include: an input device 1203 and an output device 1204. The processor 1201, the memory 1202, the input device 1203, and the output device 1204 may be connected by a bus or otherwise, for example in fig. 12.
The input device 1203 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the image stitched electronic device, such as a touch screen, keypad, mouse, trackpad, touchpad, pointer stick, one or more mouse buttons, track ball, joystick, etc. input devices. The output device 1204 may include a display apparatus, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibration motors), among others. The display device may include, but is not limited to, a liquid crystal display (Liquid Crystal Display, LCD), a light emitting diode (Light Emitting Diode, LED) display, and a plasma display. In some implementations, the display device may be a touch screen.
Various implementations of the systems and techniques described here can be implemented in digital electronic circuitry, integrated circuitry, application specific integrated circuits (Application Specific Integrated Circuits, ASIC), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
These computing programs (also referred to as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented in a high-level procedural and/or object-oriented programming language, and/or in assembly/machine language. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, programmable logic devices (programmable logic device, PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., CRT (Cathode Ray Tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local area network (Local Area Network, LAN), wide area network (Wide Area Network, WAN) and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
According to the technical scheme of the embodiment of the application, the original images to be spliced are subjected to horizontal correction firstly, and then the horizontal images after the horizontal correction are spliced, so that requirements on shooting modes and shooting angles are not high, and the splicing effect can be improved. In addition, in the embodiment of the application, a step-by-step stitching mode is adopted, each image sequence is stitched firstly, and then first images obtained by stitching all the image sequences are stitched, so that panoramic images aiming at preset targets are obtained. When the image sequences are spliced, horizontal images after horizontal correction can be grouped, firstly, the horizontal images in each group are spliced respectively, and then, intermediate images obtained by all groups are spliced to obtain a first image. The step-by-step splicing mode can improve the operation speed and obtain a good splicing effect.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present application may be performed in parallel, sequentially, or in a different order, provided that the desired results of the technical solutions disclosed in the present application can be achieved, and are not limited herein.
The above embodiments do not limit the scope of the application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application are intended to be included within the scope of the present application.

Claims (12)

1. An image stitching method, comprising:
performing horizontal correction on each original image in the image sequence to be spliced to obtain horizontal images corresponding to each original image; wherein the image sequence is a sequence composed of a plurality of original images which are aimed at a predetermined target and are photographed in a predetermined order;
splicing the horizontal images corresponding to the original images to obtain a first image;
wherein, the horizontal correction mode is as follows:
acquiring two first line segments in the original image, wherein the first line segments are line segments corresponding to actual horizontal lines in the preset target;
constructing a quadrangle by utilizing the endpoints of the two first line segments;
constructing a horizontal rectangle obtained by perspective transformation of the quadrangle;
determining an image perspective transformation matrix for realizing the perspective transformation according to the quadrangle and the horizontal rectangle;
and carrying out horizontal correction on the original image by adopting the image perspective transformation matrix.
2. The method of claim 1, wherein the sequence of images is a sequence of images for at least one of the multi-tier shelves, the predetermined order being a lateral order;
the step of stitching the horizontal images corresponding to the original images to obtain a first image comprises the following steps:
grouping the horizontal images;
the horizontal images in each group are spliced left and right to obtain intermediate images corresponding to each group;
and splicing the intermediate images left and right to obtain a first image aiming at least one layer of goods shelf in the multi-layer goods shelf.
3. The method according to claim 2, wherein in the step of splicing the horizontal images in each group left and right, the manner of splicing two adjacent horizontal images is as follows:
determining a homography matrix between the two adjacent horizontal images;
determining parameters of shooting cameras of the two horizontal images according to the homography matrix;
respectively projecting the two horizontal images to a spherical surface with one point as a coordinate center according to the parameters of the shooting camera;
and splicing the projected images.
4. A method according to claim 3, wherein said determining a homography matrix between said two adjacent horizontal images comprises:
extracting feature points and feature vectors of the feature points of the two horizontal images respectively;
according to the feature vectors of the feature points, determining feature point pairs with matching relations in the two horizontal images;
and calculating a homography matrix between the two horizontal images by adopting the characteristic point pairs.
5. The method according to any one of claims 1 to 4, further comprising:
and stitching the first images obtained by the at least two image sequences to be stitched to obtain an overall image aiming at the preset target.
6. An image stitching device, comprising:
the horizontal correction module is used for carrying out horizontal correction on each original image in the image sequence to be spliced to obtain horizontal images corresponding to each original image; wherein the image sequence is a sequence composed of a plurality of original images which are aimed at a predetermined target and are photographed in a predetermined order;
the first splicing module is used for splicing the horizontal images corresponding to the original images to obtain a first image;
wherein the level correction module comprises:
the acquisition submodule is used for acquiring two first line segments in the original image, wherein the first line segments are line segments corresponding to actual horizontal lines in the preset target;
the quadrilateral construction submodule is used for constructing a quadrilateral by utilizing the endpoints of the two first line segments;
the horizontal rectangle construction submodule is used for constructing a horizontal rectangle obtained by perspective transformation of the quadrangle;
a determining submodule, configured to determine an image perspective transformation matrix for implementing the perspective transformation according to the quadrangle and the horizontal rectangle;
and the correction submodule is used for carrying out horizontal correction on the original image by adopting the image perspective transformation matrix.
7. The apparatus of claim 6, wherein the sequence of images is a sequence of images for at least one of the multi-tier shelves, the predetermined order being a lateral order;
the first splicing module comprises:
a grouping sub-module for grouping the horizontal images;
the preliminary stitching sub-module is used for stitching the horizontal images in each group left and right to obtain intermediate images corresponding to each group;
and the splicing sub-module is used for splicing the intermediate images left and right to obtain a first image aiming at least one layer of goods shelf in the multi-layer goods shelf.
8. The apparatus of claim 7, wherein the preliminary stitching submodule is configured to determine a homography matrix between two adjacent horizontal images in the group; determining parameters of shooting cameras of the two horizontal images according to the homography matrix; respectively projecting the two horizontal images to a spherical surface with one point as a coordinate center according to the parameters of the shooting camera; and splicing the projected images.
9. The apparatus of claim 8, wherein the preliminary stitching submodule is configured to extract feature points and feature vectors of feature points of the two horizontal images, respectively; according to the feature vectors of the feature points, determining feature point pairs with matching relations in the two horizontal images; and calculating a homography matrix between the two horizontal images by adopting the characteristic point pairs.
10. The apparatus according to any one of claims 6 to 9, further comprising:
and the integral splicing module is used for splicing the first images obtained by the at least two image sequences to be spliced to obtain integral images aiming at the preset target.
11. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 5.
12. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1 to 5.
CN201910974743.1A 2019-10-14 2019-10-14 Image stitching method and device, electronic equipment and storage medium Active CN110738599B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910974743.1A CN110738599B (en) 2019-10-14 2019-10-14 Image stitching method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910974743.1A CN110738599B (en) 2019-10-14 2019-10-14 Image stitching method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110738599A CN110738599A (en) 2020-01-31
CN110738599B true CN110738599B (en) 2023-04-25

Family

ID=69268873

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910974743.1A Active CN110738599B (en) 2019-10-14 2019-10-14 Image stitching method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110738599B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111415298B (en) * 2020-03-20 2023-06-02 北京百度网讯科技有限公司 Image stitching method and device, electronic equipment and computer readable storage medium
CN112052499B (en) * 2020-09-02 2024-03-12 浙江数智交院科技股份有限公司 Modeling method and device for illumination tube, electronic equipment and storage medium
CN113297889A (en) * 2020-10-21 2021-08-24 阿里巴巴集团控股有限公司 Object information processing method and device
CN113915871A (en) * 2021-03-05 2022-01-11 海信(山东)冰箱有限公司 Refrigerator and control method thereof
CN112991180B (en) * 2021-03-25 2023-10-31 北京百度网讯科技有限公司 Image stitching method, device, equipment and storage medium
CN113393378B (en) * 2021-05-26 2023-05-02 浙江大华技术股份有限公司 Image stitching method and device of photovoltaic module, electronic device and storage medium

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005014863A1 (en) * 2003-08-07 2005-02-17 Bionomics Limited Mutations in ion channels
JP2008118555A (en) * 2006-11-07 2008-05-22 Canon Inc Image processor, image pickup device, and image processing method
CN103369192A (en) * 2012-03-31 2013-10-23 深圳市振华微电子有限公司 Method and device for Full-hardware splicing of multichannel video images
CN103533279A (en) * 2013-10-24 2014-01-22 深圳市晶日盛科技有限公司 Calibration method for multi-projection splicing
WO2014072511A1 (en) * 2012-11-09 2014-05-15 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. Determination of rectifying homographies for a camera array
CN104363438A (en) * 2014-12-03 2015-02-18 中测新图(北京)遥感技术有限责任公司 Panoramic three-dimensional image manufacturing method
WO2015114621A1 (en) * 2014-02-02 2015-08-06 Trax Technology Solutions Pte. Ltd. System and method for panoramic image processing
CN104966092A (en) * 2015-06-16 2015-10-07 中国联合网络通信集团有限公司 Image processing method and device
JP5846268B1 (en) * 2014-08-12 2016-01-20 株式会社リコー Image processing system, image processing apparatus, program, and imaging system
CN106683045A (en) * 2016-09-28 2017-05-17 深圳市优象计算技术有限公司 Binocular camera-based panoramic image splicing method
CN107808362A (en) * 2017-11-15 2018-03-16 北京工业大学 A kind of image split-joint method combined based on unmanned plane POS information with image SURF features
CN109035134A (en) * 2017-06-08 2018-12-18 株式会社理光 Panorama Mosaic method, apparatus, electronic equipment and storage medium
CN109858527A (en) * 2019-01-09 2019-06-07 北京全路通信信号研究设计院集团有限公司 Image fusion method
CN110197455A (en) * 2019-06-03 2019-09-03 北京石油化工学院 Acquisition methods, device, equipment and the storage medium of two-dimensional panoramic image

Family Cites Families (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2752947A1 (en) * 2011-06-30 2012-12-30 Benjamin J. Blencowe Foxp1 splice variants and methods and uses thereof
US9533618B2 (en) * 2014-03-07 2017-01-03 Texas Instruments Incorporated Method, apparatus and system for processing a display from a surround view camera solution
CN105678722A (en) * 2014-11-20 2016-06-15 深圳英飞拓科技股份有限公司 Panoramic stitched image bending correction method and panoramic stitched image bending correction device
WO2016203282A1 (en) * 2015-06-18 2016-12-22 The Nielsen Company (Us), Llc Methods and apparatus to capture photographs using mobile devices
US9986150B2 (en) * 2015-09-30 2018-05-29 Ricoh Co., Ltd. Algorithm to estimate yaw errors in camera pose
CN105389787A (en) * 2015-09-30 2016-03-09 华为技术有限公司 Panorama image stitching method and device
CN106355553B (en) * 2016-09-06 2019-08-27 深圳格兰泰克汽车电子有限公司 One kind 360 looks around joining method and device
CN107464214B (en) * 2017-06-16 2020-09-25 理光软件研究所(北京)有限公司 Method for generating panoramic view of solar power station
CN107689029A (en) * 2017-09-01 2018-02-13 努比亚技术有限公司 Image processing method, mobile terminal and computer-readable recording medium
CN108038826B (en) * 2017-12-28 2021-12-07 上海小零网络科技有限公司 Method and device for correcting perspective deformed shelf image
CN108447022B (en) * 2018-03-20 2019-10-18 北京天睿空间科技股份有限公司 Moving target joining method based on single fixing camera image sequence
CN109064395B (en) * 2018-06-19 2023-06-16 广东数相智能科技有限公司 Bookshelf image splicing method based on book checking, electronic equipment and storage medium
CN109146778A (en) * 2018-07-02 2019-01-04 广西电网有限责任公司北海供电局 Image split-joint method for workpiece size measurement
CN109146781A (en) * 2018-07-20 2019-01-04 深圳市创客工场科技有限公司 Method for correcting image and device, electronic equipment in laser cutting
CN109087251B (en) * 2018-08-30 2020-10-30 上海大学 Vehicle-mounted panoramic image display method and system
CN109767381A (en) * 2018-12-13 2019-05-17 烟台大学 A kind of rectangle panoramic picture building method of the shape optimum based on feature selecting
CN110020995B (en) * 2019-03-06 2023-02-07 沈阳理工大学 Image splicing method for complex images
CN110120010B (en) * 2019-04-12 2023-02-07 嘉兴恒创电力集团有限公司博创物资分公司 Camera image stitching-based visual checking method and system for three-dimensional goods shelf

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005014863A1 (en) * 2003-08-07 2005-02-17 Bionomics Limited Mutations in ion channels
JP2008118555A (en) * 2006-11-07 2008-05-22 Canon Inc Image processor, image pickup device, and image processing method
CN103369192A (en) * 2012-03-31 2013-10-23 深圳市振华微电子有限公司 Method and device for Full-hardware splicing of multichannel video images
WO2014072511A1 (en) * 2012-11-09 2014-05-15 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. Determination of rectifying homographies for a camera array
CN103533279A (en) * 2013-10-24 2014-01-22 深圳市晶日盛科技有限公司 Calibration method for multi-projection splicing
WO2015114621A1 (en) * 2014-02-02 2015-08-06 Trax Technology Solutions Pte. Ltd. System and method for panoramic image processing
JP5846268B1 (en) * 2014-08-12 2016-01-20 株式会社リコー Image processing system, image processing apparatus, program, and imaging system
CN104363438A (en) * 2014-12-03 2015-02-18 中测新图(北京)遥感技术有限责任公司 Panoramic three-dimensional image manufacturing method
CN104966092A (en) * 2015-06-16 2015-10-07 中国联合网络通信集团有限公司 Image processing method and device
CN106683045A (en) * 2016-09-28 2017-05-17 深圳市优象计算技术有限公司 Binocular camera-based panoramic image splicing method
CN109035134A (en) * 2017-06-08 2018-12-18 株式会社理光 Panorama Mosaic method, apparatus, electronic equipment and storage medium
CN107808362A (en) * 2017-11-15 2018-03-16 北京工业大学 A kind of image split-joint method combined based on unmanned plane POS information with image SURF features
CN109858527A (en) * 2019-01-09 2019-06-07 北京全路通信信号研究设计院集团有限公司 Image fusion method
CN110197455A (en) * 2019-06-03 2019-09-03 北京石油化工学院 Acquisition methods, device, equipment and the storage medium of two-dimensional panoramic image

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
周媛媛.钻孔摄像机器人视频序列拼接.《云南民族大学学报(自然科学版)》.2019,第28卷(第01期),81-87. *

Also Published As

Publication number Publication date
CN110738599A (en) 2020-01-31

Similar Documents

Publication Publication Date Title
CN110738599B (en) Image stitching method and device, electronic equipment and storage medium
Shih et al. 3d photography using context-aware layered depth inpainting
US10630956B2 (en) Image processing method and apparatus
CN109242961B (en) Face modeling method and device, electronic equipment and computer readable medium
CN111523468B (en) Human body key point identification method and device
CN107851321B (en) Image processing method and dual-camera system
US11074437B2 (en) Method, apparatus, electronic device and storage medium for expression driving
CN111291885A (en) Near-infrared image generation method, network generation training method and device
CN111722245B (en) Positioning method, positioning device and electronic equipment
CN111709973B (en) Target tracking method, device, equipment and storage medium
CN111612852B (en) Method and apparatus for verifying camera parameters
WO2017176515A1 (en) Image stitching
CN110443230A (en) Face fusion method, apparatus and electronic equipment
CN111275827B (en) Edge-based augmented reality three-dimensional tracking registration method and device and electronic equipment
CN110555838A (en) Image-based part fault detection method and device
CN112489102A (en) Three-dimensional reconstruction method, device, equipment and storage medium
CN111932464B (en) Super-resolution model using and training method, device, equipment and medium
CN112184837B (en) Image detection method and device, electronic equipment and storage medium
CN111222579A (en) Cross-camera obstacle association method, device, equipment, electronic system and medium
CN109285122A (en) A kind of method and apparatus carrying out image procossing
CN114399610B (en) Texture mapping system and method based on guide priori
CN111191619A (en) Method, device and equipment for detecting virtual line segment of lane line and readable storage medium
CN112634366B (en) Method for generating position information, related device and computer program product
US11195322B2 (en) Image processing apparatus, system that generates virtual viewpoint video image, control method of image processing apparatus and storage medium
CN111369571B (en) Three-dimensional object pose accuracy judging method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant