Disclosure of Invention
In view of the above problems, embodiments of the present invention are proposed to provide a panoramic image edge processing method and a panoramic image edge processing apparatus that overcome or at least partially solve the above problems.
In order to solve the above problem, an embodiment of the present invention discloses a method for processing edges of a panoramic image, including:
monitoring whether the shot main target is positioned at the position of the horizontal edge of the image, wherein the horizontal edge is the overlapped part when the image is spliced;
when the main target is monitored to be located at the horizontal edge position of the image, determining the center coordinate of the horizontal edge in a preset coordinate system;
in the preset coordinate system, calculating the position relation between the horizontal edge center coordinate and a lens of the first camera through a preset algorithm to obtain the offset angle between the lens and the horizontal edge center coordinate;
and driving the lens center position of the camera to horizontally displace according to the offset angle, and aligning to the horizontal edge center coordinate position.
Further, the monitoring whether the shot main target is located in front of the horizontal edge position of the image further comprises:
acquiring a single image on each camera pair through the panoramic camera;
and calculating the overlapped part of the single images obtained by the adjacent cameras through a preset algorithm, and splicing and fusing the images.
Further, the monitoring whether the shot main target is located behind the horizontal edge position of the image further comprises:
and when the main target is not detected to be positioned at the horizontal edge position of the image, keeping the current position.
Further, when it is monitored that the main target is located at the horizontal edge position of the image, determining the horizontal edge center coordinate in a preset coordinate system includes:
establishing a coordinate system based on panoramic images according to images of four directions acquired by a panoramic camera at least comprising four cameras;
in the coordinate system, coordinates in the coordinate system of the center positions of the image overlapping portions of the four orientations are determined.
Further, in a preset coordinate system, calculating a lens position relationship between the horizontal edge center coordinate and the first camera through a preset algorithm to obtain an offset angle between the lens and the horizontal edge center coordinate, including:
and calculating a position system of the horizontal edge center coordinate and the lens center line projection of the first camera to obtain the offset angle of the lens center line projection of the first camera and the horizontal edge center coordinate.
Further, the driving the lens center position of the camera according to the offset angle, horizontally displacing, and aligning to the horizontal edge center coordinate position includes:
driving a rotating part of the camera according to the offset angle and a preset algorithm to enable the camera to horizontally rotate;
and aligning the lens center line position of the camera to the horizontal edge center coordinate position, and locking the camera.
Further, the camera is a digital high-definition camera.
The embodiment of the invention also discloses a panoramic image edge processing device, which comprises:
the target monitoring module is used for monitoring whether the shot main target is positioned at the position of the horizontal edge of the image, wherein the horizontal edge is the overlapped part when the image is spliced;
the image analysis module is used for determining the center coordinates of the horizontal edges in a preset coordinate system when the main target is monitored to be located at the position of the horizontal edges of the image;
the data calculation module is used for calculating the position relation between the horizontal edge center coordinate and the lens of the first camera through a preset algorithm in the preset coordinate system to obtain the offset angle between the lens and the horizontal edge center coordinate;
and the angle adjusting module is used for driving the lens center position of the camera to horizontally displace according to the offset angle and aligning to the horizontal edge center coordinate position.
The embodiment of the invention also discloses electronic equipment which comprises a processor, a memory and a computer program which is stored on the memory and can run on the processor, wherein when the computer program is executed by the processor, the steps of the panoramic image edge processing method are realized.
The embodiment of the invention also discloses a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and the computer program realizes the steps of the panoramic image edge processing method when being executed by a processor.
The embodiment of the invention has the following advantages:
and by adjusting the horizontal offset of the camera, the horizontal center position of the first camera or the second camera is offset to the position of the superposed part of the spliced images where the main target originally locates. Thereby avoiding the main target of shooting to be positioned at the superposition position of the spliced images.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, the present invention is described in detail with reference to the accompanying drawings and the detailed description thereof.
One of the core ideas of the embodiment of the invention is that the horizontal center position of the first camera or the second camera is shifted to the position of the overlapped part of the spliced images where the main target originally locates by adjusting the horizontal shift of the camera. Thereby avoiding the main target of shooting to be positioned at the superposition position of the spliced images.
Referring to fig. 1, a flowchart illustrating steps of an embodiment of a panoramic image edge processing method according to the present invention is shown, which may specifically include the following steps:
step S1, monitoring whether the shot main target is positioned at the position of the horizontal edge of the image, wherein the horizontal edge is the overlapped part when the image is spliced;
step S2, when the main target is monitored to be located at the position of the horizontal edge of the image, determining the center coordinate of the horizontal edge in a preset coordinate system;
step S3, calculating the position relation between the horizontal edge center coordinate and the lens of the first camera through a preset algorithm in the preset coordinate system, and obtaining the offset angle between the lens and the horizontal edge center coordinate;
and step S4, driving the lens center position of the camera according to the offset angle, horizontally displacing and aligning to the horizontal edge center coordinate position.
In this embodiment, a method for processing edges of a panoramic image according to the present invention is shown, including:
step S1, monitoring whether the shot main target is positioned at the position of the horizontal edge of the image, wherein the horizontal edge is the overlapped part when the image is spliced;
further, the monitoring whether the shot main target is located in front of the horizontal edge position of the image further comprises: acquiring a single image on each camera pair through the panoramic camera;
and calculating the overlapped part of the single images obtained by the adjacent cameras through a preset algorithm, and splicing and fusing the images.
Further, the monitoring whether the shot main target is located behind the horizontal edge position of the image further comprises: and when the main target is not detected to be positioned at the horizontal edge position of the image, keeping the current position.
Step S2, when the main target is monitored to be located at the position of the horizontal edge of the image, determining the center coordinate of the horizontal edge in a preset coordinate system;
further, when it is monitored that the main target is located at the horizontal edge position of the image, determining the horizontal edge center coordinate in a preset coordinate system includes: establishing a coordinate system based on panoramic images according to images of four directions acquired by a panoramic camera at least comprising four cameras;
in the coordinate system, coordinates in the coordinate system of the center positions of the image overlapping portions of the four orientations are determined.
Further, the camera is a digital high-definition camera.
Step S3, calculating the position relation between the horizontal edge center coordinate and the lens of the first camera through a preset algorithm in the preset coordinate system, and obtaining the offset angle between the lens and the horizontal edge center coordinate;
further, in a preset coordinate system, calculating a lens position relationship between the horizontal edge center coordinate and the first camera through a preset algorithm to obtain an offset angle between the lens and the horizontal edge center coordinate, including: and calculating a position system of the horizontal edge center coordinate and the lens center line projection of the first camera to obtain the offset angle of the lens center line projection of the first camera and the horizontal edge center coordinate.
And step S4, driving the lens center position of the camera according to the offset angle, horizontally displacing and aligning to the horizontal edge center coordinate position.
Further, the driving the lens center position of the camera according to the offset angle, horizontally displacing, and aligning to the horizontal edge center coordinate position includes: driving a rotating part of the camera according to the offset angle and a preset algorithm to enable the camera to horizontally rotate;
and aligning the lens center line position of the camera to the horizontal edge center coordinate position, and locking the camera.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
In another embodiment, a panorama image edge processing apparatus of the present invention is disclosed, including:
the target monitoring module is used for monitoring whether the shot main target is positioned at the position of the horizontal edge of the image, wherein the horizontal edge is the overlapped part when the image is spliced;
the image analysis module is used for determining the center coordinates of the horizontal edges in a preset coordinate system when the main target is monitored to be located at the position of the horizontal edges of the image;
the data calculation module is used for calculating the position relation between the horizontal edge center coordinate and the lens of the first camera through a preset algorithm in the preset coordinate system to obtain the offset angle between the lens and the horizontal edge center coordinate;
and the angle adjusting module is used for driving the lens center position of the camera to horizontally displace according to the offset angle and aligning to the horizontal edge center coordinate position.
The embodiment of the invention also discloses electronic equipment which comprises a processor, a memory and a computer program which is stored on the memory and can run on the processor, wherein when the computer program is executed by the processor, the steps of the panoramic image edge processing method are realized.
The embodiment of the invention also discloses a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and the computer program realizes the steps of the panoramic image edge processing method when being executed by a processor.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The panoramic image edge processing method and the panoramic image edge processing device provided by the invention are described in detail, and a specific example is applied in the text to explain the principle and the implementation of the invention, and the description of the above embodiment is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.