Image stitching method, device and panoramic camera
By rotating and unfolding the spherical image of the fisheye image in the panoramic camera, and using the ERP method for splicing, the problem of low image splicing accuracy in the existing technology is solved, and higher splicing accuracy and efficiency are achieved.
Patent Information
- Application Number
- CN202410871869.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-07-01
AI Technical Summary
Existing panoramic cameras have low image stitching accuracy and cannot effectively utilize more image pixels for stitching.
By setting the first fisheye lens and the second fisheye lens in the panoramic camera, the fisheye image is obtained and mapped to the unit sphere, rotated at a specified angle and then expanded into an Equirectangular Rear Projection (ERP) image, based on the same feature points Perform splicing to achieve higher splicing accuracy.
It improves the accuracy and efficiency of image splicing, obtains more image pixels for splicing, reduces invalid areas caused by blind spots in the field of view, and improves the splicing effect.
Smart Images

Figure CN118400594B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing technology, and in particular to an image stitching method, device and panoramic camera. Background Art
[0002] In recent years, with the continuous development of science and technology, various devices have sprung up in people's lives, such as panoramic cameras. Panoramic cameras generally use at least two lenses to shoot at the same time, and then stitch the resulting images together. However, the current image stitching accuracy is not high. Summary of the invention
[0003] The embodiments of the present application provide an image stitching method, device and panoramic camera, which can solve the problem of low image stitching accuracy.
[0004] In a first aspect, an embodiment of the present application provides an image stitching method, which is applied to a panoramic camera, wherein a first fisheye lens and a second fisheye lens are provided in the panoramic camera, and the image stitching method comprises: acquiring a first fisheye image based on the first fisheye lens, and acquiring a second fisheye image based on the second fisheye lens; mapping the first fisheye image onto a unit sphere to obtain a first spherical image, wherein the first spherical image is a spherical image corresponding to the first fisheye image, and mapping the second fisheye image onto the unit sphere to obtain a second spherical image, wherein the second spherical image is a spherical image corresponding to the second fisheye image; The first spherical image is rotated by a specified angle to obtain a rotated first spherical image, and the second spherical image is rotated by the specified angle to obtain a rotated second spherical image; the rotated first spherical image is expanded into a first ERP image, and the rotated second spherical image is expanded into a second ERP image, wherein the first ERP image is an image obtained by expanding the rotated first spherical image using the ERP method, and the second ERP image is an image obtained by expanding the rotated second spherical image using the ERP method; the first ERP image and the second ERP image are spliced to obtain a target image.
[0005] In a possible implementation manner of the first aspect, the first fisheye lens and the second fisheye lens are symmetrically arranged based on a first plane, the first fisheye lens and the second fisheye lens are respectively located on both sides of the first plane, and before rotating the first spherical image by a specified angle to obtain a rotated first spherical image, and rotating the second spherical image by the specified angle to obtain a rotated second spherical image, the method includes: establishing a spherical coordinate system, the spherical coordinate system is a three-dimensional rectangular coordinate system, the origin of the spherical coordinate system is the intersection of an optical center line and the first plane, the optical center line is a line between the optical center of the first fisheye lens and the optical center of the second fisheye lens, and a first axis of the spherical coordinate system is perpendicular to the first plane. In the first plane, the second axis of the spherical coordinate system is on the first plane and perpendicular to the first axis, the direction of the second axis is vertically upward, the third axis of the spherical coordinate system is perpendicular to the second plane, and the second plane is the plane where the first axis and the second axis are located; correspondingly, rotating the first spherical image by a specified angle to obtain a rotated first spherical image, and rotating the second spherical image by the specified angle to obtain a rotated second spherical image, include: rotating the first spherical image 90 degrees around the third axis along the specified direction to obtain a rotated first spherical image, and rotating the second spherical image 90 degrees around the third axis along the specified direction to obtain a rotated second spherical image.
[0006] In a possible implementation of the first aspect, rotating the first spherical image 90 degrees around the third axis along a specified direction to obtain a rotated first spherical image, and rotating the second spherical image 90 degrees around the third axis along a specified direction to obtain a rotated second spherical image, includes: rotating the first spherical image 90 degrees counterclockwise around the third axis to obtain a rotated first spherical image, and rotating the second spherical image 90 degrees counterclockwise around the third axis to obtain a rotated second spherical image.
[0007] In a possible implementation of the first aspect, the step of splicing the first ERP image and the second ERP image to obtain a target image includes: determining a target area in the first ERP image and a target area in the second ERP image, the target area in the first ERP image being an area in the first ERP image that has a plurality of identical feature points with the second ERP image, and the target area in the second ERP image being an area in the second ERP image that has a plurality of identical feature points with the first ERP image; determining a relative displacement between identical feature points based on the target area in the first ERP image and the target area in the second ERP image; and splicing the first ERP image and the second ERP image based on the relative displacement to obtain the target image.
[0008] In a possible implementation of the first aspect, the splicing of the first ERP image and the second ERP image based on the relative displacement to obtain a target image includes: orthogonally decomposing the relative displacement in a two-dimensional longitude and latitude coordinate system to obtain a component of the relative displacement in a meridian extension direction; based on the component of the relative displacement in the meridian extension direction, registering a target area in the first ERP image and a target area in the second ERP image to obtain a registration result; and splicing the first ERP image and the second ERP image according to the registration result to obtain a target image.
[0009] In a possible implementation of the first aspect, the target image is a two-dimensional plane image, and after the first ERP image and the second ERP image are spliced to obtain the target image, the method includes: converting the target image into a third spherical image; rotating the third spherical image 90 degrees around the third axis in the reverse direction to obtain a rotated third spherical image, wherein the reverse direction is a direction opposite to the specified direction; and expanding the rotated third spherical image into a third ERP image, wherein the third ERP image is an image obtained by expanding the rotated third spherical image using the ERP method.
[0010] In a second aspect, an embodiment of the present application provides an image stitching device, which is applied to a panoramic camera, wherein a first fisheye lens and a second fisheye lens are provided in the panoramic camera, and the image stitching device comprises: a first acquisition unit, which is used to acquire a first fisheye image based on the first fisheye lens, and to acquire a second fisheye image based on the second fisheye lens; a second acquisition unit, which is used to map the first fisheye image onto a unit sphere to obtain a first spherical image, wherein the first spherical image is a spherical image corresponding to the first fisheye image, and to map the second fisheye image onto the unit sphere to obtain a second spherical image, wherein the second spherical image is a spherical image corresponding to the second fisheye image; and a third acquisition unit. A unit for rotating the first spherical image by a specified angle to obtain a rotated first spherical image, and for rotating the second spherical image by the specified angle to obtain a rotated second spherical image; an expansion unit for expanding the rotated first spherical image into a first ERP image, and expanding the rotated second spherical image into a second ERP image, wherein the first ERP image is an image obtained by expanding the rotated first spherical image using an ERP method, and the second ERP image is an image obtained by expanding the rotated second spherical image using the ERP method; a splicing unit for splicing the first ERP image and the second ERP image to obtain a target image.
[0011] In a possible implementation of the second aspect, the first fisheye lens and the second fisheye lens are symmetrically arranged based on a first plane, and the first fisheye lens and the second fisheye lens are respectively located on both sides of the first plane, and the image stitching device includes a coordinate system establishment unit, and the coordinate system establishment unit is used to: before the third acquisition unit executes the rotating the first spherical image by a specified angle to obtain the rotated first spherical image, and the rotating the second spherical image by the specified angle to obtain the rotated second spherical image, establish a spherical coordinate system, the spherical coordinate system is a three-dimensional rectangular coordinate system, the origin of the spherical coordinate system is the intersection of the optical center line and the first plane, the optical center line is the line between the optical center of the first fisheye lens and the optical center of the second fisheye lens, The first axis of the spherical coordinate system is perpendicular to the first plane, the second axis of the spherical coordinate system is on the first plane and perpendicular to the first axis, the direction of the second axis is vertically upward, and the third axis of the spherical coordinate system is perpendicular to the second plane, and the second plane is the plane where the first axis and the second axis are located; correspondingly, when the third acquisition unit executes the rotating the first spherical image by a specified angle to obtain the rotated first spherical image, and the rotating the second spherical image by the specified angle to obtain the rotated second spherical image, it is used to: rotate the first spherical image along the specified direction around the third axis by 90 degrees to obtain the rotated first spherical image, and rotate the second spherical image along the specified direction around the third axis by 90 degrees to obtain the rotated second spherical image.
[0012] In a third aspect, an embodiment of the present application provides a panoramic camera, including a first fisheye lens, a second fisheye lens, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the methods described above when executing the computer program.
[0013] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements any of the methods described above.
[0014] It can be understood that the beneficial effects of the second aspect mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.
[0015] Compared with the prior art, the embodiment of the present application has the following beneficial effects: the image stitching method in the embodiment of the present application is applied to a panoramic camera, because the first spherical image can be rotated by a specified angle to obtain a rotated first spherical image, and the second spherical image can be rotated by the specified angle to obtain a rotated second spherical image; the rotated first spherical image is expanded into a first ERP image, the rotated second spherical image is expanded into a second ERP image, and then the first ERP image and the second ERP image are stitched to obtain a target image, so that higher stitching accuracy can be achieved. The specific reasons are as follows: compared with the prior art (the prior art is: the spherical image is not rotated, and the spherical image is directly expanded using the ERP method to complete the stitching), the embodiment of the present application can obtain a larger number of image pixels for completing the stitching, thereby achieving higher stitching accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 is a flowchart of an image stitching method provided by an embodiment of the present application;
[0018] Figure 2 is a schematic diagram of a panoramic camera provided by an embodiment of the present application;
[0019] Figure 3 It is a schematic diagram of an image obtained based on the prior art;
[0020] Figure 4 is a schematic diagram of an image provided by an embodiment of the present application, including a schematic diagram of a first ERP image and a second ERP image;
[0021] Figure 5 is a schematic diagram of an image stitching device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0022] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0023] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0024] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0025] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0026] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0027] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0028] Embodiment 1
[0029] Figure 1 The flowchart of an image stitching method provided by an embodiment of the present application is shown, and the image stitching method can be applied to a panoramic camera. The image stitching method is applied to a panoramic camera, and the panoramic camera is provided with a first fisheye lens and a second fisheye lens. For example, the panoramic camera 20 can be as follows Figure 2As shown, the first fisheye lens 201 and the second fisheye lens 202 are symmetrically arranged on both sides of the panoramic camera. The image stitching method comprises: step S101, step S102, step S103, step S104 and step S105. The details are as follows:
[0030] Step S101: acquiring a first fisheye image based on the first fisheye lens, and acquiring a second fisheye image based on the second fisheye lens.
[0031] The first fisheye image and the second fisheye image are images captured at the same time, both the first fisheye image and the second fisheye image are two-dimensional images, the field of view angle corresponding to the first fisheye image and the field of view angle corresponding to the second fisheye image are both greater than 180 degrees, some areas in the first fisheye image are the same as some areas in the second fisheye image, that is, some areas in the first fisheye image and some areas in the second fisheye image have the same feature points, some areas in the first fisheye image are located at the edge of the first fisheye image, and some areas in the second fisheye image are located at the edge of the second fisheye image, and some areas in the first fisheye image and some areas in the second fisheye image have extremely serious pixel distortion.
[0032] Step S102: Map the first fisheye image onto a unit sphere to obtain a first spherical image, wherein the first spherical image is a spherical image corresponding to the first fisheye image; and map the second fisheye image onto the unit sphere to obtain a second spherical image, wherein the second spherical image is a spherical image corresponding to the second fisheye image.
[0033] The unit sphere is the spherical surface of a unit sphere.
[0034] As an example but not limitation, step S102 includes: using the intrinsic parameters and extrinsic parameters obtained by calibrating the first fisheye lens, mapping the coordinates of each pixel in the first fisheye image in the image coordinate system (two-dimensional coordinate system) to a unit sphere to obtain the spherical coordinates corresponding to the first fisheye image, that is, a first spherical image can be obtained, and the spherical coordinates are the coordinates in the spherical coordinate system; using the intrinsic parameters and extrinsic parameters obtained by calibrating the second fisheye lens, mapping the coordinates of each pixel in the second fisheye image in the image coordinate system to a unit sphere to obtain the spherical coordinates corresponding to the second fisheye image, that is, a second spherical image can be obtained.
[0035] Step S103: rotating the first spherical image by a specified angle to obtain a rotated first spherical image, and rotating the second spherical image by the specified angle to obtain a rotated second spherical image.
[0036] Optionally, the first fisheye lens and the second fisheye lens are symmetrically arranged based on a first plane, and the first fisheye lens and the second fisheye lens are respectively located on both sides of the first plane. Before step S103, it includes: establishing a spherical coordinate system, the spherical coordinate system is a three-dimensional rectangular coordinate system, the origin of the spherical coordinate system is the intersection of the optical center line and the first plane, the optical center line is the line between the optical center of the first fisheye lens and the optical center of the second fisheye lens, the first axis of the spherical coordinate system is perpendicular to the first plane, the second axis of the spherical coordinate system is on the first plane and perpendicular to the first axis, the direction of the second axis is vertically upward, the third axis of the spherical coordinate system is perpendicular to the second plane, and the second plane is the plane where the first axis and the second axis are located; correspondingly, step S103 includes: rotating the first spherical image 90 degrees around the third axis along the specified direction to obtain the rotated first spherical image, and rotating the second spherical image 90 degrees around the third axis along the specified direction to obtain the rotated second spherical image.
[0037] Specifically, the first plane is a symmetry plane of the panoramic camera, and neither the first fisheye lens nor the second fisheye lens passes through the first plane.
[0038] As an example but not limitation, rotating the first spherical image by 90 degrees around the third axis along a specified direction to obtain a rotated first spherical image, and rotating the second spherical image by 90 degrees around the third axis along a specified direction to obtain a rotated second spherical image, comprises: rotating the first spherical image by 90 degrees around the third axis along a specified direction to obtain a rotated first spherical image based on a specified relationship and a rotation matrix, wherein the specified relationship is ,in, Used to represent a rotated spherical image. Used to represent unrotated spherical images. Used to represent the rotation matrix, ; Based on the specified relationship and the rotation matrix, the second spherical image is rotated 90 degrees around the third axis along the specified direction to obtain a rotated second spherical image. Wherein, can be 90 degrees or -90 degrees; the same point between the value of 90 degrees and the value of -90 degrees is that both represent a rotation of 90 degrees; the difference between the value of 90 degrees and the value of -90 degrees is that they represent different rotation directions.
[0039] In this embodiment, the first spherical image is rotated 90 degrees around the third axis in a specified direction to obtain a rotated first spherical image, and the second spherical image is rotated 90 degrees around the third axis in a specified direction to obtain a rotated second spherical image. The rotated first spherical image and the rotated second spherical image are subsequently unfolded using an equirectangular projection method. Since the edges of the unfolded images are relatively smooth, the number of pixels abandoned for stitching can be effectively reduced in the subsequent stitching process, that is, the present embodiment obtains a larger number of image pixels for completing stitching, thereby achieving higher stitching accuracy.
[0040] In some embodiments, rotating the first spherical image 90 degrees around the third axis along a specified direction to obtain a rotated first spherical image, and rotating the second spherical image 90 degrees around the third axis along a specified direction to obtain a rotated second spherical image, includes: rotating the first spherical image 90 degrees in a clockwise direction around the third axis to obtain a rotated first spherical image, and rotating the second spherical image 90 degrees in a clockwise direction around the third axis to obtain a rotated second spherical image.
[0041] In some embodiments, rotating the first spherical image 90 degrees around the third axis along a specified direction to obtain a rotated first spherical image, and rotating the second spherical image 90 degrees around the third axis along a specified direction to obtain a rotated second spherical image, includes: rotating the first spherical image 90 degrees counterclockwise around the third axis to obtain a rotated first spherical image, and rotating the second spherical image 90 degrees counterclockwise around the third axis to obtain a rotated second spherical image.
[0042] Step S104, unfolding the rotated first spherical image into a first equirectangular projection (ERP) image, and unfolding the rotated second spherical image into a second ERP image, wherein the first ERP image is an image obtained by unfolding the rotated first spherical image using the ERP method, and the second ERP image is an image obtained by unfolding the rotated second spherical image using the ERP method.
[0043] As an example but not limitation, the first ERP image and the second ERP image can be displayed in a two-dimensional longitude and latitude coordinate system, the upper left corner vertex of the first ERP image / the upper left corner vertex of the second ERP image is the origin of the two-dimensional longitude and latitude coordinate system, the two-dimensional longitude and latitude coordinate system can be expressed as a uv coordinate system, the horizontal coordinate u can be linearly mapped to longitude, and the longitude value range is [-180°, 180°]; the vertical coordinate v can be linearly mapped to represent latitude, and the latitude value range is [-90°, 90°].
[0044] In the prior art, if the spherical image is not rotated and the spherical image is directly expanded using the ERP method, the expanded result can be as follows: Figure 3 As shown, the image 301 and the image 302 are expanded, wherein the area surrounded by the dotted line is used to represent the invalid area caused by the blind spot of the visual field. Theoretically, the pixels that can be used for splicing are distributed on the left and right sides of the image 301 and the left and right sides of the image 302, but in fact, the prior art uses one side of the image 301 and one side of the image 302 for splicing, while the other side of the image 301 and the other side of the image 302 are not used for splicing, that is, the number of pixels actually used for splicing is small, and the splicing efficiency and splicing accuracy are relatively low.
[0045] In the present application, since the first spherical image can be rotated 90 degrees around the third axis along a specified direction to obtain a rotated first spherical image, and the second spherical image can be rotated 90 degrees around the third axis along a specified direction to obtain a rotated second spherical image, thereby obtaining a first ERP image and a second ERP image, the first ERP image 401 and the second ERP image 402 can be as follows: Figure 4 As shown, the area in the first ERP image 401 that can be used for stitching is the black area of the first ERP image 401, which is located at the lower end of the first ERP image 401; the area in the second ERP image 402 that can be used for stitching is the black area in the second ERP image 402, which is located at the upper end of the second ERP image 402. Since the pixels in the first ERP image 401 that can be used for stitching are all concentrated on one side of the first ERP image 401, the pixels in the second ERP image 402 that can be used for stitching are also concentrated on one side of the second ERP image 402. In this way, the number of pixels used for image stitching can be greatly increased, thereby improving the stitching accuracy and stitching efficiency.
[0046] Step S105: splicing the first ERP image and the second ERP image to obtain a target image.
[0047] Specifically, the first ERP image and the second ERP image are both rectangular areas having a length and a width, and are spliced based on the length of the first ERP image and the length of the second ERP image to obtain a target image.
[0048] Optionally, due to the limitation of the manufacturing process of the two fisheye lenses, parallax may exist between the two fisheye lenses. In order to reduce the negative impact of the parallax on image stitching, the step S105 includes: step a1, step a2 and step a3, wherein:
[0049] Step a1, determining a target area in the first ERP image and a target area in the second ERP image, wherein the target area in the first ERP image is an area in the first ERP image that has a plurality of identical feature points with the second ERP image, and the target area in the second ERP image is an area in the second ERP image that has a plurality of identical feature points with the first ERP image;
[0050] Step a2, determining the relative displacement between the same feature points based on the target area in the first ERP image and the target area in the second ERP image;
[0051] Step a3: splicing the first ERP image and the second ERP image based on the relative displacement to obtain a target image.
[0052] Among them, in the two-dimensional longitude and latitude coordinate system, the longitude range spanned by the target area in the first ERP image in the latitude extension direction is equal to the longitude range spanned by the first ERP image in the latitude extension direction; the longitude range spanned by the target area in the second ERP image in the latitude extension direction is equal to the longitude range spanned by the second ERP image in the latitude extension direction.
[0053] Taking step a2 as an example, for example, the target area in the first ERP image has feature points b1 and b2, and the target area in the second ERP image has feature points c1 and c2, wherein feature points b1 and c1 are the same feature points, and feature points b2 and c2 are the same feature points, and the relative displacement between feature points b1 and c1 is determined, and the relative displacement between feature points b2 and c2 is determined. Correspondingly, step a3 includes: splicing the first ERP image and the second ERP image based on the relative displacement between feature points b1 and c1 and the relative displacement between feature points b2 and c2 to obtain a target image.
[0054] In some embodiments, the step a3 includes: performing orthogonal decomposition of the relative displacement in a two-dimensional longitude and latitude coordinate system to obtain the component of the relative displacement in the direction of meridian extension; based on the component of the relative displacement in the direction of meridian extension, aligning the target area in the first ERP image and the target area in the second ERP image to obtain an alignment result; and splicing the first ERP image and the second ERP image according to the alignment result to obtain a target image.
[0055] For example, the two-dimensional longitude and latitude coordinate system is represented as the uv coordinate system, and the extension direction of the meridian is the direction of the v-axis. Correspondingly, the relative displacement is orthogonally decomposed in the two-dimensional longitude and latitude coordinate system to obtain the component of the relative displacement in the direction of the v-axis; based on the component of the relative displacement in the direction of the v-axis, the target area in the first ERP image and the target area in the second ERP image are aligned to obtain the alignment result; according to the alignment result, the first ERP image and the second ERP image are spliced to obtain the target image.
[0056] Optionally, the target image is a two-dimensional plane image, and after step S105, the following steps include: converting the target image into a third spherical image; rotating the third spherical image 90 degrees around the third axis in the reverse direction to obtain a rotated third spherical image, wherein the reverse direction is a direction opposite to the specified direction; and expanding the rotated third spherical image into a third ERP image, wherein the third ERP image is an image obtained by expanding the rotated third spherical image using the ERP method.
[0057] The third spherical image is a spherical image corresponding to the target image.
[0058] For example, if the specified direction is a clockwise direction, the opposite direction is a counterclockwise direction; if the specified direction is a counterclockwise direction, the opposite direction is a clockwise direction.
[0059] In some embodiments, after the third spherical image after rotation is expanded into a third ERP image, the method further includes: performing target detection based on the third ERP image to obtain a target detection result. In this way, a more accurate target detection result can be obtained.
[0060] The image stitching method in the embodiment of the present application is applied to a panoramic camera. Since the first spherical image can be rotated by a specified angle to obtain a rotated first spherical image, and the second spherical image can be rotated by the specified angle to obtain a rotated second spherical image; the rotated first spherical image is expanded into a first ERP image, and the rotated second spherical image is expanded into a second ERP image, and then the first ERP image and the second ERP image are stitched to obtain a target image, a higher stitching accuracy can be achieved. The specific reasons are as follows: Compared with the prior art (the prior art is: the spherical image is not rotated, and the spherical image is directly expanded using the ERP method to complete the stitching), the embodiment of the present application can obtain a larger number of image pixels for completing the stitching, thereby achieving a higher stitching accuracy.
[0061] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0062] Embodiment 2
[0063] Corresponding to the image stitching method described in the above embodiment, Figure 5 A schematic diagram of an image stitching device provided in an embodiment of the present application is shown. For ease of explanation, only the portion related to the embodiment of the present application is shown.
[0064] The image stitching device is applied to a panoramic camera, wherein the panoramic camera is provided with a first fisheye lens and a second fisheye lens, and the image stitching device comprises: a first acquisition unit 501, a second acquisition unit 502, a third acquisition unit 503, an expansion unit 504 and a stitching unit 505, wherein:
[0065] A first acquiring unit 501 is configured to acquire a first fisheye image based on the first fisheye lens, and acquire a second fisheye image based on the second fisheye lens;
[0066] A second acquisition unit 502 is configured to map the first fisheye image onto a unit sphere to obtain a first spherical image, wherein the first spherical image is a spherical image corresponding to the first fisheye image, and map the second fisheye image onto the unit sphere to obtain a second spherical image, wherein the second spherical image is a spherical image corresponding to the second fisheye image;
[0067] A third acquisition unit 503 is configured to rotate the first spherical image by a specified angle to obtain a rotated first spherical image, and to rotate the second spherical image by the specified angle to obtain a rotated second spherical image;
[0068] An expansion unit 504 is used to expand the rotated first spherical image into a first ERP image, and expand the rotated second spherical image into a second ERP image, wherein the first ERP image is an image obtained by expanding the rotated first spherical image using an ERP method, and the second ERP image is an image obtained by expanding the rotated second spherical image using the ERP method;
[0069] The splicing unit 505 is configured to splice the first ERP image and the second ERP image to obtain a target image.
[0070] Optionally, the first fisheye lens and the second fisheye lens are symmetrically arranged based on a first plane, the first fisheye lens and the second fisheye lens are respectively located on two sides of the first plane, and the image stitching device includes a coordinate system establishing unit.
[0071] The coordinate system establishing unit is used to establish a spherical coordinate system before the third acquisition unit executes the steps of rotating the first spherical image by a specified angle to obtain a rotated first spherical image, and rotating the second spherical image by the specified angle to obtain a rotated second spherical image, wherein the spherical coordinate system is a three-dimensional rectangular coordinate system, the origin of the spherical coordinate system is the intersection of an optical center line and the first plane, the optical center line is a line between the optical center of the first fisheye lens and the optical center of the second fisheye lens, a first axis of the spherical coordinate system is perpendicular to the first plane, and a second axis of the spherical coordinate system is on the first plane and perpendicular to the first axis. straight, the direction of the second axis is vertically upward, the third axis of the spherical coordinate system is perpendicular to the second plane, and the second plane is the plane where the first axis and the second axis are located; correspondingly, when the third acquisition unit executes the steps of rotating the first spherical image by a specified angle to obtain a rotated first spherical image, and rotating the second spherical image by the specified angle to obtain a rotated second spherical image, it is used to: rotate the first spherical image 90 degrees around the third axis along the specified direction to obtain a rotated first spherical image, and rotate the second spherical image 90 degrees around the third axis along the specified direction to obtain a rotated second spherical image.
[0072] Optionally, the target image is a two-dimensional plane image, and the image stitching device further includes an image processing unit.
[0073] The image processing unit is used for: after the stitching unit 505 executes the stitching of the first ERP image and the second ERP image to obtain the target image, converting the target image into a third spherical image; rotating the third spherical image 90 degrees around the third axis in the reverse direction to obtain a rotated third spherical image, wherein the reverse direction is a direction opposite to the specified direction; and expanding the rotated third spherical image into a third ERP image, wherein the third ERP image is an image obtained by expanding the rotated third spherical image using the ERP method.
[0074] In some embodiments, the image stitching device further includes a target detection unit.
[0075] The target detection unit is used to: after the image processing unit expands the rotated third spherical image into a third ERP image, perform target detection based on the third ERP image to obtain a target detection result. In this way, a more accurate target detection result can be obtained.
[0076] It should be noted that for technical details not described in detail in this embodiment, reference may be made to the image stitching methods provided in the various embodiments in the above-mentioned embodiment 1.
[0077] Embodiment 3
[0078] The panoramic camera in this embodiment includes: a first fisheye lens, a second fisheye lens, at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor. When the processor executes the computer program, the steps in any of the above-mentioned image stitching method embodiments are implemented.
[0079] When the processor executes the computer program, the steps in the above-mentioned various image stitching method embodiments are implemented, for example: Figure 1 Alternatively, when the processor executes the computer program, the functions of each unit in the above-mentioned device embodiments are implemented, for example, Figure 5 The functions of units 501 to 505 are shown.
[0080] Those skilled in the art will understand that this embodiment is merely an example of a panoramic camera and does not constitute a limitation on the panoramic camera. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.
[0081] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0082] In some embodiments, the memory may be an internal storage unit of the panoramic camera, such as a hard disk or memory of the panoramic camera. In other embodiments, the memory may also be an external storage device of the panoramic camera, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the panoramic camera. Furthermore, the memory may also include both the internal storage unit of the panoramic camera and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory may also be used to temporarily store data that has been output or is to be output.
[0083] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0084] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0085] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0086] An embodiment of the present application provides a computer program product. When the computer program product runs on a panoramic camera, the panoramic camera can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0087] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the panoramic camera, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0088] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0089] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0090] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0091] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0092] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. An image stitching method, characterized in that: The image stitching method is applied to a panoramic camera, wherein a first fisheye lens and a second fisheye lens are provided in the panoramic camera, wherein the first fisheye lens and the second fisheye lens are symmetrically arranged based on a first plane, and the first fisheye lens and the second fisheye lens are respectively located on two sides of the first plane, and the image stitching method comprises: Acquire a first fisheye image based on the first fisheye lens, and acquire a second fisheye image based on the second fisheye lens; Mapping the first fisheye image onto a unit sphere to obtain a first spherical image, the first spherical image being a spherical image corresponding to the first fisheye image, and mapping the second fisheye image onto the unit sphere to obtain a second spherical image, the second spherical image being a spherical image corresponding to the second fisheye image; Rotating the first spherical image by a specified angle to obtain a rotated first spherical image, and rotating the second spherical image by the specified angle to obtain a rotated second spherical image; Expanding the rotated first spherical image into a first ERP image, and expanding the rotated second spherical image into a second ERP image, wherein the first ERP image is an image obtained by expanding the rotated first spherical image using an ERP method, and the second ERP image is an image obtained by expanding the rotated second spherical image using the ERP method; splicing the first ERP image and the second ERP image to obtain a target image; Before rotating the first spherical image by a specified angle to obtain a rotated first spherical image, and rotating the second spherical image by the specified angle to obtain a rotated second spherical image, the method includes: establishing a spherical coordinate system, wherein the spherical coordinate system is a three-dimensional rectangular coordinate system, wherein the origin of the spherical coordinate system is the intersection of an optical center line and the first plane, wherein the optical center line is a line connecting the optical center of the first fisheye lens and the optical center of the second fisheye lens, wherein a first axis of the spherical coordinate system is perpendicular to the first plane, and a second axis of the spherical coordinate system is on the first plane and perpendicular to the first axis. The direction of the second axis is vertically upward, the third axis of the spherical coordinate system is perpendicular to the second plane, and the second plane is the plane where the first axis and the second axis are located; correspondingly, rotating the first spherical image by a specified angle to obtain a rotated first spherical image, and rotating the second spherical image by the specified angle to obtain a rotated second spherical image, include: rotating the first spherical image 90 degrees around the third axis along a specified direction to obtain a rotated first spherical image, and rotating the second spherical image 90 degrees around the third axis along a specified direction to obtain a rotated second spherical image.
2. The image stitching method according to claim 1, characterized in that: The step of rotating the first spherical image by 90 degrees around the third axis along a specified direction to obtain a rotated first spherical image, and the step of rotating the second spherical image by 90 degrees around the third axis along a specified direction to obtain a rotated second spherical image comprises: The first spherical image is rotated 90 degrees in a counterclockwise direction around the third axis to obtain a rotated first spherical image, and the second spherical image is rotated 90 degrees in a counterclockwise direction around the third axis to obtain a rotated second spherical image.
3. The image stitching method according to claim 1, characterized in that: The step of splicing the first ERP image and the second ERP image to obtain a target image includes: Determine a target region in the first ERP image and a target region in the second ERP image, wherein the target region in the first ERP image is a region in the first ERP image that has a plurality of identical feature points with the second ERP image, and the target region in the second ERP image is a region in the second ERP image that has a plurality of identical feature points with the first ERP image; determining a relative displacement between the same feature points based on the target area in the first ERP image and the target area in the second ERP image; The first ERP image and the second ERP image are spliced based on the relative displacement to obtain a target image.
4. The image stitching method according to claim 3, characterized in that: The step of splicing the first ERP image and the second ERP image based on the relative displacement to obtain a target image includes: Performing orthogonal decomposition on the relative displacement in a two-dimensional longitude and latitude coordinate system to obtain a component of the relative displacement in a meridian extension direction; Based on the component of the relative displacement in the meridian extension direction, registering the target area in the first ERP image and the target area in the second ERP image to obtain a registration result; The first ERP image and the second ERP image are spliced according to the registration result to obtain a target image.
5. The image stitching method according to claim 1, characterized in that: The target image is a two-dimensional plane image. After the first ERP image and the second ERP image are spliced to obtain the target image, the method includes: converting the target image into a third spherical image; Rotating the third spherical image by 90 degrees around the third axis in a reverse direction to obtain a rotated third spherical image, wherein the reverse direction is a direction opposite to the specified direction; The rotated third spherical image is expanded into a third ERP image, wherein the third ERP image is an image obtained by expanding the rotated third spherical image using the ERP method.
6. An image stitching device, characterized in that: The image stitching device is applied to a panoramic camera, wherein a first fisheye lens and a second fisheye lens are provided in the panoramic camera, wherein the first fisheye lens and the second fisheye lens are symmetrically arranged based on a first plane, and the first fisheye lens and the second fisheye lens are respectively located on two sides of the first plane, and the image stitching device comprises: A first acquiring unit, configured to acquire a first fisheye image based on the first fisheye lens, and acquire a second fisheye image based on the second fisheye lens; a second acquisition unit, configured to map the first fisheye image onto a unit sphere to obtain a first spherical image, the first spherical image being a spherical image corresponding to the first fisheye image, and to map the second fisheye image onto the unit sphere to obtain a second spherical image, the second spherical image being a spherical image corresponding to the second fisheye image; a third acquisition unit, configured to rotate the first spherical image by a specified angle to obtain a rotated first spherical image, and to rotate the second spherical image by the specified angle to obtain a rotated second spherical image; an expansion unit, used for expanding the rotated first spherical image into a first ERP image, and expanding the rotated second spherical image into a second ERP image, wherein the first ERP image is an image obtained by expanding the rotated first spherical image using an ERP method, and the second ERP image is an image obtained by expanding the rotated second spherical image using the ERP method; a splicing unit, configured to splice the first ERP image and the second ERP image to obtain a target image; The image stitching device further includes a coordinate system establishing unit, which is used to: before the third acquisition unit executes the steps of rotating the first spherical image by a specified angle to obtain the rotated first spherical image, and rotating the second spherical image by the specified angle to obtain the rotated second spherical image, establish a spherical coordinate system, the spherical coordinate system is a three-dimensional rectangular coordinate system, the origin of the spherical coordinate system is the intersection of the optical center line and the first plane, the optical center line is the line between the optical center of the first fisheye lens and the optical center of the second fisheye lens, the first axis of the spherical coordinate system is perpendicular to the first plane, and the second axis of the spherical coordinate system is on the first plane. The third axis of the spherical coordinate system is on a plane and is perpendicular to the first axis, the direction of the second axis is vertically upward, the third axis of the spherical coordinate system is perpendicular to the second plane, and the second plane is a plane where the first axis and the second axis are located; correspondingly, when the third acquisition unit executes the steps of rotating the first spherical image by a specified angle to obtain a rotated first spherical image, and rotating the second spherical image by the specified angle to obtain a rotated second spherical image, it is used to: rotate the first spherical image along the specified direction around the third axis by 90 degrees to obtain a rotated first spherical image, and rotate the second spherical image along the specified direction around the third axis by 90 degrees to obtain a rotated second spherical image.
7. A panoramic camera, comprising a first fisheye lens, a second fisheye lens, a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
