Disclosure of Invention
The present disclosure is proposed to solve the above technical problems. The embodiment of the disclosure provides an image splicing method, an image splicing device, a panorama splicing method, a panorama splicing device, a storage medium and electronic equipment.
According to an aspect of the embodiments of the present disclosure, there is provided an image stitching method, including:
determining an internal reference matrix of a current camera;
determining a first mapping matrix corresponding to the two first images based on pose information when the current camera shoots the two first images and an internal reference matrix of the current camera; wherein, there is partial overlap between the two first images, and the two first images can not establish connection relationship through characteristic information;
and splicing the two first images based on the first mapping matrix.
Optionally, the determining an internal reference matrix of the current camera includes:
determining an internal reference matrix of the current camera based on two second images with partial overlap taken by the current camera; wherein, the two second images can establish a connection relationship through the characteristic information.
Optionally, the determining an internal reference matrix of the current camera based on two second images with partial overlap captured by the current camera includes:
determining a second mapping matrix based on the two second images;
and determining the internal reference matrix of the current camera based on the second mapping matrix by using a self-calibration algorithm.
Optionally, the determining a second mapping matrix based on the two second images includes:
respectively extracting the features of the two second images to obtain a first feature point set and a second feature point set; wherein the first feature point set comprises a plurality of first feature points, and the second feature point set comprises a plurality of second feature points;
determining the second mapping matrix based on a plurality of pairs of characteristic points included in the first characteristic point set and the second characteristic point set; wherein each pair of the characteristic point pairs includes the first characteristic point and the second characteristic point which have a corresponding relationship.
Optionally, the determining the second mapping matrix based on the pairs of feature point pairs included in the first feature point set and the second feature point set includes:
determining the pairs of feature points based on a distance between a descriptor of each first feature point in the first set of feature points and a descriptor of each second feature point in the second set of feature points;
determining the second mapping matrix based on a mapping relationship between each pair of the plurality of pairs of feature points.
Optionally, the determining an internal reference matrix of the current camera includes:
determining an internal reference matrix for the current camera based on an exchangeable image file format of the first image.
Optionally, the determining a first mapping matrix corresponding to the two first images based on pose information of the current camera when the current camera takes the two first images and an internal reference matrix of the current camera includes:
determining a rotation matrix representing a rotation relationship between the two first images based on rotation information and translation information when the current camera takes the two first images;
and determining a first mapping matrix corresponding to the two first images based on the rotation matrix and the internal reference matrix of the current camera.
Optionally, the determining a rotation matrix representing a rotation relationship between the two first images based on rotation information and translation information of the current camera when the two first images are captured includes:
acquiring rotation information and translation information of the current camera when the current camera shoots the two first images to obtain two groups of rotation information and two groups of translation information;
determining a rotation matrix representing a rotational relationship between the two first images based on the two sets of rotation information and the two sets of translation information.
According to another aspect of the embodiments of the present disclosure, a panorama stitching method is provided, including:
annularly shooting at a point location by using a current camera to obtain an image sequence to be spliced; each two adjacent images of the plurality of images included in the image sequence are partially overlapped;
splicing every two adjacent images in the image sequence to obtain a spliced panoramic image; wherein the stitching of every two adjacent images is realized based on the image stitching method according to any one of claims 1 to 8.
Optionally, before stitching each two adjacent images in the image sequence to obtain a stitched panorama, the method further includes:
determining a reference coordinate system corresponding to a plurality of images in the image sequence;
the splicing of every two adjacent images in the image sequence to obtain a spliced panoramic image comprises the following steps:
converting a plurality of images in the image sequence into a reference coordinate system for representation to obtain a plurality of reference images;
and splicing every two adjacent reference images in the plurality of reference images to obtain a spliced panoramic image.
Optionally, the stitching each two adjacent reference images in the plurality of reference images to obtain a stitched panorama includes:
splicing every two adjacent reference images in the plurality of reference images to obtain an initial splicing image;
performing global optimization on the initial mosaic image, and adjusting a first mapping matrix spliced between every two adjacent reference images to obtain a plurality of adjusted third mapping matrices;
and splicing the plurality of reference images based on the plurality of third mapping matrixes to obtain a spliced panoramic image.
According to still another aspect of the embodiments of the present disclosure, there is provided an image stitching device including:
the internal reference determining module is used for determining an internal reference matrix of the current camera;
the first mapping determining module is used for determining a first mapping matrix corresponding to the two first images based on pose information when the current camera shoots the two first images and an internal reference matrix of the current camera; wherein, there is partial overlap between the two first images, and the two first images can not establish connection relationship through characteristic information;
and the image splicing module is used for splicing the two first images based on the first mapping matrix.
Optionally, the internal reference determining module is specifically configured to determine an internal reference matrix of the current camera based on two second images with partial overlap captured by the current camera; wherein, the two second images can establish a connection relationship through the characteristic information.
Optionally, the internal reference determining module includes:
a second mapping unit for determining a second mapping matrix based on the two second images;
and the self-calibration unit is used for determining the internal parameter matrix of the current camera based on the second mapping matrix by utilizing a self-calibration algorithm.
Optionally, the second mapping unit is specifically configured to perform feature extraction on the two second images, so as to obtain a first feature point set and a second feature point set; wherein the first feature point set comprises a plurality of first feature points, and the second feature point set comprises a plurality of second feature points; determining the second mapping matrix based on a plurality of pairs of characteristic points included in the first characteristic point set and the second characteristic point set; wherein each pair of the characteristic point pairs includes the first characteristic point and the second characteristic point which have a corresponding relationship.
Optionally, the second mapping unit, when determining the second mapping matrix based on pairs of feature point pairs included in the first feature point set and the second feature point set, is configured to determine the pairs of feature point pairs based on a distance between a descriptor of each first feature point in the first feature point set and a descriptor of each second feature point in the second feature point set; determining the second mapping matrix based on a mapping relationship between each pair of the plurality of pairs of feature points.
Optionally, the internal reference determining module is specifically configured to determine the internal reference matrix of the current camera based on an exchangeable image file format of the first image.
Optionally, the first mapping determining module includes:
a rotation matrix determination unit configured to determine a rotation matrix indicating a rotation relationship between the two first images based on rotation information and translation information when the current camera captures the two first images;
and the first mapping unit is used for determining a first mapping matrix corresponding to the two first images based on the rotation matrix and the internal reference matrix of the current camera.
Optionally, the rotation matrix determining unit is specifically configured to obtain rotation information and translation information of the current camera when the current camera captures the two first images, so as to obtain two sets of rotation information and two sets of translation information; determining a rotation matrix representing a rotational relationship between the two first images based on the two sets of rotation information and the two sets of translation information.
According to still another aspect of the embodiments of the present disclosure, there is provided a panorama stitching apparatus, including:
the image acquisition module is used for annularly shooting at a point location by using a current camera to obtain an image sequence to be spliced; each two adjacent images of the plurality of images included in the image sequence are partially overlapped;
the panorama stitching module is used for stitching every two adjacent images in the image sequence to obtain a stitched panorama; wherein the stitching of every two adjacent images is realized based on the image stitching method according to any one of claims 1 to 8.
Optionally, the apparatus further comprises:
a coordinate system determining module, configured to determine a reference coordinate system corresponding to a plurality of images in the image sequence;
the panorama stitching module is specifically configured to convert a plurality of images in the image sequence into a reference coordinate system for representation, so as to obtain a plurality of reference images; and splicing every two adjacent reference images in the plurality of reference images to obtain a spliced panoramic image.
Optionally, the panorama stitching module is configured to, when stitching every two adjacent reference images in the plurality of reference images to obtain a stitched panorama, stitch every two adjacent reference images in the plurality of reference images to obtain an initial stitched image; performing global optimization on the initial mosaic image, and adjusting a first mapping matrix spliced between every two adjacent reference images to obtain a plurality of adjusted third mapping matrices; and splicing the plurality of reference images based on the plurality of third mapping matrixes to obtain a spliced panoramic image.
According to a further aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium storing a computer program for executing the method of any of the above embodiments.
According to still another aspect of the embodiments of the present disclosure, there is provided an electronic apparatus, including:
a processor;
a memory for storing the processor-executable instructions;
the processor is configured to read the executable instructions from the memory and execute the instructions to implement the method according to any of the embodiments.
Based on the image stitching and panorama stitching method and device, the storage medium and the electronic device provided by the embodiment of the disclosure, an internal reference matrix of the current camera is determined; determining a first mapping matrix corresponding to the two first images based on pose information when the current camera shoots the two first images and an internal reference matrix of the current camera; wherein, there is partial overlap between the two first images, and the two first images can not establish connection relationship through characteristic information; splicing the two first images based on the first mapping matrix; in the embodiment, the mapping matrix corresponding to the two images which cannot be connected through the characteristic information can be determined by determining the camera internal parameters, so that the images which cannot be spliced through the characteristic information are spliced, and the technical problem which cannot be solved in the prior art is solved.
The technical solution of the present disclosure is further described in detail by the accompanying drawings and examples.
Detailed Description
Hereinafter, example embodiments according to the present disclosure will be described in detail with reference to the accompanying drawings. It is to be understood that the described embodiments are merely a subset of the embodiments of the present disclosure and not all embodiments of the present disclosure, with the understanding that the present disclosure is not limited to the example embodiments described herein.
It should be noted that: the relative arrangement of the components and steps, the numerical expressions, and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.
It will be understood by those of skill in the art that the terms "first," "second," and the like in the embodiments of the present disclosure are used merely to distinguish one element from another, and are not intended to imply any particular technical meaning, nor is the necessary logical order between them.
It is also understood that in embodiments of the present disclosure, "a plurality" may refer to two or more and "at least one" may refer to one, two or more.
It is also to be understood that any reference to any component, data, or structure in the embodiments of the disclosure, may be generally understood as one or more, unless explicitly defined otherwise or stated otherwise.
In addition, the term "and/or" in the present disclosure is only one kind of association relationship describing an associated object, and means that three kinds of relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" in the present disclosure generally indicates that the former and latter associated objects are in an "or" relationship.
It should also be understood that the description of the various embodiments of the present disclosure emphasizes the differences between the various embodiments, and the same or similar parts may be referred to each other, so that the descriptions thereof are omitted for brevity.
Meanwhile, it should be understood that the sizes of the respective portions shown in the drawings are not drawn in an actual proportional relationship for the convenience of description.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses.
Techniques, methods, and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
The disclosed embodiments may be applied to electronic devices such as terminal devices, computer systems, servers, etc., which are operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well known terminal devices, computing systems, environments, and/or configurations that may be suitable for use with electronic devices, such as terminal devices, computer systems, servers, and the like, include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, hand-held or laptop devices, microprocessor-based systems, set top boxes, programmable consumer electronics, network pcs, minicomputer systems, mainframe computer systems, distributed cloud computing environments that include any of the above systems, and the like.
Electronic devices such as terminal devices, computer systems, servers, etc. may be described in the general context of computer system-executable instructions, such as program modules, being executed by a computer system. Generally, program modules may include routines, programs, objects, components, logic, data structures, etc. that perform particular tasks or implement particular abstract data types. The computer system/server may be practiced in distributed cloud computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed cloud computing environment, program modules may be located in both local and remote computer system storage media including memory storage devices.
Summary of the application
In the process of implementing the present disclosure, the inventors find that, in the prior art, image stitching is usually implemented based on feature points, and this technical solution has at least the following problems: in the case where there are few features in an image, the features are concentrated in a local area of the image, or the feature matching accuracy is low, it is difficult to accurately restore the transformation relationship between images.
Exemplary method
Fig. 1 is a schematic flowchart of an image stitching method according to an exemplary embodiment of the present disclosure. The embodiment can be applied to an electronic device, as shown in fig. 1, and includes the following steps:
step 102, determining an internal reference matrix of a current camera.
Optionally, the internal reference matrix is a 3 × 3 matrix, where elements in the internal reference matrix include an internal reference focal length and an optical center coordinate of the camera, and in this embodiment, the optical center coordinate may be considered as a center of the image and is a determined value; that is, in the internal parameter matrix to be determined in this embodiment, only the focal length is an unknown number, and optionally, the internal parameter matrix of the current camera is determined by determining the focal length of the camera.
And 104, determining a first mapping matrix corresponding to the two first images based on pose information when the current camera shoots the two first images and the internal reference matrix of the current camera.
Wherein, there is partial overlap between two first images, and two first images can not establish connection relation through characteristic information.
In an embodiment, when two first images cannot establish a connection relationship through feature information, the prior art cannot splice the two first images, and the connection relationship between the two first images can be restored through an internal reference matrix of a current camera and pose information of the current camera when the two first images are shot.
And 106, splicing the two first images based on the first mapping matrix.
In this embodiment, a connection relationship between the two first images is established through the first mapping matrix, and based on the connection relationship, stitching (or fusion) between the two first images can be achieved.
The image stitching method provided by the embodiment of the disclosure determines an internal reference matrix of a current camera; determining a first mapping matrix corresponding to the two first images based on pose information when the current camera shoots the two first images and an internal reference matrix of the current camera; wherein, there is partial overlap between the two first images, and the two first images can not establish connection relationship through characteristic information; splicing the two first images based on the first mapping matrix; in the embodiment, the mapping matrix corresponding to the two images which cannot be connected through the characteristic information can be determined by determining the camera internal parameters, so that the images which cannot be spliced through the characteristic information are spliced, and the technical problem which cannot be solved in the prior art is solved.
In some alternative embodiments, step 102 may include:
based on two second images with partial overlap taken by the current camera, an internal reference matrix of the current camera is determined.
Wherein, the two second images can establish a connection relationship through the characteristic information.
In this embodiment, the determination of the internal reference of the camera based on the camera prior information is realized by determining the internal reference matrix of the current camera by using two second images that can establish a connection relationship through feature information (e.g., feature points).
As shown in fig. 2, based on the embodiment shown in fig. 1, step 102 may include the following steps:
step 1021, determining a second mapping matrix based on the two second images.
And 1022, determining the internal reference matrix of the current camera based on the second mapping matrix by using a self-calibration algorithm.
In this embodiment, the connection relationship between the two second images is established through the feature points in the two second images, and the corresponding second mapping matrix H is determined2In this embodiment, the internal reference matrix of the current camera is determined by a self-calibration algorithm, where the self-calibration algorithm: the existence of the mapping matrix H between any two images with partial overlap can be derived by deriving equation (1):
wherein, K1And K2The intrinsic matrices (which may be denoted as 3 × 3 matrices) respectively representing the two images of the camera, in this embodiment, it may be assumed that the shift of the optical center of the camera with respect to the image center is 0, then the intrinsic matrices of the camera have and only the focal length is unknown parameters, and then pass through the rotation matrix (also 3 × 3 matrix), and, since the rotation matrix is a special orthogonal matrix (R ∈ SO3, with a determinant of 1), the properties of all orthogonal matrices are satisfied, such as each column is an identity matrix and two-by-two orthogonalSecond mapping matrix H2The formula (1) is substituted, and the internal reference matrix K of the current camera can be obtained1And K2。
As shown in fig. 3, based on the embodiment shown in fig. 2, step 1021 may include the following steps:
step 301, respectively performing feature extraction on the two second images to obtain a first feature point set and a second feature point set.
The first feature point set comprises a plurality of first feature points, and the second feature point set comprises a plurality of second feature points.
Step 302, determining a second mapping matrix based on a plurality of pairs of characteristic points included in the first characteristic point set and the second characteristic point set.
Each pair of feature point pairs comprises a first feature point and a second feature point which have corresponding relations.
In this embodiment, first, feature extraction is performed on the two second images, where feature extraction algorithms include, but are not limited to, SIFT, ORB, SURF, BRISK, and the like, and optionally, the feature points include angular points and feature vectors; and after the first characteristic point set and the second characteristic point set comprise symmetrical characteristic point pairs, reversely pushing the relation between the symmetrical characteristic point pairs to obtain a second mapping matrix.
As shown in fig. 4, based on the embodiment shown in fig. 3, step 302 may include the following steps:
step 3021, determining pairs of feature point pairs based on the distance between the descriptor of each first feature point in the first feature point set and the descriptor of each second feature point in the second feature point set.
Step 3022, determining a second mapping matrix based on the mapping relationship between each pair of the plurality of pairs of feature points.
In this embodiment, the descriptor distance between each pair of feature point pairs is mainly determined by randomly selecting a plurality of point pairs near the feature points, combining the gray values of the point pairs into a binary string, and using the binary string as the feature descriptor of the feature point; during matching, only the distance between two feature point descriptors (for example, Hamming distance) needs to be calculated, and the basis for judging whether matching is performed is as follows, for example: through a large amount of experimental data tests, the Hamming distance of the descriptors not matched with the feature points is about 128 pixels, and the Hamming distance of the descriptors matched with the point pairs is far smaller than 128 pixels; and when the matching basis is met, determining the two characteristic points as a pair of symmetrical characteristic point pairs.
In other alternative embodiments, step 102 may further include:
an internal reference matrix of the current camera is determined based on the exchangeable image file format of the first image.
In this embodiment, a matching relationship cannot be established for every two images having an overlapping portion, which are acquired by a current camera, through a feature point, an equivalent focal length F (unit mm) of the camera may be obtained through an image Exchangeable image file format (Exif), where it is assumed that a focal length F in a camera internal reference matrix K is max (img.
As shown in fig. 5, on the basis of the embodiment shown in fig. 1, step 104 includes the following steps:
step 1041, determining a rotation matrix representing a rotation relationship between the two first images based on the rotation information and the translation information when the current camera takes the two first images.
Step 1042, determining a first mapping matrix corresponding to the two first images based on the rotation matrix and the internal reference matrix of the current camera.
In this embodiment, the rotation information (three degrees of freedom) of the current camera in three directions and the translation information (three degrees of freedom) of the current camera in three directions may be obtained through the six-degree-of-freedom (6Dof) information provided by the current camera, and the value of each element in the rotation matrix (3 × 3 matrix) may be determined based on the rotation information and the translation information, and at this time, the value is substituted into the internal reference matrix K obtained in step 102 in combination with the above formula (1)1And K2The first mapping can be determinedAnd (4) matrix.
Optionally, step 1041 may comprise:
acquiring rotation information and translation information when a current camera shoots two first images to obtain two groups of rotation information and two groups of translation information;
based on the two sets of rotation information and the two sets of translation information, a rotation matrix is determined that represents a rotational relationship between the two first images.
In this embodiment, since the current camera has different information of six degrees of freedom (6Dof) when capturing two first images, two sets of rotation information and two sets of translation information are obtained for the two first images, respectively, and the rotation matrix in this embodiment is to determine the rotation condition from one first image to the other first image, therefore, the rotation matrix can be determined based on the difference between the two sets of rotation information and the difference between the two sets of translation information.
Any of the image stitching methods provided by the embodiments of the present disclosure may be performed by any suitable device having data processing capabilities, including but not limited to: terminal equipment, a server and the like. Alternatively, any image stitching method provided by the embodiments of the present disclosure may be executed by a processor, for example, the processor may execute any image stitching method mentioned in the embodiments of the present disclosure by calling a corresponding instruction stored in a memory. And will not be described in detail below.
Fig. 6 is a flowchart illustrating a panorama stitching method according to an exemplary embodiment of the present disclosure. The embodiment can be applied to an electronic device, as shown in fig. 6, and includes the following steps:
and step 602, performing annular shooting at a point position by using a current camera to obtain an image sequence to be spliced.
Wherein each two adjacent images of the plurality of images included in the image sequence are partially overlapped.
And step 604, splicing every two adjacent images in the image sequence to obtain a spliced panoramic image.
Wherein, the stitching of every two adjacent images is realized based on the image stitching method provided by any one of the figures 1 to 5.
In this embodiment, the image stitching method provided in any one of fig. 1 to 5 is used to stitch an image sequence that is annularly shot by a current camera at one point location, so that the defect that images that cannot establish a connection relationship based on feature information in the prior art cannot be stitched is overcome, and no matter whether adjacent images in the image sequence acquired by the current camera can be connected based on the feature information or not, stitching can be achieved by the panorama stitching method provided in this embodiment.
Fig. 7 is a flowchart illustrating a panorama stitching method according to another exemplary embodiment of the present disclosure. As shown in fig. 7, the method comprises the following steps:
and step 602, performing annular shooting at a point position by using a current camera to obtain an image sequence to be spliced.
Wherein each two adjacent images of the plurality of images included in the image sequence are partially overlapped.
Step 703, determining a reference coordinate system corresponding to a plurality of images in the image sequence.
Step 704, converting the plurality of images in the image sequence to a reference coordinate system for representation, so as to obtain a plurality of reference images.
Step 705, splicing every two adjacent reference images in the multiple reference images to obtain a spliced panoramic image.
The reference coordinate system in this embodiment may be a coordinate system (which may be determined based on pose information of the camera at that time) where the current camera takes the first image, as the reference coordinate system; alternatively, the reference coordinate system is determined by a post-panorama synthesis adjustment, wherein the projection onto the panorama assumes that the current camera is level, since the tilt angle of the current camera is unknown. This assumption leads to distortion of the image (as shown in fig. 8), and the output panorama may be curved. The correction method is to estimate a Y vector orthogonal to the plane, assuming that the X axes of all the cameras are in the same plane. This solved Y-vector can establish a reference coordinate system (X-axis, Z-axis orientation is arbitrary), and representing all images under the reference coordinate system can repair the warping effect (as shown in fig. 9).
Optionally, step 705 may include:
splicing every two adjacent reference images in the multiple reference images to obtain an initial splicing image;
performing global optimization on the initial mosaic image, and adjusting a first mapping matrix spliced between every two adjacent reference images to obtain a plurality of adjusted third mapping matrices;
and splicing the plurality of reference images based on the plurality of third mapping matrixes to obtain a spliced panoramic image.
In this embodiment, since the image sequence obtained by annular shooting at one point location is spliced, if there are N images, the number of times of connection is not N-1, but the mapping matrix determined based on the present embodiment includes N, finally, the first image and the first image are spliced, and under an ideal condition, the two first images are completely overlapped, but because a certain error is generated when the two images are connected each time, after the connection is performed for N-1 times, the error accumulation may cause that the first image and the first image cannot be completely overlapped, in this embodiment, the plurality of first mapping matrices are adjusted through the connection relationship between the first image and the first image, so that the first image and the first image tend to be overlapped, and then the plurality of images are connected based on the plurality of adjusted third mapping matrices, so that a more accurate panoramic image may be obtained.
Any of the panorama stitching methods provided by the embodiments of the present disclosure may be performed by any suitable device having data processing capabilities, including but not limited to: terminal equipment, a server and the like. Alternatively, any of the panorama stitching methods provided by the embodiments of the present disclosure may be executed by a processor, for example, the processor may execute any of the panorama stitching methods mentioned in the embodiments of the present disclosure by calling a corresponding instruction stored in a memory. And will not be described in detail below.
Exemplary devices
Fig. 10 is a schematic structural diagram of an image stitching device according to an exemplary embodiment of the present disclosure. As shown in fig. 10, the apparatus of this embodiment includes:
and an internal reference determining module 11, configured to determine an internal reference matrix of the current camera.
The first mapping determining module 12 is configured to determine a first mapping matrix corresponding to the two first images based on pose information of the current camera when the two first images are captured and an internal reference matrix of the current camera.
Wherein, there is partial overlap between two first images, and two first images can not establish connection relation through characteristic information.
And the image stitching module 13 is configured to stitch the two first images based on the first mapping matrix.
The image stitching device provided by the above embodiment of the present disclosure determines an internal reference matrix of a current camera; determining a first mapping matrix corresponding to the two first images based on pose information when the current camera shoots the two first images and an internal reference matrix of the current camera; wherein, there is partial overlap between the two first images, and the two first images can not establish connection relationship through characteristic information; splicing the two first images based on the first mapping matrix; in the embodiment, the mapping matrix corresponding to the two images which cannot be connected through the characteristic information can be determined by determining the camera internal parameters, so that the images which cannot be spliced through the characteristic information are spliced, and the technical problem which cannot be solved in the prior art is solved.
In some optional embodiments, the internal reference determining module 11 is specifically configured to determine the internal reference matrix of the current camera based on two second images with partial overlap captured by the current camera.
Wherein, the two second images can establish a connection relationship through the characteristic information.
Optionally, the internal reference determining module 11 includes:
a second mapping unit for determining a second mapping matrix based on the two second images;
and the self-calibration unit is used for determining the internal parameter matrix of the current camera based on the second mapping matrix by utilizing a self-calibration algorithm.
Optionally, the second mapping unit is specifically configured to perform feature extraction on the two second images respectively to obtain a first feature point set and a second feature point set; the first feature point set comprises a plurality of first feature points, and the second feature point set comprises a plurality of second feature points; determining a second mapping matrix based on a plurality of pairs of characteristic points included in the first characteristic point set and the second characteristic point set; each pair of feature point pairs comprises a first feature point and a second feature point which have corresponding relations.
Optionally, the second mapping unit, when determining the second mapping matrix based on pairs of feature point pairs included in the first feature point set and the second feature point set, is configured to determine the pairs of feature point pairs based on a distance between a descriptor of each first feature point in the first feature point set and a descriptor of each second feature point in the second feature point set; and determining a second mapping matrix based on the mapping relation between each pair of the plurality of pairs of feature points.
In further alternative embodiments, the internal reference determining module 11 is specifically configured to determine the internal reference matrix of the current camera based on the exchangeable image file format of the first image.
In some optional embodiments, the first mapping determining module 12 includes:
a rotation matrix determination unit configured to determine a rotation matrix indicating a rotation relationship between the two first images based on rotation information and translation information when the two first images are captured by the current camera;
and the first mapping unit is used for determining a first mapping matrix corresponding to the two first images based on the rotation matrix and the internal reference matrix of the current camera.
Optionally, the rotation matrix determining unit is specifically configured to obtain rotation information and translation information of the current camera when the current camera takes two first images, so as to obtain two sets of rotation information and two sets of translation information; based on the two sets of rotation information and the two sets of translation information, a rotation matrix is determined that represents a rotational relationship between the two first images.
Fig. 11 is a schematic structural diagram of a panorama stitching apparatus according to an exemplary embodiment of the present disclosure. As shown in fig. 11, the apparatus of this embodiment includes:
and the image acquisition module 111 is configured to annularly shoot at one point location by using the current camera to obtain an image sequence to be stitched.
Wherein each two adjacent images of the plurality of images included in the image sequence are partially overlapped.
And a panorama stitching module 112, configured to stitch every two adjacent images in the image sequence to obtain a stitched panorama.
And splicing every two adjacent images is realized based on the image splicing method provided by any one of the embodiments.
Optionally, the apparatus according to this embodiment further includes:
the coordinate system determining module is used for determining a reference coordinate system corresponding to a plurality of images in the image sequence;
the panorama stitching module 112 is specifically configured to convert a plurality of images in the image sequence into a reference coordinate system for representation, so as to obtain a plurality of reference images; and splicing every two adjacent reference images in the plurality of reference images to obtain a spliced panoramic image.
Optionally, the panorama stitching module 112 is configured to, when stitching every two adjacent reference images in the multiple reference images to obtain a stitched panorama, stitch every two adjacent reference images in the multiple reference images to obtain an initial stitched image; performing global optimization on the initial mosaic image, and adjusting a first mapping matrix spliced between every two adjacent reference images to obtain a plurality of adjusted third mapping matrices; and splicing the plurality of reference images based on the plurality of third mapping matrixes to obtain a spliced panoramic image.
Exemplary electronic device
Next, an electronic apparatus according to an embodiment of the present disclosure is described with reference to fig. 12. The electronic device may be either or both of the first device 100 and the second device 200, or a stand-alone device separate from them that may communicate with the first device and the second device to receive the collected input signals therefrom.
FIG. 12 illustrates a block diagram of an electronic device in accordance with an embodiment of the disclosure.
As shown in fig. 12, the electronic device 120 includes one or more processors 121 and a memory 122.
The processor 121 may be a Central Processing Unit (CPU) or other form of processing unit having data processing capabilities and/or instruction execution capabilities, and may control other components in the electronic device 120 to perform desired functions.
Memory 122 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, Random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, Read Only Memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium and executed by the processor 121 to implement the image stitching method or panorama stitching method of the various embodiments of the present disclosure described above and/or other desired functions. Various contents such as an input signal, a signal component, a noise component, etc. may also be stored in the computer-readable storage medium.
In one example, the electronic device 120 may further include: an input device 123 and an output device 124, which are interconnected by a bus system and/or other form of connection mechanism (not shown).
For example, when the electronic device is the first device 100 or the second device 200, the input device 123 may be the microphone or the microphone array described above for capturing the input signal of the sound source. When the electronic device is a stand-alone device, the input means 123 may be a communication network connector for receiving the acquired input signals from the first device 100 and the second device 200.
The input device 123 may also include, for example, a keyboard, a mouse, and the like.
The output device 124 may output various information including the determined distance information, direction information, and the like to the outside. The output devices 124 may include, for example, a display, speakers, a printer, and a communication network and remote output devices connected thereto, among others.
Of course, for simplicity, only some of the components of the electronic device 120 relevant to the present disclosure are shown in fig. 12, omitting components such as buses, input/output interfaces, and the like. In addition, the electronic device 120 may include any other suitable components, depending on the particular application.
Exemplary computer program product and computer-readable storage Medium
In addition to the methods and apparatus described above, embodiments of the present disclosure may also be a computer program product comprising computer program instructions that, when executed by a processor, cause the processor to perform the steps in an image stitching method or a panorama stitching method according to various embodiments of the present disclosure described in the "exemplary methods" section above of this specification.
The computer program product may write program code for carrying out operations for embodiments of the present disclosure in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, embodiments of the present disclosure may also be a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, cause the processor to perform the steps in the image stitching method or the panorama stitching method according to various embodiments of the present disclosure described in the "exemplary methods" section above in this specification.
The computer-readable storage medium may take any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing describes the general principles of the present disclosure in conjunction with specific embodiments, however, it is noted that the advantages, effects, etc. mentioned in the present disclosure are merely examples and are not limiting, and they should not be considered essential to the various embodiments of the present disclosure. Furthermore, the foregoing disclosure of specific details is for the purpose of illustration and description and is not intended to be limiting, since the disclosure is not intended to be limited to the specific details so described.
In the present specification, the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts in the embodiments are referred to each other. For the system embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The block diagrams of devices, apparatuses, systems referred to in this disclosure are only given as illustrative examples and are not intended to require or imply that the connections, arrangements, configurations, etc. must be made in the manner shown in the block diagrams. These devices, apparatuses, devices, systems may be connected, arranged, configured in any manner, as will be appreciated by those skilled in the art. Words such as "including," "comprising," "having," and the like are open-ended words that mean "including, but not limited to," and are used interchangeably therewith. The words "or" and "as used herein mean, and are used interchangeably with, the word" and/or, "unless the context clearly dictates otherwise. The word "such as" is used herein to mean, and is used interchangeably with, the phrase "such as but not limited to".
The methods and apparatus of the present disclosure may be implemented in a number of ways. For example, the methods and apparatus of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above-described order for the steps of the method is for illustration only, and the steps of the method of the present disclosure are not limited to the order specifically described above unless specifically stated otherwise. Further, in some embodiments, the present disclosure may also be embodied as programs recorded in a recording medium, the programs including machine-readable instructions for implementing the methods according to the present disclosure. Thus, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.
It is also noted that in the devices, apparatuses, and methods of the present disclosure, each component or step can be decomposed and/or recombined. These decompositions and/or recombinations are to be considered equivalents of the present disclosure.
The previous description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects without departing from the scope of the disclosure. Thus, the present disclosure is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing description has been presented for purposes of illustration and description. Furthermore, this description is not intended to limit embodiments of the disclosure to the form disclosed herein. While a number of example aspects and embodiments have been discussed above, those of skill in the art will recognize certain variations, modifications, alterations, additions and sub-combinations thereof.