CN114862958A - Image processing method, image processing device, storage medium and computer equipment - Google Patents

Image processing method, image processing device, storage medium and computer equipment Download PDF

Info

Publication number
CN114862958A
CN114862958A CN202110150227.4A CN202110150227A CN114862958A CN 114862958 A CN114862958 A CN 114862958A CN 202110150227 A CN202110150227 A CN 202110150227A CN 114862958 A CN114862958 A CN 114862958A
Authority
CN
China
Prior art keywords
camera
current position
image
preset
parameters
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110150227.4A
Other languages
Chinese (zh)
Inventor
吴博剑
樊鲁斌
周昌
黄建强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN202110150227.4A priority Critical patent/CN114862958A/en
Publication of CN114862958A publication Critical patent/CN114862958A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • G06T7/85Stereo camera calibration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/80Geometric correction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • G06T2207/10012Stereo images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10052Images from lightfield camera

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Studio Devices (AREA)

Abstract

The invention discloses an image processing method, an image processing device, a storage medium and computer equipment. Wherein, the method comprises the following steps: acquiring a preset position image of a camera at a preset position and camera parameters at the preset position; acquiring a current position image of the camera at a current position; and determining the camera parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position. The invention solves the technical problem of lower camera calibration efficiency in the related technology.

Description

Image processing method, image processing device, storage medium and computer equipment
Technical Field
The present invention relates to the field of computers, and in particular, to an image processing method, an image processing apparatus, a storage medium, and a computer device.
Background
In the process of processing the image acquired by the camera, a certain difference exists between the two-dimensional attribute in the two-dimensional image and the three-dimensional attribute of the real three-dimensional space, and how to back-project the two-dimensional semantic information in the existing two-dimensional image, such as people, objects and the like, into the real three-dimensional space relates to the processing problem of camera calibration. The conversion relation between the two-dimensional coordinates of the image and the three-dimensional coordinates of the space can be realized through camera calibration, so that the three-dimensional attribute of the real three-dimensional space is obtained.
In the related art, when a camera is calibrated, a three-dimensional calibration object with a known real size is adopted, and camera parameters of the camera are solved by utilizing a predetermined algorithm by establishing a corresponding relation between a point with known coordinates on the three-dimensional calibration object and a two-dimensional image point. However, when the method is adopted, the processing and maintenance of the real three-dimensional calibration object are difficult, so that the camera calibration efficiency is low.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides an image processing method, an image processing device, a storage medium and computer equipment, which are used for at least solving the technical problem of low camera calibration efficiency in the related art.
According to an aspect of an embodiment of the present invention, there is provided an image processing method including: acquiring a preset position image of a camera at a preset position and camera parameters at the preset position; acquiring a current position image of the camera at a current position; and determining the camera parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position.
Optionally, determining the camera parameter of the camera at the current position according to the preset bit image, the current position image and the camera parameter at the preset bit includes: determining initial parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position; and optimizing the initial parameters according to the preset position image and the current position image to obtain the camera parameters of the camera at the current position.
Optionally, determining an initial parameter of the camera at the current position according to the preset bit image, the current position image and the camera parameter at the preset bit includes: selecting a target preset bit image from a plurality of preset bit images under the condition that the number of the preset bit images is multiple, wherein the target preset bit image is a preset bit image corresponding to a target preset bit closest to the current position; obtaining a scaling factor of the target preset position image relative to the current position image; and determining initial parameters of the camera at the current position according to the zooming factor and camera parameters of the camera at the target preset position.
Optionally, selecting the target preset bit image from the plurality of preset bit images includes: determining scaling factors of the plurality of preset bit images relative to the current position image; correcting the scaling factors corresponding to the preset bit images to obtain a plurality of corrected scaling factors; and determining the target preset bit image according to the plurality of modified scaling factors.
Optionally, determining the scaling factor of the plurality of preset bit images relative to the current position image comprises: respectively carrying out feature matching on the plurality of preset bit images and the current position image to obtain a first feature point set in the current position image and respectively obtain a second feature point set of the plurality of preset bit images; performing decentralization on the first feature point set to obtain a decentralized first feature point set, and performing decentralization on second feature point sets of the preset bit images respectively to obtain a decentralized second feature point set; determining homography matrixes between the current position image and the feature points of the plurality of preset bit images respectively according to the decentralized first feature point set and the decentralized second feature point sets corresponding to the plurality of preset bit images respectively; and respectively determining the scaling factors of the preset bit images relative to the current position image according to the homography matrix between the current position image and the characteristic points of the preset bit images.
Optionally, the modifying the scaling factors corresponding to the preset bit images to obtain a plurality of modified scaling factors includes: when the scaling factor is smaller than 1, taking the scaling factor as a correction scaling factor; when the scaling factor is larger than 1, taking the reciprocal of the scaling factor as a modified scaling factor; determining the target preset bit image according to the plurality of modified scaling factors, comprising: determining a maximum of the plurality of modified scaling factors; and determining the preset bit image corresponding to the maximum value as the target preset bit image.
Optionally, optimizing the initial parameter according to the preset bit image and the current position image to obtain a camera parameter of the camera at the current position, including: back projecting the second characteristic point in the preset bit image to a camera coordinate system to obtain a first coordinate of the second characteristic point in the preset bit image in the camera coordinate system; the first coordinate is projected to the image plane of the current position in the forward direction, and a third feature point on the image plane of the current position is obtained; and optimizing the initial parameters by minimizing the reprojection error of the third characteristic point relative to the first characteristic point in the current position image to obtain the camera parameters of the camera at the current position.
Optionally, optimizing the initial parameter includes: the initial parameters comprise: and under the conditions of camera internal parameter, distortion parameter and camera external parameter, keeping the camera external parameter unchanged, and optimizing the camera internal parameter and the distortion parameter.
Optionally, the preset positions are two, one is at the maximum focal length of the camera, and the other is at the minimum focal length of the camera.
Optionally, the camera comprises a variable focus camera.
According to another aspect of the embodiments of the present invention, there is also provided an image processing method, including: displaying a current position image of the camera at the current position on a display interface; receiving an input operation, wherein the input operation is used for requesting to display a three-dimensional picture corresponding to the current position image; responding to the input operation, displaying a three-dimensional picture corresponding to the current position image on the display interface, wherein the three-dimensional picture is determined according to a corresponding relation between coordinates in the current position image and three-dimensional space coordinates, the corresponding relation is determined according to camera parameters of the camera at the current position, and the camera parameters of the camera at the current position are determined according to a preset position image of the camera at a preset position, the camera parameters at the preset position and the current position image.
Optionally, the method further comprises: and identifying a target object in the three-dimensional picture, and highlighting the identified target object on the display interface.
According to an aspect of the embodiments of the present invention, there is also provided an image processing apparatus including: the camera comprises a first acquisition module, a second acquisition module and a control module, wherein the first acquisition module is used for acquiring a preset position image of a camera at a preset position and camera parameters at the preset position; the first acquisition module is used for acquiring a current position image of the camera at a current position; and the first determining module is used for determining the camera parameters of the camera at the current position according to the preset bit image, the current position image and the camera parameters at the preset bit.
According to another aspect of the embodiments of the present invention, there is also provided an image processing apparatus including: the first display module is used for displaying a current position image of the camera at the current position on a display interface; a first receiving module, configured to receive an input operation, where the input operation is used to request display of a three-dimensional picture corresponding to the current position image; and the second display module is used for responding to the input operation and displaying a three-dimensional picture corresponding to the current position image on the display interface, wherein the three-dimensional picture is determined according to a corresponding relation between coordinates in the current position image and three-dimensional space coordinates, the corresponding relation is determined according to camera parameters of the camera at the current position, and the camera parameters of the camera at the current position are determined according to a preset position image of the camera at a preset position, the camera parameters at the preset position and the current position image.
According to an aspect of the embodiments of the present invention, there is also provided a storage medium including a stored program, wherein when the program runs, a device on which the storage medium is located is controlled to execute any one of the image processing methods described above.
According to another aspect of the embodiments of the present invention, there is also provided a computer device, including: a memory and a processor, the memory storing a computer program; the processor is configured to execute the computer program stored in the memory, and when the computer program runs, the processor is enabled to execute any one of the image processing methods.
According to an aspect of an embodiment of the present invention, there is provided an image processing method including: receiving a current position image of a camera at a current position, which is sent by client equipment; and feeding back the camera parameters of the camera at the current position to the client device, wherein the camera parameters of the camera at the current position are determined according to the preset position image of the camera at the preset position, the camera parameters at the preset position and the current position image.
According to another aspect of the embodiments of the present invention, there is provided an image processing method including: determining camera parameters of a camera at the current position according to a preset position image of the camera at a preset position, camera parameters at the preset position and a first current position image of the camera at the current position; acquiring a second current position image of the camera at the current position; correcting the second current position image by using the camera parameters to obtain a corrected image; when the current position is any one of a plurality of focal length positions of the camera, acquiring corrected images corresponding to the plurality of focal length positions respectively; and generating a three-dimensional graph according to the corrected images corresponding to the plurality of focal length positions respectively, and displaying the generated three-dimensional graph at a preset frame frequency to show a virtual reality scene.
In the embodiment of the invention, the camera parameters of the camera at the current position are determined by calibrating the camera parameters of the camera at the preset position in advance, and the current position of the camera can be any focal length of the camera, so that the aim of fully automatically determining the camera parameters of the camera at any focal length is fulfilled, the technical effect of efficiently calibrating the camera is realized, and the technical problem of low camera calibration efficiency in the related technology is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 shows a block diagram of a hardware configuration of a computer terminal for implementing an image processing method;
FIG. 2 is a flowchart of a first image processing method according to embodiment 1 of the present invention;
FIG. 3 is a flowchart of a second image processing method according to embodiment 1 of the present invention;
FIG. 4 is a flowchart of an image processing method three according to embodiment 1 of the present invention;
FIG. 5 is a flowchart of an image processing method four according to embodiment 1 of the present invention;
FIG. 6 is a schematic diagram of a camera calibration method provided in accordance with an alternative embodiment of the invention;
fig. 7 is a block diagram showing a first configuration of an image processing apparatus according to embodiment 2 of the present invention;
fig. 8 is a block diagram showing a second image processing apparatus according to embodiment 2 of the present invention;
fig. 9 is a block diagram showing a third configuration of an image processing apparatus according to embodiment 2 of the present invention;
fig. 10 is a block diagram of a fourth image processing apparatus according to embodiment 2 of the present invention;
fig. 11 is a block diagram of a computer terminal according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
First, some terms or terms appearing in the description of the embodiments of the present application are applicable to the following explanations:
calibrating a camera: in order to determine the relative transformation relationship between the three-dimensional geometric position of a certain point on the surface of an object and the corresponding point on a two-dimensional image, a geometric model for camera imaging needs to be established, and the parameters of the geometric model comprise camera internal parameters, camera external parameters and distortion parameters. These geometric model parameters are camera parameters, and the process of solving the camera parameters is called camera calibration.
Internal reference of the camera: the camera intrinsic parameters (intra parameters) are generally denoted by K, and describe the internal parameters of the camera, including the focal length of the camera, the position of the principal point, and the like, which are inherent properties of the camera.
Distortion parameters: distortion (distortion) is an offset to the linear projection (linear projection) in both geometric optics and Cathode Ray Tube (CRT) displays. Distortions can generally be divided into two broad categories, including radial and tangential distortions. Generally, radial distortion sometimes has slight tangential distortion. The distortion parameters are used to describe distortion, and thus, the distortion parameters include a radial distortion parameter and a tangential distortion parameter.
External reference of the camera: rotation matrix and translation vector of world coordinate system to camera coordinate system. The camera external parameters are generally expressed by R and t, wherein R is a rotation matrix which can be converted into three-dimensional rotation vectors respectively expressing rotation angles around three axes of x, y and z, and t is a translation vector respectively expressing translation amounts in three directions of x, y and z.
Two three-dimensional corresponding points: two-dimensional image feature points (including corner points, Scale-invariant feature transform (SIFT) feature points, orb (organized Fast and Rotated brief) feature points, etc.) in the camera image and corresponding three-dimensional spatial feature points (including corner points, texture feature points, etc.) in the virtual scene model.
Two-dimensional feature matching: the variable focus camera takes a match of two-dimensional feature points of different images at different focal lengths. The two-dimensional feature points comprise corner points, SIFT feature points, ORB feature points and the like, and the feature point matching usually adopts a nearest feature vector matching method.
Example 1
There is also provided, in accordance with an embodiment of the present invention, a method embodiment of an image processing method, it being noted that the steps illustrated in the flowchart of the figure may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
The method provided by the embodiment 1 of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Fig. 1 shows a hardware configuration block diagram of a computer terminal (or mobile device) for implementing an image processing method. As shown in fig. 1, the computer terminal 10 (or mobile device) may include one or more (shown as 102a, 102b, … …, 102 n) processors 102 (the processors 102 may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), memories 104 for storing data, and a transmission device for communication functions. Besides, the method can also comprise the following steps: a display, an input/output interface (I/O interface), a Universal Serial BUS (USB) port (which may be included as one of the ports of the BUS), a network interface, a power source, and/or a camera. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the electronic device. For example, the computer terminal 10 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
It should be noted that the one or more processors 102 and/or other data processing circuitry described above may be referred to generally herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part in software, hardware, firmware, or any combination thereof. Further, the data processing circuit may be a single stand-alone processing module, or incorporated in whole or in part into any of the other elements in the computer terminal 10 (or mobile device). As referred to in the embodiments of the application, the data processing circuit acts as a processor control (e.g. selection of a variable resistance termination path connected to the interface).
The memory 104 may be used to store software programs and modules of application software, such as program instructions/data storage devices corresponding to the image processing method in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implements the vulnerability detection method of the application program. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission device may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
The display may be, for example, a touch screen type Liquid Crystal Display (LCD) that may enable a user to interact with a user interface of the computer terminal 10 (or mobile device).
Under the above operating environment, the present application provides an image processing method as shown in fig. 2. Fig. 2 is a flowchart of a first image processing method according to embodiment 1 of the present invention, as shown in fig. 2, the method includes the following steps:
step S202, acquiring a preset position image of the camera at a preset position and camera parameters at the preset position;
step S204, acquiring a current position image of the camera at the current position;
step S206, determining the camera parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position.
Through the steps, the camera parameters of the camera at the current position are determined through the camera parameters of the camera at the preset position in a mode of calibrating the camera parameters of the camera at the preset position in advance, and the current position of the camera can be any focal length of the camera, so that the aim of fully automatically determining the camera parameters of the camera at any focal length is fulfilled, the technical effect of efficiently calibrating the camera is achieved, and the technical problem that the camera calibration efficiency is low in the related technology is solved.
As an alternative embodiment, the camera may be a variable focal length camera, and the focal length variation of the variable focal length camera may be continuous, i.e. the variable focal length of the camera may be at any focal length between the maximum focal length and the minimum focal length of the camera.
As an alternative embodiment, the preset position may be at the focal length of the camera, that is, at any focal length between the maximum focal length and the minimum focal length of the camera with variable focal length. The current setting referred to above may also be at the focal length of the camera, i.e. at any focal length between the maximum focal length and the minimum focal length of the camera of variable focal length referred to above.
As an alternative embodiment, the preset position may be multiple, at least two, one is at the maximum focal length of the camera, and the other is at the minimum focal length of the camera. The more the number of the preset bits is, the more accurate the selection of the preset bit closest to the current position of the camera is, so that the camera parameters of the camera at the current position can be determined more quickly and efficiently.
As an alternative embodiment, the camera parameters of the camera include camera internal parameters, camera external parameters and distortion parameters. The camera parameters of the camera at the preset position comprise: the camera internal parameter of the camera at the preset position, the camera external parameter of the camera at the preset position and the distortion parameter of the camera at the preset position. The camera parameters of the camera at the current position include: camera internal parameters of the camera at the current position, camera external parameters of the camera at the current position and distortion parameters of the camera at the current position. Wherein the camera internal reference may include: camera focal length, location of principal point, etc. The camera external parameters may include: rotation matrix and translation vector of world coordinate system to camera coordinate system. The distortion parameters may include: a radial distortion parameter and a tangential distortion parameter.
As an alternative embodiment, when determining the camera parameter of the camera at the current position according to the preset bit image, the current position image and the camera parameter at the preset bit, various manners may be adopted, for example, the following manners may be adopted: determining initial parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position; and optimizing the initial parameters according to the preset position image and the current position image to obtain the camera parameters of the camera at the current position.
As an alternative embodiment, the optimization of the initial parameters includes: the initial parameters include: and (3) under the conditions of camera internal parameter, distortion parameter and camera external parameter, keeping the camera external parameter unchanged, and optimizing the camera internal parameter and the distortion parameter. Since zooming of the zoom camera does not change the physical mounting position of the camera, camera external parameters can be assumed to remain unchanged, and camera internal parameters and distortion parameters are optimized. The camera internal reference may include: focal length, location of principal point, etc. Since the position of the principal point can be fixed at the center of the image, optimizing the camera parameters is equivalent to optimizing the focal length. Thus, optionally, optimizing the initial parameters may comprise: the focal length and distortion parameters are optimized.
As an alternative embodiment, the initial parameter of the camera at the current position can be determined in various ways according to the preset bit image, the current position image and the camera parameter at the preset bit, for example, the following ways can be adopted: under the condition that a plurality of preset bit images are available, selecting a target preset bit image from the plurality of preset bit images, wherein the target preset bit image is the preset bit image corresponding to the target preset bit closest to the current position; obtaining a scaling factor of the target preset position image relative to the current position image; and determining initial parameters of the camera at the current position according to the zooming factor and camera parameters of the camera at the target preset position. The preset bit image corresponding to the target preset bit closest to the current position is selected from the preset bit images, and the camera parameter of the current position is determined according to the camera parameter of the closest preset bit, so that the obtained camera parameter of the camera at the current position can be more accurate. The zoom factor of the target preset position image relative to the current position image can reflect the deviation between the camera parameters of the preset position and the camera parameters of the current position to a certain extent, and therefore the camera parameters of the camera at the current position can be determined according to the camera parameters of the preset position and the zoom factor.
As an alternative embodiment, when selecting the target preset bit image from the plurality of preset bit images, various manners may be adopted, for example, the method may include: determining scaling factors of a plurality of preset bit images relative to a current position image; correcting the scaling factors corresponding to the preset bit images to obtain a plurality of corrected scaling factors; and determining the target preset bit image according to the plurality of modified scaling factors. Because a certain error may exist in the process of determining the zoom factor, in order to ensure the accuracy of the camera parameter of the camera at the current position determined according to the zoom factor, when the camera parameter of the camera at the current position is determined according to the zoom factor, the zoom factor may be corrected, and then the camera parameter of the camera at the current position is determined according to the corrected zoom factor.
As an alternative embodiment, when determining the scaling factors of the preset bit images relative to the current position image, the scaling factors may be determined according to the features of the preset bit images and the features of the current position image, and for example, the following processes may be adopted: respectively carrying out feature matching on the preset bit images and the current position image to obtain a first feature point set in the current position image and respectively obtain a second feature point set of the preset bit images; the method comprises the steps of performing decentralization on a first feature point set to obtain a decentralized first feature point set, and performing decentralization on second feature point sets of a plurality of preset bit images to obtain a decentralized second feature point set; determining homography matrixes between the current position image and the feature points of the plurality of preset bit images respectively according to the decentralized first feature point set and the decentralized second feature point sets corresponding to the plurality of preset bit images respectively; and respectively determining the scaling factors of the preset bit images relative to the current position image according to the homography matrixes between the current position image and the characteristic points of the preset bit images. It should be noted that the above-mentioned features for performing feature matching may include multiple kinds, for example, SIFT feature points, ORB feature points, BRISK feature points, corner points, and the like. But when a match is made, the preset bit image and the current position image should be the same. In addition, when feature matching is performed between the preset bit image and the current position image, the number of features extracted from the preset bit image and the number of features extracted from the current position image may be different.
As an optional embodiment, when performing correction processing on the scaling factors corresponding to the plurality of preset bit images to obtain a plurality of corrected scaling factors, the following processing may be specifically adopted: when the scaling factor is smaller than 1, taking the scaling factor as a correction scaling factor; when the scaling factor is larger than 1, taking the reciprocal of the scaling factor as a modified scaling factor; determining a target preset bit image according to a plurality of modified scaling factors, comprising: determining a maximum of a plurality of modified scaling factors; and determining the preset bit image corresponding to the maximum value as a target preset bit image. By the correction processing, obviously inaccurate scaling factors can be effectively avoided. In addition, the preset position corresponding to the maximum zooming factor in the preset position images is the preset position closest to the current position, and the camera parameter of the camera at the closest preset position is closest to the camera parameter of the camera at the current position, so that the camera parameter of the camera at the current position determined according to the camera parameter of the camera at the closest preset position is also the most accurate.
As an optional embodiment, optimizing the initial parameter according to the preset bit image and the current position image to obtain the camera parameter of the camera at the current position includes: back projecting the second characteristic point in the preset bit image to a camera coordinate system to obtain a first coordinate of the second characteristic point in the preset bit image in the camera coordinate system; the first coordinate is projected to the image plane of the current position in the forward direction, and a third feature point on the image plane of the current position is obtained; and optimizing the initial parameters by minimizing the reprojection error of the third characteristic point relative to the first characteristic point in the current position image to obtain the camera parameters of the camera at the current position. The initialized camera parameters are optimized by comparing the real current position image with a re-projected image projected according to the initialized camera parameters, for example, comparing errors between coordinates (or feature points) in the real current position image and coordinates (or feature points) in the re-projected image, thereby obtaining accurate camera parameters of the camera at the current position.
According to an embodiment of the present invention, there is also provided an image processing method, and fig. 3 is a flowchart of an image processing method two according to embodiment 1 of the present invention, as shown in fig. 3, the method includes the following steps:
step S302, displaying a current position image of the camera at the current position on a display interface;
step S304, receiving an input operation, wherein the input operation is used for requesting to display a three-dimensional picture corresponding to the current position image;
step S306, responding to the input operation, displaying a three-dimensional picture corresponding to the current position image on the display interface, wherein the three-dimensional picture is determined according to the corresponding relation between the coordinates in the current position image and the three-dimensional space coordinates, the corresponding relation is determined according to the camera parameters of the camera at the current position, and the camera parameters of the camera at the current position are determined according to the preset position image of the camera at the preset position, the camera parameters at the preset position and the current position image.
When the current position image of the current any focal length position of the camera is displayed on the display interface, the camera parameters of the camera at the current position can be determined by the camera parameters of the camera at the preset position in advance, and then the three-dimensional picture corresponding to the current any focal length position can be displayed on the display interface.
As an alternative embodiment, in the three-dimensional picture displayed on the display interface, to increase the additional experience of the user, a target object in the three-dimensional picture may be identified in the displayed three-dimensional picture, and the identified target object may be highlighted on the display interface. By highlighting the identified target object, the picture content of the three-dimensional picture can be effectively displayed. The target object in the three-dimensional picture may be a person or an object; can be a moving object or a static object; and the like.
According to an embodiment of the present invention, there is also provided an image processing method, and fig. 4 is a flowchart of an image processing method three according to embodiment 1 of the present invention, as shown in fig. 4, the method includes the following steps:
step S402, receiving a current position image of a camera at a current position, which is sent by a client device;
step S404, feeding back the camera parameters of the camera at the current position to the client device, where the camera parameters of the camera at the current position are determined according to the preset bit image of the camera at the preset bit, the camera parameters at the preset bit and the current position image.
Through the processing, a mode of receiving the current position image sent by the client device and feeding back the camera parameters of the camera at the current position to the client device is adopted, wherein the camera parameters of the camera at the current position can be determined through the camera parameters of the camera at the preset position, and the current position of the camera can be any focal length of the camera, so that the aim of fully automatically determining the camera parameters of the camera at any focal length is fulfilled, and the camera parameters at the required focal length are fully automatically provided for the client device.
According to an embodiment of the present invention, there is also provided an image processing method, and fig. 5 is a flowchart of a fourth image processing method according to embodiment 1 of the present invention, as shown in fig. 5, the method including the steps of:
step S502, determining the camera parameters of the camera at the current position according to the preset position image of the camera at the preset position, the camera parameters at the preset position and the first current position image of the camera at the current position;
step S504, acquiring a second current position image of the camera at the current position; it should be noted that the second current position image of the camera at the current position may be an image captured again by the camera at the current position relative to the first current position image.
S506, correcting the second current position image by using the camera parameters to obtain a corrected image; because the camera parameters comprise distortion parameters, the image acquired again at the current position can be corrected by adopting the camera parameters, so that a more accurate corrected image is obtained.
Step S508, when the current position is any one of the plurality of focal length positions of the camera, acquiring corrected images corresponding to the plurality of focal length positions respectively;
step S510, generating a three-dimensional image according to the corrected images corresponding to the plurality of focal positions, and displaying the generated three-dimensional image at a predetermined frame rate to show a virtual reality scene. It should be noted that, since a certain conversion relationship exists between the two-dimensional image and the three-dimensional space, when generating a three-dimensional image according to corrected images corresponding to a plurality of focal positions, the conversion relationship may be determined according to the calibrated camera parameters, and then the corrected images corresponding to the plurality of focal positions may be generated into a three-dimensional image according to the conversion relationship, and then the generated three-dimensional image is displayed at a predetermined frame frequency to show a virtual reality scene. The predetermined frame rate is used for displaying the generated three-dimensional image in real time, and may be higher than 30 frames/second, for example, so as to realize a virtual reality scene with better effect.
Through the processing, the camera parameter at the preset position and the camera parameter at the current position determined by the camera at the first current position image at the current position are adopted to correct the second current position image collected at the current position again, so that the three-dimensional image is generated according to the corrected image, and the three-dimensional image is stereoscopically displayed to show the virtual reality scene. The current position of the camera can be any focal length of the camera, so that the camera parameters of the camera at any focal length are fully automatically determined according to the preset position image of the camera at the preset position, the three-dimensional image is fully automatically generated, and the three-dimensional image is stereoscopically displayed to display the virtual reality scene.
Based on the above embodiments and optional embodiments, an optional implementation is provided by taking a camera as a zoom camera and taking a city scene as an example, which is described in detail below.
In an urban scene, a camera, as an efficient video image acquisition device, is widely applied to various fields, for example, the camera can be applied to the field of municipal traffic, and pedestrians, vehicles and the like in a target scene can be checked. And certain difference exists between the two-dimensional attributes of the image picture and the three-dimensional attributes of the real scene, so how to back-project two-dimensional semantic information in the existing two-dimensional image, such as people, vehicles and the like, into the real three-dimensional space to serve for fine management of the city. The core problem is to estimate camera parameters (including internal parameters of the camera, external parameters of the camera and distortion parameters) of the camera, and the core technology involved in the method is a camera calibration algorithm, and therefore, a conversion relation between two-dimensional coordinates of an image and three-dimensional coordinates of a space is established. In practical application scenes, the target scenes are wide in range, and a variable focus camera is generally adopted to obtain target images at a far position or a near position through zooming so as to clearly focus on objects at different distances. The camera parameters can be directly changed by continuous zooming, but the camera parameters can not be estimated by calibrating the camera in real time only through a camera picture, so that how to efficiently calibrate the variable focal length camera in an observation scene has practical application value. In addition, unlike a common camera, the variable focal length camera is generally higher in installation position and larger in imaging field of view, which causes serious distortion of a shot image, and this directly affects the calibration accuracy of the camera.
Based on the above requirements of the variable focus camera, calibration of the variable focus camera needs to be implemented. For a common camera, when calibration is performed, the adopted camera calibration algorithm comprises the following steps: traditional camera calibration algorithms, camera self-calibration methods, active vision camera calibration algorithms.
(1) The traditional camera calibration algorithm: three-dimensional or planar calibration objects of known real dimensions are used, and the camera parameters of the camera model are solved by an optimization algorithm by establishing correspondence between points of known coordinates on the calibration objects and their image points. The three-dimensional calibration object can be calibrated by a single image, and although the calibration precision is higher, the processing and maintenance of the high-precision three-dimensional calibration object are more difficult. The planar calibration object is simpler to manufacture than the three-dimensional calibration object, the precision is easy to guarantee, but two or more images are needed during calibration.
(2) Camera self-calibration method: and calibrating internal and external parameters of the camera by using some parallel or orthogonal constraint information in the scene. The intersection point of the space parallel lines on the camera image plane is called a vanishing point, and the method based on the vanishing point usually utilizes a quadric curve or a curved surface theory to solve the internal and external parameters of the camera. However, the resolution precision of the vanishing point is not high, and the camera parameter error estimated by the method is large. In addition, for a distorted camera, distortion of spatial parallel lines on an imaging plane can also cause the solution precision of vanishing points to be reduced, and the calibration robustness is directly influenced.
(3) Active vision camera calibration algorithm: by utilizing a motion recovery structure technology and analyzing the motion of the camera, the internal and external parameters of the camera are obtained through optimization while the three-dimensional geometric information of the scene is recovered. The method does not need a known calibration object, only needs to move the camera to shoot images in the same scene, but needs to ensure that the baseline distance of the camera motion between adjacent images is larger.
The three types of calibration algorithms cannot solve the external reference of the camera relative to the geographic coordinate system, and because the three types of methods realize camera calibration based on local three-dimensional information, the positioning of an object in an image in a real space cannot be naturally realized. From the perspective of data acquisition, the mounting position of the variable-focus camera is usually higher and farther, and a calibration object (such as a calibration plate) cannot be reasonably placed in a visual distance range to realize camera calibration; in addition, since the zoom camera is usually installed outdoors, the influence of unpredictable external environment on the imaging quality is large, and the noise of the shot image is heavy, so that the precision is difficult to ensure by adopting a self-calibration method such as vanishing point calculation; in addition, for a variable focal length camera, since the focal length change is a continuous process and all continuous focal length ranges cannot be sampled through discrete images, a common monocular camera calibration algorithm is only suitable for calibrating a fixed focal length monocular camera and is not suitable for the variable focal length camera.
In view of this, in the optional embodiment, by using the calibration results of the preset positions of a small number of variable-focus cameras (in general, two preset positions are only required, namely, the maximum focal length position and the minimum focal length position), based on the two-dimensional feature matching optimization algorithm, the full-automatic camera calibration under any zooming condition is realized, and the camera parameters of the camera are estimated, so that various applications in three-dimensional scene simulation, such as pedestrian and vehicle positioning, speed estimation, virtual reality, augmented reality, and the like, are realized.
Fig. 6 is a schematic diagram of a camera calibration method according to an alternative embodiment of the present invention, as shown in fig. 6, the method includes:
(1) selecting and calibrating a preset position image: discretely sampling N preset positions (N is more than or equal to 2) images (equal focal distance interval sampling or unequal focal distance interval sampling can be carried out, and the images at least comprise two preset positions at a maximum focal distance and a minimum focal distance); and at each preset position, calibrating camera parameters by adopting a traditional algorithm, wherein the camera parameters comprise camera internal parameters such as the focal length and the principal point position of the camera under the current preset position, and camera external parameters and distortion parameters converted from a world coordinate system to a camera coordinate system.
(2) Sampling any focal length image: and adjusting the focal length of the variable focal length camera to the current position to acquire the current position image.
(3) And establishing association with the preset bit image: and calculating a two-dimensional feature matching relationship between the current position image and each preset position image to obtain two-dimensional feature matching pixel points.
(4) Initial calibration: in the initialization process, it is assumed that zooming only affects the focal length in camera internal parameters, and the focal length is initialized according to the two-dimensional feature matching relationship and the camera imaging principle.
(5) Parameter optimization: in the parameter optimization stage, the camera external parameters (including focal length) and distortion parameters are optimized on the assumption that the camera external parameters are kept unchanged and the fixed principal point is located in the center of the image. And constructing a new internal reference matrix according to the initialized focal length, back-projecting the two-dimensional feature matching pixel points of the current position and the preset position to a camera coordinate system, and constructing a re-projection error function under the camera coordinate system according to an imaging principle to further optimize camera internal reference and distortion parameters.
The above-mentioned steps (3), (4) and (5) will be described in detail. Note that all three-to-two coordinate transformations are defaulted to perspective division operations, i.e., normalizing the last dimension coordinate, in the following formulas, unless otherwise specified.
Associating with preset bit images
Assume a preset bit-image set of l i (i ═ 1, 2.., N), calibrating by adopting a traditional scheme to obtain an internal parameter matrix K of each preset position camera i The corresponding focal length is denoted as f i The principal point position p is fixed at the center of the image, and the distortion parameter is dist i ={k i1 ,k i2 ,p i1 ,p i2 The rotation matrix and the translation vector of the camera external parameter are respectively expressed as R i And t i . The current position camera image after the focal length is adjusted is I c The SIFT feature matching is adopted here to establish the two-dimensional feature matching relationship between the current position image and the preset position image, and the matched two-dimensional feature point sets are respectively expressed as F c And F i The single feature point in the set is x c And x i . Note that each set F i In (2) the number of feature points is not uniform, x c And x i Only a certain feature point in the feature set is generally referred to.
Then, all the characteristic points are decentralized to construct an objective function
Figure BDA0002932459010000141
Figure BDA0002932459010000142
After the decentralization is calculated, a homography matrix H between the two-dimensional characteristic points of the current position image and the two-dimensional characteristic points of the preset position image i ∈R 3×3
Initial calibration
Estimating a scaling factor of a preset bit image relative to a current position image based on a homography
Figure BDA0002932459010000143
Wherein H i (m, n) denotes the mth row and nth column elements of the matrix. The scaling factor may then be modified to:
Figure BDA0002932459010000144
comparison of all s' i And (4) taking the subscript j corresponding to the maximum value, so that the current position is closest to the jth preset position. Accordingly, the focal length of the current position is initialized to be f ═ s j f j Distortion parameter is dist ═ k 1 =k j1 ,k 2 =k j2 ,p 1 =p j1 ,p 2 =p j2 And respectively initializing a rotation matrix and a translation vector corresponding to the camera external parameter into R ═ R j And t ═ t j
Parameter optimization
The camera parameter optimization stage optimizes only the focal length f and the distortion parameter dist because zooming does not change the physical mounting position of the camera, i.e., it can be assumed that the camera external parameters remain unchanged. The calculation flow is as follows:
(1) at each preset position i, obtaining an internal reference matrix K according to calibration i And distortion parameter dist i Image feature point x i Distortion correction is carried out and back projection is carried out to a camera coordinate system to obtain
Figure BDA0002932459010000151
(2) For the current position, an internal parameter matrix K is constructed according to the estimated focal length f and an initialized distortion parameter dist
Figure BDA0002932459010000152
Forward projected onto the imaging plane of the current location as follows:
Figure BDA0002932459010000153
Figure BDA0002932459010000154
wherein the content of the first and second substances,
Figure BDA0002932459010000155
k 1 and k 2 Representing the radial distortion parameter, p 1 And p 2 Representing the tangential distortion parameter. Projecting the distorted coordinates to an imaging plane to obtain a pixel coordinate estimated value:
Figure BDA0002932459010000156
(3) from this an energy function is constructed:
Figure BDA0002932459010000157
the aim is to minimize the reprojection error and solve the camera internal parameter and distortion parameter;
(4) the optimization method comprises the following steps: k and dist in the energy function adopt the result determined by the initial calibration as an initial value, and optionally, a Levenberg-Marquard algorithm is adopted to optimize an objective function. It should be noted that, when optimizing the objective function, various other optimization methods can be adopted, such as the steepest descent method, the Newton-type method, and the Gauss-Newton method. It should be noted that the above-mentioned Levenberg-Marquard algorithm is a combination of the steepest descent method (gradient descent method) and Gauss-Newton.
In addition, it should be noted that the above mentioned two-dimensional image feature points include, but are not limited to, SIFT feature points, ORB feature points, BRISK feature points, corner points, and the like, and the feature points may also be adopted to match the current position image and the preset position image.
Through the above optional embodiment, the following beneficial effects can be achieved:
(1) aiming at digital urban scenes, a set of calibration algorithm of a universal variable-focus camera is provided, and camera parameter estimation at any focal length is realized.
(2) The focal length change of the camera is continuous, and the continuous focal length change range cannot be obtained through discrete sampling. The method can fully automatically estimate the camera parameters of the variable-focus camera at any focal length under the condition of calibrating a small number of preset bits (at least two camera parameters at the maximum focal length and the minimum focal length) in advance.
(3) In addition, it should be noted that the optimization strategy proposed by the alternative embodiment can be extended to any imaging model and distortion model.
It should be noted that, for simplicity of description, the above-mentioned 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 order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
Example 2
According to an embodiment of the present invention, there is further provided an apparatus for implementing the first image processing method, and fig. 7 is a block diagram of a first image processing apparatus according to an embodiment 2 of the present invention, as shown in fig. 7, the apparatus includes: a first acquisition module 72, a first acquisition module 74 and a first determination module 76, which are described below.
A first obtaining module 72, configured to obtain a preset location image of the camera at a preset location, and a camera parameter at the preset location; a first acquiring module 74, connected to the first acquiring module 72, for acquiring a current position image of the camera at the current position; a first determining module 76, connected to the first acquiring module 74, is used for determining the camera parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position.
According to an embodiment of the present invention, there is further provided an apparatus for implementing the second image processing method, and fig. 8 is a block diagram of a second image processing apparatus according to an embodiment 2 of the present invention, and as shown in fig. 8, the apparatus includes: a first display module 82, a first receiving module 84, and a second display module 86, which will be described below.
A first display module 82, configured to display a current position image of the camera at a current position on a display interface; a first receiving module 84, connected to the first display module 82, for receiving an input operation, where the input operation is used to request a display of a three-dimensional screen corresponding to the current position image; and a second display module 86, connected to the first receiving module 84, for displaying a three-dimensional frame corresponding to the current position image on the display interface in response to the input operation, wherein the three-dimensional frame is determined according to a corresponding relationship between coordinates in the current position image and three-dimensional space coordinates, the corresponding relationship is determined according to camera parameters of the camera at the current position, and the camera parameters of the camera at the current position are determined according to the preset position image of the camera at the preset position, the camera parameters at the preset position, and the current position image.
According to an embodiment of the present invention, there is further provided an apparatus for implementing the third image processing method, and fig. 9 is a block diagram of a structure of the third image processing apparatus according to embodiment 2 of the present invention, as shown in fig. 9, the apparatus includes: a second receiving module 92 and a feedback module 94, which are described below.
A second receiving module 92, configured to receive a current position image of the camera at the current position sent by the client device; and a feedback module 94, connected to the second receiving module 92, for feeding back the camera parameters of the camera at the current position to the client device, where the camera parameters of the camera at the current position are determined according to the preset bit image of the camera at the preset bit, the camera parameters at the preset bit and the current position image.
According to an embodiment of the present invention, there is also provided an apparatus for implementing the fourth image processing method, and fig. 10 is a block diagram of a structure of the fourth image processing apparatus according to embodiment 2 of the present invention, as shown in fig. 10, the apparatus includes: a second determination module 1002, a second acquisition module 1004, a correction module 1006, a second acquisition module 1008, and a generation module 1010, which are described below.
A second determining module 1002, configured to determine a camera parameter of the camera at the current position according to a preset bit image of the camera at a preset bit, a camera parameter at the preset bit, and a first current position image of the camera at the current position; a second collecting module 1004 connected to the second determining module 1002 for collecting a second current position image of the camera at the current position; a correction module 1006, connected to the second acquisition module 1004, for correcting the second current position image by using the camera parameters to obtain a corrected image; a second obtaining module 1008, connected to the correcting module 1006, for obtaining corrected images corresponding to a plurality of focal positions when the current position is any one of the plurality of focal positions of the camera; the generating module 1010 is connected to the second obtaining module 1008, generates a three-dimensional graph according to the corrected images corresponding to the plurality of focal positions, and displays the generated three-dimensional graph at a predetermined frame frequency to show a virtual reality scene.
It should be noted that the modules correspond to the steps in embodiment 1, and the modules are the same as the corresponding steps in the implementation example and application scenarios, but are not limited to the disclosure in embodiment 1. It should be noted that the above modules may be operated in the computer terminal 10 provided in embodiment 1 as a part of the apparatus.
Example 3
Embodiments of the present invention may provide a computer terminal, which may be any one computer terminal device (i.e., computer device) in a computer terminal group. Optionally, in this embodiment, the computer terminal may also be replaced with a terminal device such as a mobile terminal.
Optionally, in this embodiment, the computer terminal may be located in at least one network device of a plurality of network devices of a computer network.
In this embodiment, the computer terminal may execute program codes of the following steps in the image processing method of the application program: acquiring a preset position image of a camera at a preset position and camera parameters at the preset position; acquiring a current position image of a camera at a current position; and determining the camera parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position.
Alternatively, fig. 11 is a block diagram of a computer terminal according to an embodiment of the present invention. As shown in fig. 11, the computer terminal may include: one or more processors 112 (only one shown), memory 114, and the like.
The memory may be configured to store software programs and modules, such as program instructions/modules corresponding to the image processing method and apparatus in the embodiments of the present invention, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory, so as to implement the image processing method. The memory may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include memory located remotely from the processor, and these remote memories may be connected to the computer terminal through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The processor can call the information and application program stored in the memory through the transmission device to execute the following steps: acquiring a preset position image of a camera at a preset position and camera parameters at the preset position; acquiring a current position image of a camera at a current position; and determining the camera parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position.
Optionally, the processor may further execute the program code of the following steps: determining the camera parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position, wherein the method comprises the following steps: determining initial parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position; and optimizing the initial parameters according to the preset position image and the current position image to obtain the camera parameters of the camera at the current position.
Optionally, the processor may further execute the program code of the following steps: determining initial parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position, wherein the initial parameters comprise: under the condition that a plurality of preset bit images are available, selecting a target preset bit image from the plurality of preset bit images, wherein the target preset bit image is the preset bit image corresponding to the target preset bit closest to the current position; obtaining a scaling factor of the target preset position image relative to the current position image; and determining initial parameters of the camera at the current position according to the zooming factor and camera parameters of the camera at the target preset position.
Optionally, the processor may further execute the program code of the following steps: selecting a target preset bit image from a plurality of preset bit images, comprising: determining scaling factors of a plurality of preset bit images relative to a current position image; correcting the scaling factors corresponding to the preset bit images to obtain a plurality of corrected scaling factors; and determining the target preset bit image according to the plurality of modified scaling factors.
Optionally, the processor may further execute the program code of the following steps: determining scaling factors for a plurality of preset bit images relative to a current position image, comprising: respectively carrying out feature matching on the preset bit images and the current position image to obtain a first feature point set in the current position image and respectively obtain a second feature point set of the preset bit images; the method comprises the steps of performing decentralization on a first feature point set to obtain a decentralized first feature point set, and performing decentralization on second feature point sets of a plurality of preset bit images to obtain a decentralized second feature point set; determining homography matrixes between the current position image and the feature points of the plurality of preset bit images respectively according to the decentralized first feature point set and the decentralized second feature point sets corresponding to the plurality of preset bit images respectively; and respectively determining the scaling factors of the preset bit images relative to the current position image according to the homography matrixes between the current position image and the characteristic points of the preset bit images.
Optionally, the processor may further execute the program code of the following steps: correcting the scaling factors corresponding to the preset bit images to obtain a plurality of corrected scaling factors, wherein the method comprises the following steps: when the scaling factor is smaller than 1, taking the scaling factor as a correction scaling factor; when the scaling factor is larger than 1, taking the reciprocal of the scaling factor as a modified scaling factor; determining a target preset bit image according to a plurality of modified scaling factors, comprising: determining a maximum of a plurality of modified scaling factors; and determining the preset bit image corresponding to the maximum value as a target preset bit image.
Optionally, the processor may further execute the program code of the following steps: optimizing the initial parameters according to the preset position image and the current position image to obtain the camera parameters of the camera at the current position, wherein the method comprises the following steps: back projecting the second characteristic point in the preset bit image to a camera coordinate system to obtain a first coordinate of the second characteristic point in the preset bit image in the camera coordinate system; the first coordinate is projected to the image plane of the current position in the forward direction, and a third feature point on the image plane of the current position is obtained; and optimizing the initial parameters by minimizing the reprojection error of the third characteristic point relative to the first characteristic point in the current position image to obtain the camera parameters of the camera at the current position.
Optionally, the processor may further execute the program code of the following steps: optimizing initial parameters, including: the initial parameters include: and (3) under the conditions of camera internal parameter, distortion parameter and camera external parameter, keeping the camera external parameter unchanged, and optimizing the camera internal parameter and the distortion parameter.
Optionally, the processor may further execute the program code of the following steps: the preset positions are two, one is at the maximum focal length of the camera, and the other is at the minimum focal length of the camera.
Optionally, the processor may further execute the program code of the following steps: the camera includes a variable focus camera.
The processor can call the information and application program stored in the memory through the transmission device to execute the following steps: displaying a current position image of the camera at the current position on a display interface; receiving an input operation, wherein the input operation is used for requesting to display a three-dimensional picture corresponding to the current position image; responding to the input operation, displaying a three-dimensional picture corresponding to the current position image on the display interface, wherein the three-dimensional picture is determined according to the corresponding relation between the coordinates in the current position image and the three-dimensional space coordinates, the corresponding relation is determined according to the camera parameters of the camera at the current position, and the camera parameters of the camera at the current position are determined according to the preset position image of the camera at the preset position, the camera parameters at the preset position and the current position image.
Optionally, the processor may further execute the program code of the following steps: and identifying the target object in the three-dimensional picture, and highlighting the identified target object on the display interface.
The processor can call the information and application program stored in the memory through the transmission device to execute the following steps: receiving a current position image of a camera at a current position, which is sent by client equipment; and feeding back the camera parameters of the camera at the current position to the client device, wherein the camera parameters of the camera at the current position are determined according to the preset bit image of the camera at the preset bit, the camera parameters at the preset bit and the current position image.
The processor can call the information and application program stored in the memory through the transmission device to execute the following steps: determining camera parameters of the camera at the current position according to a preset position image of the camera at a preset position, camera parameters at the preset position and a first current position image of the camera at the current position; acquiring a second current position image of the camera at the current position; correcting the second current position image by using the camera parameters to obtain a corrected image; when the current position is taken as any one of a plurality of focal length positions of the camera, corrected images corresponding to the plurality of focal length positions are obtained; and generating a three-dimensional graph according to the corrected images corresponding to the plurality of focal length positions respectively, and displaying the generated three-dimensional graph at a preset frame frequency to show the virtual reality scene.
By adopting the embodiment of the invention, the camera parameters of the camera at the current position are determined by the camera parameters of the camera at the preset position in a manner of calibrating the camera parameters of the camera at the preset position in advance, and the current position of the camera can be any focal length of the camera, so that the aim of fully automatically determining the camera parameters of the camera at any focal length is fulfilled, the technical effect of efficiently calibrating the camera is realized, and the technical problem of low camera calibration efficiency in the related technology is solved.
It can be understood by those skilled in the art that the structure shown in fig. 11 is only an illustration, and the computer terminal may also be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 11 is a diagram illustrating a structure of the electronic device. For example, the computer terminal 11 may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 11, or have a different configuration than shown in FIG. 11.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
Example 4
The embodiment of the invention also provides a storage medium. Alternatively, in this embodiment, the storage medium may be configured to store program codes executed by the image processing method provided in embodiment 1.
Optionally, in this embodiment, the storage medium may be located in any one of computer terminals in a computer terminal group in a computer network, or in any one of mobile terminals in a mobile terminal group.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: acquiring a preset position image of a camera at a preset position and camera parameters at the preset position; acquiring a current position image of a camera at a current position; and determining the camera parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position.
Optionally, in this embodiment, the storage medium is further configured to store program code for performing the following steps: determining the camera parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position, wherein the method comprises the following steps: determining initial parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position; and optimizing the initial parameters according to the preset position image and the current position image to obtain the camera parameters of the camera at the current position.
Optionally, in this embodiment, the storage medium is further configured to store program code for performing the following steps: determining initial parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position, wherein the initial parameters comprise: under the condition that a plurality of preset bit images are available, selecting a target preset bit image from the plurality of preset bit images, wherein the target preset bit image is the preset bit image corresponding to the target preset bit closest to the current position; obtaining a scaling factor of the target preset position image relative to the current position image; and determining initial parameters of the camera at the current position according to the zooming factor and camera parameters of the camera at the target preset position.
Optionally, in this embodiment, the storage medium is further configured to store program code for performing the following steps: selecting a target preset bit image from a plurality of preset bit images, comprising: determining scaling factors of a plurality of preset bit images relative to a current position image; correcting the scaling factors corresponding to the preset bit images to obtain a plurality of corrected scaling factors; and determining the target preset bit image according to the plurality of modified scaling factors.
Optionally, in this embodiment, the storage medium is further configured to store program code for performing the following steps: determining scaling factors for a plurality of preset bit images relative to a current position image, comprising: respectively carrying out feature matching on the preset bit images and the current position image to obtain a first feature point set in the current position image and respectively obtain a second feature point set of the preset bit images; the method comprises the steps of performing decentralization on a first feature point set to obtain a decentralized first feature point set, and performing decentralization on second feature point sets of a plurality of preset bit images to obtain a decentralized second feature point set; determining homography matrixes between the current position image and the feature points of the plurality of preset bit images respectively according to the decentralized first feature point set and the decentralized second feature point sets corresponding to the plurality of preset bit images respectively; and respectively determining the scaling factors of the preset bit images relative to the current position image according to the homography matrixes between the current position image and the characteristic points of the preset bit images.
Optionally, in this embodiment, the storage medium is further configured to store program code for performing the following steps: correcting the scaling factors corresponding to the preset bit images to obtain a plurality of corrected scaling factors, wherein the method comprises the following steps: when the scaling factor is smaller than 1, taking the scaling factor as a correction scaling factor; when the scaling factor is larger than 1, taking the reciprocal of the scaling factor as a modified scaling factor; determining a target preset bit image according to a plurality of modified scaling factors, comprising: determining a maximum of a plurality of modified scaling factors; and determining the preset bit image corresponding to the maximum value as a target preset bit image.
Optionally, in this embodiment, the storage medium is further configured to store program code for performing the following steps: optimizing the initial parameters according to the preset position image and the current position image to obtain the camera parameters of the camera at the current position, wherein the method comprises the following steps: back projecting the second characteristic point in the preset bit image to a camera coordinate system to obtain a first coordinate of the second characteristic point in the preset bit image in the camera coordinate system; the first coordinate is projected to the image plane of the current position in the forward direction, and a third feature point on the image plane of the current position is obtained; and optimizing the initial parameters by minimizing the reprojection error of the third characteristic point relative to the first characteristic point in the current position image to obtain the camera parameters of the camera at the current position.
Optionally, in this embodiment, the storage medium is further configured to store program code for performing the following steps: optimizing initial parameters, including: the initial parameters include: and (3) under the condition of camera internal parameter, distortion parameter and camera external parameter, keeping the camera external parameter unchanged, and optimizing the camera internal parameter and the distortion parameter.
Optionally, in this embodiment, the storage medium is further configured to store program code for performing the following steps: the preset positions are two, one is at the maximum focal length of the camera, and the other is at the minimum focal length of the camera.
Optionally, in this embodiment, the storage medium is further configured to store program code for performing the following steps: the camera includes a variable focus camera.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: displaying a current position image of the camera at the current position on a display interface; receiving an input operation, wherein the input operation is used for requesting to display a three-dimensional picture corresponding to the current position image; responding to the input operation, displaying a three-dimensional picture corresponding to the current position image on the display interface, wherein the three-dimensional picture is determined according to the corresponding relation between the coordinates in the current position image and the three-dimensional space coordinates, the corresponding relation is determined according to the camera parameters of the camera at the current position, and the camera parameters of the camera at the current position are determined according to the preset position image of the camera at the preset position, the camera parameters at the preset position and the current position image.
Optionally, in this embodiment, the storage medium is further configured to store program code for performing the following steps: and identifying the target object in the three-dimensional picture, and highlighting the identified target object on the display interface.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: receiving a current position image of a camera at a current position, which is sent by client equipment; and feeding back the camera parameters of the camera at the current position to the client device, wherein the camera parameters of the camera at the current position are determined according to the preset bit image of the camera at the preset bit, the camera parameters at the preset bit and the current position image.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: determining camera parameters of the camera at the current position according to a preset position image of the camera at a preset position, camera parameters at the preset position and a first current position image of the camera at the current position; acquiring a second current position image of the camera at the current position; correcting the second current position image by using the camera parameters to obtain a corrected image; when the current position is taken as any one of a plurality of focal length positions of the camera, corrected images corresponding to the plurality of focal length positions are obtained; and generating a three-dimensional graph according to the corrected images corresponding to the plurality of focal length positions respectively, and displaying the generated three-dimensional graph at a preset frame frequency to show the virtual reality scene.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (18)

1. An image processing method, comprising:
acquiring a preset position image of a camera at a preset position and camera parameters at the preset position;
acquiring a current position image of the camera at a current position;
and determining the camera parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position.
2. The method of claim 1, wherein determining the camera parameters of the camera at the current position according to the preset bit image, the current position image and the camera parameters at the preset bits comprises:
determining initial parameters of the camera at the current position according to the preset position image, the current position image and the camera parameters at the preset position;
and optimizing the initial parameters according to the preset position image and the current position image to obtain the camera parameters of the camera at the current position.
3. The method of claim 2, wherein determining initial parameters of the camera at the current position based on the preset bit image, the current position image and the camera parameters at the preset bits comprises:
under the condition that the preset bit images are multiple, selecting a target preset bit image from the multiple preset bit images, wherein the target preset bit image is a preset bit image corresponding to a target preset bit closest to the current position;
obtaining a scaling factor of the target preset position image relative to the current position image;
and determining initial parameters of the camera at the current position according to the zooming factor and camera parameters of the camera at the target preset position.
4. The method of claim 3, wherein selecting the target preset bit image from the plurality of preset bit images comprises:
determining scaling factors of the plurality of preset bit images relative to the current position image;
correcting the scaling factors corresponding to the preset bit images to obtain a plurality of corrected scaling factors;
and determining the target preset bit image according to the plurality of modified scaling factors.
5. The method of claim 4, wherein determining the scaling factor of the plurality of preset bit images relative to the current position image comprises:
respectively carrying out feature matching on the plurality of preset bit images and the current position image to obtain a first feature point set in the current position image and respectively obtain a second feature point set of the plurality of preset bit images;
performing decentralization on the first feature point set to obtain a decentralized first feature point set, and performing decentralization on second feature point sets of the preset bit images respectively to obtain a decentralized second feature point set;
determining homography matrixes between the current position image and the feature points of the plurality of preset bit images respectively according to the decentralized first feature point set and the decentralized second feature point sets corresponding to the plurality of preset bit images respectively;
and respectively determining the scaling factors of the preset bit images relative to the current position image according to the homography matrix between the current position image and the characteristic points of the preset bit images.
6. The method of claim 4,
correcting the scaling factors corresponding to the preset bit images to obtain a plurality of corrected scaling factors, including: when the scaling factor is smaller than 1, taking the scaling factor as a correction scaling factor; when the scaling factor is larger than 1, taking the reciprocal of the scaling factor as a modified scaling factor;
determining the target preset bit image according to the plurality of modified scaling factors, including: determining a maximum value of the plurality of modified scaling factors; and determining the preset bit image corresponding to the maximum value as the target preset bit image.
7. The method of claim 2, wherein optimizing the initial parameters according to the preset bit image and the current position image to obtain the camera parameters of the camera at the current position comprises:
back projecting the second characteristic point in the preset bit image to a camera coordinate system to obtain a first coordinate of the second characteristic point in the preset bit image in the camera coordinate system;
the first coordinate is projected to the image plane of the current position in the forward direction, and a third feature point on the image plane of the current position is obtained;
and optimizing the initial parameters by minimizing the reprojection error of the third characteristic point relative to the first characteristic point in the current position image to obtain the camera parameters of the camera at the current position.
8. The method of claim 2, wherein optimizing the initial parameters comprises:
the initial parameters comprise: and under the conditions of camera internal parameter, distortion parameter and camera external parameter, keeping the camera external parameter unchanged, and optimizing the camera internal parameter and the distortion parameter.
9. The method of any one of claims 1 to 8, wherein the predetermined positions are two, one at a maximum focal length of the camera and the other at a minimum focal length of the camera.
10. The method of claim 9, wherein the camera comprises a variable focus camera.
11. An image processing method, comprising:
displaying a current position image of the camera at a current position on a display interface;
receiving an input operation, wherein the input operation is used for requesting to display a three-dimensional picture corresponding to the current position image;
responding to the input operation, displaying a three-dimensional picture corresponding to the current position image on the display interface, wherein the three-dimensional picture is determined according to a corresponding relation between coordinates in the current position image and three-dimensional space coordinates, the corresponding relation is determined according to camera parameters of the camera at the current position, and the camera parameters of the camera at the current position are determined according to a preset position image of the camera at a preset position, the camera parameters at the preset position and the current position image.
12. The method of claim 11, further comprising:
and identifying a target object in the three-dimensional picture, and highlighting the identified target object on the display interface.
13. An image processing apparatus characterized by comprising:
the camera comprises a first acquisition module, a second acquisition module and a control module, wherein the first acquisition module is used for acquiring a preset position image of a camera at a preset position and camera parameters at the preset position;
the first acquisition module is used for acquiring a current position image of the camera at a current position;
and the first determining module is used for determining the camera parameters of the camera at the current position according to the preset bit image, the current position image and the camera parameters at the preset bit.
14. An image processing apparatus characterized by comprising:
the first display module is used for displaying a current position image of the camera at the current position on a display interface;
a first receiving module, configured to receive an input operation, where the input operation is used to request display of a three-dimensional picture corresponding to the current position image;
and the second display module is used for responding to the input operation and displaying a three-dimensional picture corresponding to the current position image on the display interface, wherein the three-dimensional picture is determined according to a corresponding relation between coordinates in the current position image and three-dimensional space coordinates, the corresponding relation is determined according to camera parameters of the camera at the current position, and the camera parameters of the camera at the current position are determined according to a preset position image of the camera at a preset position, the camera parameters at the preset position and the current position image.
15. A storage medium, characterized in that the storage medium includes a stored program, wherein an apparatus in which the storage medium is located is controlled to execute the image processing method according to any one of claims 1 to 12 when the program is executed.
16. A computer device, comprising: a memory and a processor, wherein the processor is capable of,
the memory stores a computer program;
the processor configured to execute a computer program stored in the memory, the computer program when executed causing the processor to perform the image processing method of any one of claims 1 to 12.
17. An image processing method, comprising:
receiving a current position image of a camera at a current position, which is sent by client equipment;
and feeding back the camera parameters of the camera at the current position to the client device, wherein the camera parameters of the camera at the current position are determined according to the preset position image of the camera at the preset position, the camera parameters at the preset position and the current position image.
18. An image processing method, comprising:
determining camera parameters of a camera at the current position according to a preset position image of the camera at a preset position, camera parameters at the preset position and a first current position image of the camera at the current position;
acquiring a second current position image of the camera at the current position;
correcting the second current position image by using the camera parameters to obtain a corrected image;
when the current position is any one of a plurality of focal length positions of the camera, acquiring corrected images corresponding to the plurality of focal length positions respectively;
and generating a three-dimensional graph according to the corrected images corresponding to the plurality of focal length positions respectively, and displaying the generated three-dimensional graph at a preset frame frequency to show a virtual reality scene.
CN202110150227.4A 2021-02-03 2021-02-03 Image processing method, image processing device, storage medium and computer equipment Pending CN114862958A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110150227.4A CN114862958A (en) 2021-02-03 2021-02-03 Image processing method, image processing device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110150227.4A CN114862958A (en) 2021-02-03 2021-02-03 Image processing method, image processing device, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN114862958A true CN114862958A (en) 2022-08-05

Family

ID=82622910

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110150227.4A Pending CN114862958A (en) 2021-02-03 2021-02-03 Image processing method, image processing device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN114862958A (en)

Similar Documents

Publication Publication Date Title
WO2020001168A1 (en) Three-dimensional reconstruction method, apparatus, and device, and storage medium
JP2019149809A (en) System and method for imaging device modeling and calibration
CN107665483B (en) Calibration-free convenient monocular head fisheye image distortion correction method
US10726580B2 (en) Method and device for calibration
CN105005964B (en) Geographic scenes panorama sketch rapid generation based on video sequence image
CN112288826B (en) Calibration method and device of binocular camera and terminal
CN110136083B (en) Base map updating method and device combined with interaction
CN112862897B (en) Phase-shift encoding circle-based rapid calibration method for camera in out-of-focus state
CN109005334A (en) A kind of imaging method, device, terminal and storage medium
Brückner et al. Intrinsic and extrinsic active self-calibration of multi-camera systems
CN111340737B (en) Image correction method, device and electronic system
CN110111364B (en) Motion detection method and device, electronic equipment and storage medium
CN111385461B (en) Panoramic shooting method and device, camera and mobile terminal
WO2021035627A1 (en) Depth map acquisition method and device, and computer storage medium
CN111507894B (en) Image stitching processing method and device
CN113643414A (en) Three-dimensional image generation method and device, electronic equipment and storage medium
CN112509058B (en) External parameter calculating method, device, electronic equipment and storage medium
CN117495975A (en) Zoom lens calibration method and device and electronic equipment
CN114445583A (en) Data processing method and device, electronic equipment and storage medium
CN106600691B (en) Fusion correction method and system of multi-channel two-dimensional video images in three-dimensional geographic space
CN111432117A (en) Image rectification method, device and electronic system
CN114862958A (en) Image processing method, image processing device, storage medium and computer equipment
CN112233185B (en) Camera calibration method, image registration method, image pickup device and storage device
WO2021208630A1 (en) Calibration method, calibration apparatus and electronic device using same
CN113724141B (en) Image correction method and device and electronic equipment

Legal Events

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