CN111861904A - Equal-proportion fisheye correction method and device, computer equipment and readable storage medium - Google Patents

Equal-proportion fisheye correction method and device, computer equipment and readable storage medium Download PDF

Info

Publication number
CN111861904A
CN111861904A CN202010548836.0A CN202010548836A CN111861904A CN 111861904 A CN111861904 A CN 111861904A CN 202010548836 A CN202010548836 A CN 202010548836A CN 111861904 A CN111861904 A CN 111861904A
Authority
CN
China
Prior art keywords
fisheye
point
image
deflection angle
correction
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
CN202010548836.0A
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.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202010548836.0A priority Critical patent/CN111861904A/en
Publication of CN111861904A publication Critical patent/CN111861904A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/80Geometric correction

Landscapes

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

Abstract

The application relates to a fisheye image correction method, a fisheye image correction device, computer equipment and a readable storage medium with equal proportion, wherein the fisheye image correction method comprises the steps of establishing a fisheye lens coordinate system and a spherical projection plane by acquiring the center coordinates and the radius of a fisheye circle in a fisheye image; calculating a second deflection angle according to the width and the height of a preset fisheye correction output image and the first deflection angle, establishing a correction blank image according to the width and the height of the preset fisheye correction output image, and calculating a mapping point of a correction point on the correction blank image in the fisheye image according to the center coordinate and the radius of a fisheye circle, the width and the height of the fisheye correction output image, the first deflection angle and the second deflection angle; the method has the advantages that the pixel value of the mapping point in the fisheye image is obtained, the pixel value is applied to the correction point, the fisheye correction output image is obtained, the problem of image proportion distortion obtained after the fisheye image is corrected is solved, the fisheye image is restored to the real proportion of a world coordinate system, and the correction effect of the fisheye image is remarkably improved.

Description

Equal-proportion fisheye correction method and device, computer equipment and readable storage medium
Technical Field
The present application relates to the field of image processing, and in particular, to a method, an apparatus, a computer device, and a computer-readable storage medium for correcting proportional fisheyes.
Background
The fisheye lens belongs to one of ultra-wide-angle lenses, and the visual angle of the fisheye lens reaches or exceeds the range which can be seen by human eyes, so that the image acquired by the fisheye lens is greatly different from the real world scene in human eyes, and the fisheye image is generally required to be corrected after being acquired by the fisheye lens. However, in the distortion correction method for the fisheye lens image in the related art, only the mapping relationship between the fisheye image pixel points and the corrected image pixel points is considered, and the aspect ratio of the corrected image is not considered, so that the corrected image is stretched horizontally or longitudinally, the aspect ratio of the original image cannot be well restored, and the image proportion is distorted.
At present, no effective solution is provided for the problem of image proportion distortion obtained after fisheye image correction in the related technology.
Disclosure of Invention
The embodiment of the application provides a method, a device, computer equipment and a computer readable storage medium for correcting an equal proportion fisheye image, so as to at least solve the problem of image proportion distortion obtained after the fisheye image is corrected in the related art.
In a first aspect, an embodiment of the present application provides an equal proportion fisheye image rectification method, where the method includes:
acquiring the center coordinates and the radius of a fisheye circle in the fisheye image, and establishing a fisheye lens coordinate system and a spherical projection plane;
calculating a second deflection angle according to the width and the height of a preset fisheye correction output image and a first deflection angle, and establishing a correction blank image according to the width and the height of the preset fisheye correction output image, wherein the first deflection angle and the second deflection angle are on planes which are vertical to each other;
calculating a mapping point of a correction point on a correction blank image in the fisheye image according to the center coordinate and the radius of the fisheye circle, the width and the height of the fisheye correction output image, the first deflection angle and the second deflection angle;
and acquiring a pixel value of a mapping point in the fisheye image, and applying the pixel value to the correction point to obtain the fisheye correction output image.
In some embodiments, the calculating the second deflection angle according to the preset width and height of the fisheye correction output image and the first deflection angle includes:
the aspect ratio of the preset fisheye correction output image is equal to the ratio of the tangent of one half of the vertical deflection angle to the tangent of one half of the horizontal deflection angle, a second deflection angle is calculated according to the width of the preset fisheye correction output image and the first deflection angle, the second deflection angle is the horizontal deflection angle under the condition that the first deflection angle is the vertical deflection angle, and the first deflection angle is the vertical deflection angle under the condition that the first deflection angle is the horizontal deflection angle.
In some embodiments, the calculating a mapping point of a correction point on a corrected blank image in the fisheye image according to the center coordinates and the radius of the fisheye circle, the width and the height of the fisheye corrected output image, the first deflection angle and the second deflection angle includes:
calculating a position D of a central point of the corrected blank image in the fisheye lens coordinate system, and determining the position of the corrected blank image according to the central point coordinate and a spherical projection surface of the fisheye lens coordinate system, wherein a plane where the corrected blank image is located and the spherical projection surface are tangent to the point D;
calculating the position of the point P in the fisheye lens coordinate system according to the relative position of the point P and the point D in the corrected blank image and the position of the point D in the fisheye lens coordinate system;
and calculating a mapping point M of the point P on the fisheye image according to the position of the point P in the fisheye lens coordinate system.
In some of these embodiments, the calculating the position D of the center point of the corrected blank image in the fisheye lens coordinate system comprises:
and obtaining coordinates of the center point of the corrected blank image, calculating an incident angle and a deflection angle of the center point according to the width and the height of the fisheye corrected output image, the first deflection angle and the second deflection angle, and determining the position of the center point on the spherical projection plane according to the incident angle and the deflection angle.
In some embodiments, the calculating the position of the P point in the fisheye lens coordinate system according to the relative positions of the P point and the D point in the corrected blank image and according to the position of the D point in the fisheye lens coordinate system includes:
in the above-mentionedIn the coordinate system of the fisheye lens, the coordinate of the D point is (x)d,yd,zd) Establishing a UV coordinate system on a plane where the corrected blank image is located, wherein the coordinate of the D point is (u)d,vd);
Acquiring the coordinate (u) of the P point in the corrected blank image in the UV coordinate systemp,vp) According to the coordinates (x) of said D pointd,yd,zd)、(ud,vd) And the coordinates (u) of the P pointp,vp) Calculating the coordinate (x) of the P point in the fisheye lens coordinate systemp,yp,zp)。
In some embodiments, the calculating a mapping point M of the P point on the fisheye image according to the position of the P point in the fisheye lens coordinate system includes:
according to the coordinate (x) of the P point in the fisheye lens coordinate systemp,yp,zp) And trigonometric function relationship calculation
Figure BDA0002541744700000031
Calculating the distance from the point M to the original point in the coordinate system of the fisheye lens according to an equidistant projection formula, wherein the included angle alpha is formed between the included angle alpha and the z axis;
and calculating a projection point Q of the point P on an XY plane, wherein the point M is on a straight line OQ, and calculating the coordinate of the point M according to the distance from the point M to the origin in the fisheye lens coordinate system.
In a second aspect, an embodiment of the present application provides an equal proportion fisheye image rectification apparatus, where the apparatus includes a fisheye lens coordinate system establishment module, a rectification area calculation module, a mapping module, and a drawing module
The fisheye lens coordinate system establishing module is used for acquiring the center coordinates and the radius of a fisheye circle in the fisheye image and establishing a fisheye lens coordinate system and a spherical projection surface;
the correction area calculation module is used for calculating a second deflection angle according to the width and the height of a preset fisheye correction output image and a first deflection angle, and establishing a correction blank image according to the width and the height of the preset fisheye correction output image, wherein the first deflection angle and the second deflection angle are on planes which are vertical to each other;
the mapping module calculates the mapping point of the correction point on the correction blank image in the fisheye image according to the center coordinate and the radius of the fisheye circle, the width and the height of the fisheye correction output image, the first deflection angle and the second deflection angle;
the drawing module is used for obtaining a pixel value of a mapping point in the fisheye image and applying the pixel value to the correction point to obtain the fisheye correction output image.
In some embodiments, the correction zone calculation module is further configured to:
and calculating a second deflection angle according to the preset width-to-width ratio of the fisheye correction output image equal to the ratio of the tangent of one half of the vertical deflection angle to the tangent of one half of the horizontal deflection angle, and according to the preset width-to-height ratio of the fisheye correction output image and a first deflection angle, wherein the second deflection angle is the horizontal deflection angle under the condition that the first deflection angle is the vertical deflection angle, and the first deflection angle is the vertical deflection angle under the condition that the first deflection angle is the horizontal deflection angle.
In a third aspect, the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer program to implement the above-mentioned method for correcting an equiproportional fisheye image.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the method for correcting an equiproportional fisheye image as described above.
Compared with the related art, the fisheye image correction method with equal proportion provided by the embodiment of the application establishes a fisheye lens coordinate system and a spherical projection plane by acquiring the center coordinates and the radius of a fisheye circle in the fisheye image; calculating a second deflection angle according to the width and the height of a preset fisheye correction output image and the first deflection angle, establishing a correction blank image according to the width and the height of the preset fisheye correction output image, and calculating a mapping point of a correction point on the correction blank image in the fisheye image according to the center coordinate and the radius of a fisheye circle, the width and the height of the fisheye correction output image, the first deflection angle and the second deflection angle; the method comprises the steps of obtaining the pixel value of a mapping point in the fisheye image, applying the pixel value to a correction point to obtain the fisheye correction output image, solving the problem of image proportion distortion obtained after the fisheye image is corrected, achieving the purpose of restoring the fisheye image to the real proportion of a world coordinate system, and remarkably improving the correction effect of the fisheye image.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1 is a flow chart of a method for correcting an equi-proportional fisheye image according to an embodiment of the invention;
FIG. 2 is a schematic diagram of a fisheye lens coordinate system according to an embodiment of the invention;
FIG. 3 is a schematic diagram of the vertical deflection angle in the method for fisheye correction in equal scale according to an embodiment of the invention;
FIG. 4 is a schematic diagram of the horizontal deflection angle in the method for fisheye correction in equal scale according to an embodiment of the invention;
FIG. 5 is a schematic diagram of a coordinate system for mapping a fisheye image to a corrected blank image according to an embodiment of the invention;
FIG. 6 is a schematic illustration of a fisheye image according to an embodiment of the invention;
fig. 7 is a fisheye image correction output image according to the related art of the invention;
FIG. 8 is a schematic diagram of a fisheye correction output image in accordance with an embodiment of the invention;
Fig. 9 is a structural diagram of an equal-scale fisheye image rectification device according to an embodiment of the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any inventive step are within the scope of protection of the present application.
It is obvious that the drawings in the following description are only examples or embodiments of the present application, and that it is also possible for a person skilled in the art to apply the present application to other similar contexts on the basis of these drawings without inventive effort. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar words throughout this application are not to be construed as limiting in number, and may refer to the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. Reference to "connected," "coupled," and the like in this application is not intended to be limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as referred to herein means two or more. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. Reference herein to the terms "first," "second," "third," and the like, are merely to distinguish similar objects and do not denote a particular ordering for the objects.
The equal-proportion fisheye image correction method can be applied to an application scene for correcting the image acquired by the fisheye lens.
According to an aspect of the present invention, there is provided an equal proportion fisheye image rectification method, and fig. 1 is a flowchart of the equal proportion fisheye image rectification method according to an embodiment of the present invention, as shown in fig. 1, the method includes:
step S110, obtaining the center coordinates and the radius of a fisheye circle in the fisheye image, and establishing a fisheye lens coordinate system and a spherical projection surface. Fig. 2 is a schematic diagram of a coordinate system of a fisheye lens according to an embodiment of the invention, and as shown in fig. 2, coordinates XO and YO of a center of a fisheye circle in a fisheye diagram, which is a smallest circle capable of containing all imaging content in the fisheye diagram, and a radius R are obtained. J point is a real light source point in a world coordinate system, a connecting line of the J point and the optical center O of the fisheye lens is intersected with the spherical projection plane at a point K, the XOY plane is an image imaging plane of the fisheye lens, and the projection of the point K on the XOY plane is a pixel point of the J point on the fisheye image.
Step S120, calculating a second deflection angle according to the width and the height of the preset fisheye correction output image and the first deflection angle, and establishing a correction blank image according to the width and the height of the preset fisheye correction output image, wherein the first deflection angle and the second deflection angle are on planes which are perpendicular to each other. In step S120, the first deflection angle is one of a horizontal deflection angle and a vertical deflection angle of the fisheye correction output image, and accordingly, the second deflection angle is the other of the horizontal deflection angle and the vertical deflection angle of the fisheye correction output image. The first deflection angle is a preset angle, and the first deflection angle and the second deflection angle correspond to the width-height ratio of the corrected output image, so that the range of the spherical projection surface for correction conforms to the real proportion of a world coordinate system, and the problem of stretching distortion in the conventional fisheye lens image correction method is solved.
In some embodiments, calculating the second deflection angle from the preset width and height of the fisheye correction output image and the first deflection angle comprises: the aspect ratio of the preset fisheye correction output image is equal to the ratio of the tangent of one-half vertical deflection angle to the tangent of one-half horizontal deflection angle, the second deflection angle is calculated according to the width and the first deflection angle of the preset fisheye correction output image, fig. 3 is a schematic diagram of a vertical deflection angle in the equal proportion fisheye correction method according to one embodiment of the invention, fig. 4 is a schematic diagram of a horizontal deflection angle in the equal proportion fisheye correction method according to one embodiment of the invention, as shown in fig. 3 and 4, assuming that the height of the required fisheye correction image is h, the width of the fisheye correction image is w, that is, the height of the correction blank image is h, and the width is w, then the corresponding horizontal offset angle can be calculated according to the vertical offset angle θ, the height h and the width w
Figure BDA0002541744700000065
The detailed steps are as follows:
step S21, determining the distance S between the center point C of the corrected blank image and the optical center O;
step S22, determining the height h and the vertical deflection angle theta of the corrected blank image, and then knowing the height h and the vertical deflection angle theta according to the geometrical relationship
Figure BDA0002541744700000061
Step S23, deflecting angle from horizontal
Figure BDA0002541744700000062
And the geometric relationship between the center c of the correction plane and the distance s from the optical center O of the fisheye lens
Figure BDA0002541744700000063
Step S24, dividing equation 1 and equation 2 in equal proportion, and calculating corresponding horizontal offset angle according to vertical offset angle theta, corrected blank image width w and height h
Figure BDA0002541744700000064
Figure BDA0002541744700000071
Similarly, at a horizontal offset angle
Figure BDA0002541744700000072
When the width w and the height h of the fisheye corrected image are known, the vertical offset angle θ can also be calculated by dividing the fisheye corrected image by equation 1 and equation 2 in an equal proportion.
And step S130, calculating the mapping point of the correction point on the correction blank image in the fisheye image according to the center coordinate and the radius of the fisheye circle, the width and the height of the fisheye correction output image, the first deflection angle and the second deflection angle. For example, the coordinates of a point on a blank image for the correction chart are converted into spherical coordinates according to a longitude and latitude mapping method; rotating the spherical coordinates obtained by conversion by-90 degrees around the Y axis in the space coordinate system to obtain new space coordinates; and calculating the coordinates mapped in the fisheye diagram according to the new space coordinates.
In some embodiments, fig. 5 is a schematic diagram of a mapping coordinate system of a fisheye image and a corrected blank image according to an embodiment of the invention, as shown in fig. 5, a point O is a projection center, a plane projection plane where the corrected blank image is located and a spherical projection plane are tangent to a point D, where D is a geometric center of the plane of the corrected blank image. Theta 1Representing vectors
Figure BDA0002541744700000073
Angle theta with positive direction of z-axis2Is represented by the positive X-axis direction
Figure BDA0002541744700000074
The projection on the XOY plane needs to be rotated counterclockwise by an angle theta1And theta2For the preset angle acquired from the horizontal deflection angle and the vertical deflection angle, in the mapping coordinate system as shown in fig. 5, by θ1And theta2The plane projection surface can be determined, the tangent point D of the plane projection surface and the spherical projection surface can be obtained according to the formula 4, and the position of the point D is obtained, wherein:
Figure BDA0002541744700000075
the two sides of the plane projection plane are parallel to the XOY plane, i.e. the plane on which the final fisheye corrected image is located. The U-axis and the V-axis in the figure represent two coordinate axes of the plane projection plane, and constitute a corrected image plane coordinate system. P is an arbitrary point on the corrected image, and a mapping point M of the point P on the fisheye image can be obtained from the positional relationship between the point P and the point D. In the embodiment, the position of the plane projection surface is determined by determining the tangent point of the plane projection surface where the corrected image is located and the spherical projection surface, and the coordinate of any point on the plane projection surface in the fish-eye coordinate system is determined according to the relative position of the point on the plane projection surface and the tangent point and the coordinate of the tangent point in the fish-eye coordinate system, so that the plane projection surface and the fish-eye coordinate system are mapped one by one, and the image correction is more efficient and accurate.
At itIn some embodiments, the incident angle θ is calculated by formula 5 and formula 61And a yaw angle theta2And then the vector coordinate value of the point D can be obtained by the simultaneous formula 4.
Figure BDA0002541744700000076
Figure BDA0002541744700000077
In the present embodiment, the vertical offset angle θ and the horizontal offset angle are passed
Figure BDA0002541744700000081
And calculating the coordinate position of the point D in the mapping coordinate system, and according to the vertical offset angle and the horizontal offset angle, better restoring the original light source image proportion by the acquired position coordinate of the point D so that the fisheye image is corrected more truly and effectively.
In some of the embodiments, as shown in fig. 5, a UV coordinate system is created on the horizontal projection plane, and the U-axis and the V-axis represent two coordinate axes of the plane projection plane, which constitute the corrected image plane projection plane coordinate system. The coordinates of any point P on the plane projection surface, the point P and the point D on the plane coordinate system of the corrected image are (u)p,vp) And (u)d,vd). And calculating the coordinate of the point P in the fisheye lens coordinate system according to the relative position relation of the point P and the point D in the corrected image plane coordinate system and the coordinate position of the point D in the fisheye lens coordinate system. For example, in order to find the coordinates of the point P on the projection plane of the correction plane in the space coordinate system, the vector is used here
Figure BDA0002541744700000082
Decomposition into vectors
Figure BDA0002541744700000083
Sum vector
Figure BDA0002541744700000084
Two of themThe vectors are parallel to the u-axis and the v-axis, respectively.
From the geometrical relationships it can be derived:
Figure BDA0002541744700000085
Figure BDA0002541744700000086
Figure BDA0002541744700000087
Figure BDA0002541744700000088
Figure BDA0002541744700000089
Figure BDA00025417447000000810
from the above equations 7 to 12, the spatial coordinate system coordinate of the point P on the corrected image plane can be obtained, and the intersection point of the OP and the spherical projection plane is taken as the object point, and the point P is the image point of the object point located on the corrected image plane. In this embodiment, a coordinate system is established for the projection plane of the correction plane, and the relative positions of the P point and the D point are quantized to
Figure BDA00025417447000000811
And
Figure BDA00025417447000000812
the sum of the vectors, thereby making the coordinate calculation process of the point P more efficient and accurate.
In some embodiments, calculating the mapping point M of the point P on the fisheye image according to the position of the point P in the fisheye lens coordinate system includes:
suppose that the unit vectors in the positive directions of the Z axis, X axis and Y axis are Z1,X1,Y1And then:
Figure BDA00025417447000000813
Figure BDA00025417447000000814
Figure BDA00025417447000000815
according to the formula 13, the method can be obtained by using an inverse trigonometric function
Figure BDA00025417447000000816
At an angle alpha to the optical axis. Assuming that the point on the fisheye image corresponding to the P point is M, the point M will be located on the straight line OQ, and therefore, the following can be further obtained by combining equations 14 and 15:
Figure BDA0002541744700000091
combined with equidistant projection model formula rRealIf F θ brings α, then
Figure BDA0002541744700000092
The coordinates of the mapping point M from any point P on the projection plane of the correction plane to the fisheye image can be solved by combining the formula 16 and the formula 17. In the embodiment, a way of calculating the mapping point M of the P point in the fisheye image is provided, by
Figure BDA0002541744700000093
The M point coordinate is calculated by components on an X axis, a Y axis and a Z axis, a trigonometric function relation and an equidistant projection model formula, so that the fisheye image can be corrected more accurately and simply.
Step S140, obtaining a pixel value of a mapping point in the fisheye image, and applying the pixel value to the correction point to obtain a fisheye correction output image. After the position of the M point on the fisheye image is determined, the color value of the M point is used for correcting the P point of the blank image, and therefore the corrected blank image is drawn pixel by pixel to obtain a final fisheye corrected output image. Preferably, the bilinear interpolation of the gray value is performed by using the adjacent 4 pixel points around the M point, the obtained interpolation structure is used as the gray value corresponding to the final image point P, and then the whole fisheye correction output image is obtained through calculation and drawing.
According to the fisheye image correction method with equal proportion, a coordinate system is established through fisheye correction image tangent plane and fisheye lens optical center, the geometric relation between the aspect ratio of the correction image and the vertical offset angle and the horizontal offset angle is defined, the fisheye correction image overcomes the problem of longitudinal or transverse stretching distortion in the traditional method, the real proportion of the world coordinate system is reduced, the fisheye image correction effect is remarkably improved, and the method is suitable for all fisheye images
In one specific embodiment, an equal proportion fisheye correction algorithm comprises the following steps:
step S31, acquiring the center coordinates and the radius of a fisheye circle in the fisheye diagram, and establishing a fisheye lens coordinate system and a spherical projection plane;
step S32, a coordinate system is established through the section of the fisheye corrected image and the optical center of the fisheye lens, a vertical offset angle and the width and the height of the fisheye corrected output image which are needed by people are defined, the corrected horizontal offset angle is determined according to the geometric relation, and a blank corrected image with real proportion restored is created. Step S32 includes:
step S321, determining the distance S between the center point c of the correction plane and the optical center O;
step S322, determining the height h, the width w and the vertical deflection angle theta of the blank correction image;
step S323, calculating the tangent relation between the vertical deflection angle, the horizontal deflection angle and the optical center distance S;
step S324, simultaneous tangent function is performed to solve the horizontal deflection angle corresponding to the corrected image height h
Figure BDA0002541744700000094
And step S33, calculating the mapping point of the correction point on the correction blank image in the fisheye image according to the center coordinates and the radius of the fisheye circle, the width and the height of the fisheye correction output image, the first deflection angle and the second deflection angle.
Step S33 includes:
step S331, determining the position of the plane projection surface of the corrected image;
Step S332, solving the coordinates of the points on the corrected image plane in the space coordinate system;
step S333, the coordinates of the points on the corrected image plane on the fisheye image are solved, and the mapping relation between the points on the corrected blank image and the points on the fisheye image is determined.
In step S34, interpolation is performed based on the pixel values of the corresponding points in the fisheye image and the corresponding points are drawn on the correction blank image, and the fisheye correction output image is drawn.
Fig. 6 is a schematic diagram of a fisheye image according to an embodiment of the invention, fig. 7 is a fisheye image correction output image according to the related art of the invention, fig. 8 is a schematic diagram of a fisheye correction output image according to an embodiment of the invention, as shown in fig. 6, 7 and 8, the above embodiments provide an equal-scale fisheye lens image correction method, which defines the vertical offset angle and the required width and height of the fisheye corrected output image, determining the horizontal offset angle of correction according to the geometric relationship, establishing a coordinate system through the fisheye corrected image section and the optical center of the fisheye lens, by means of coordinate conversion between the fisheye lens coordinate system and the plane coordinate system where the correction plane is located, the fisheye correction image overcomes the problem of stretching distortion in the traditional fisheye image correction method, the real proportion of the world coordinate system is restored, and the correction effect of the fisheye image is remarkably improved.
It should be understood that, although the steps in the above-described flowcharts are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in the above-described flowcharts may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or the stages is not necessarily sequential, but may be performed alternately or alternatingly with other steps or at least a portion of the sub-steps or stages of other steps.
The embodiment also provides an equal proportion fisheye image rectification device, which is used for realizing the method and the embodiment, and the description is omitted for brevity. As used hereinafter, the terms "module," "unit," "subunit," and the like may implement a combination of software and/or hardware for a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 9 is a block diagram of an apparatus for correcting an isometric fisheye image according to an embodiment of the invention, as shown in fig. 9, the apparatus including: a fisheye lens coordinate system establishing module 92, a correction area calculating module 94, a mapping module 96 and a drawing module 98;
the fisheye lens coordinate system establishing module 92 is used for acquiring the center coordinates and the radius of a fisheye circle in the fisheye image, and establishing a fisheye lens coordinate system and a spherical projection plane;
the correction area calculation module 94 is configured to calculate a second deflection angle according to the preset width and height of the fisheye correction output image and the first deflection angle, and establish a correction blank image according to the preset width and height of the fisheye correction output image, where the first deflection angle and the second deflection angle are on planes perpendicular to each other;
the mapping module 96 calculates the mapping point of the correction point on the correction blank image in the fisheye image according to the center coordinate and the radius of the fisheye circle, the width and the height of the fisheye correction output image, the first deflection angle and the second deflection angle;
the rendering module 98 is configured to obtain a pixel value of a mapping point in the fisheye image, and apply the pixel value to the correction point to obtain a fisheye correction output image.
In some of these embodiments, the correction zone calculation module 94 is further configured to:
And calculating a second deflection angle according to the preset width-to-width ratio of the fisheye correction output image equal to the ratio of the tangent of one-half vertical deflection angle to the tangent of one-half horizontal deflection angle, and the first deflection angle, wherein the second deflection angle is a horizontal deflection angle when the first deflection angle is a vertical deflection angle, and the first deflection angle is a vertical deflection angle when the first deflection angle is a horizontal deflection angle.
The fisheye image correction device with equal proportion establishes a fisheye lens coordinate system and a spherical projection surface by acquiring the center coordinates and the radius of a fisheye circle in the fisheye image; calculating a second deflection angle according to the width and the height of a preset fisheye correction output image and the first deflection angle, establishing a correction blank image according to the width and the height of the preset fisheye correction output image, and calculating a mapping point of a correction point on the correction blank image in the fisheye image according to the center coordinate and the radius of a fisheye circle, the width and the height of the fisheye correction output image, the first deflection angle and the second deflection angle; the method comprises the steps of obtaining the pixel value of a mapping point in the fisheye image, applying the pixel value to a correction point to obtain a fisheye correction output image, solving the problem of image proportion distortion obtained after the fisheye image is corrected, achieving the purpose of restoring the fisheye image to the real proportion of a world coordinate system, and remarkably improving the correction effect of the fisheye image.
The above modules may be functional modules or program modules, and may be implemented by software or hardware. For a module implemented by hardware, the modules may be located in the same processor; or the modules can be respectively positioned in different processors in any combination.
According to another aspect of the present invention, there is also provided a computer device, which may be a terminal or a server. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of proportional fisheye correction. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
The computer equipment establishes a fisheye lens coordinate system and a spherical projection surface by acquiring the center coordinates and the radius of a fisheye circle in the fisheye image; calculating a second deflection angle according to the width and the height of a preset fisheye correction output image and the first deflection angle, establishing a correction blank image according to the width and the height of the preset fisheye correction output image, and calculating a mapping point of a correction point on the correction blank image in the fisheye image according to the center coordinate and the radius of a fisheye circle, the width and the height of the fisheye correction output image, the first deflection angle and the second deflection angle; the method comprises the steps of obtaining the pixel value of a mapping point in the fisheye image, applying the pixel value to a correction point to obtain a fisheye correction output image, solving the problem of image proportion distortion obtained after the fisheye image is corrected, achieving the purpose of restoring the fisheye image to the real proportion of a world coordinate system, and remarkably improving the correction effect of the fisheye image.
In addition, in combination with the proportional fisheye correction method in the foregoing embodiments, the embodiments of the present application may provide a computer-readable storage medium to implement. The computer readable storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any of the above-described embodiments of the method for proportional fisheye correction.
The computer-readable storage medium establishes a fisheye lens coordinate system and a spherical projection plane by acquiring the center coordinates and the radius of a fisheye circle in the fisheye image; calculating a second deflection angle according to the width and the height of a preset fisheye correction output image and the first deflection angle, establishing a correction blank image according to the width and the height of the preset fisheye correction output image, and calculating a mapping point of a correction point on the correction blank image in the fisheye image according to the center coordinate and the radius of a fisheye circle, the width and the height of the fisheye correction output image, the first deflection angle and the second deflection angle; the method comprises the steps of obtaining the pixel value of a mapping point in the fisheye image, applying the pixel value to a correction point to obtain a fisheye correction output image, solving the problem of image proportion distortion obtained after the fisheye image is corrected, achieving the purpose of restoring the fisheye image to the real proportion of a world coordinate system, and remarkably improving the correction effect of the fisheye image.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. An equal-proportion fisheye image rectification method is characterized by comprising the following steps:
acquiring the center coordinates and the radius of a fisheye circle in the fisheye image, and establishing a fisheye lens coordinate system and a spherical projection plane;
calculating a second deflection angle according to the width and the height of a preset fisheye correction output image and a first deflection angle, and establishing a correction blank image according to the width and the height of the preset fisheye correction output image, wherein the first deflection angle and the second deflection angle are on planes which are vertical to each other;
Calculating a mapping point of a correction point on a correction blank image in the fisheye image according to the center coordinate and the radius of the fisheye circle, the width and the height of the fisheye correction output image, the first deflection angle and the second deflection angle;
and acquiring a pixel value of a mapping point in the fisheye image, and applying the pixel value to the correction point to obtain the fisheye correction output image.
2. The method of correcting an equiproportional fisheye image according to claim 1, wherein the calculating a second deflection angle from a preset width and a first deflection angle of the fisheye corrected output image comprises:
the aspect ratio of the preset fisheye correction output image is equal to the ratio of the tangent of one half of the vertical deflection angle to the tangent of one half of the horizontal deflection angle, a second deflection angle is calculated according to the width of the preset fisheye correction output image and the first deflection angle, the second deflection angle is the horizontal deflection angle under the condition that the first deflection angle is the vertical deflection angle, and the first deflection angle is the vertical deflection angle under the condition that the first deflection angle is the horizontal deflection angle.
3. The method for correcting an equi-proportional fisheye image according to claim 1, wherein the calculating of the mapping point of the correction point on the correction blank image in the fisheye image from the center coordinates and radius of the fisheye circle, the width and height of the fisheye correction output image, the first deflection angle and the second deflection angle comprises:
Calculating the position D of the center point of the corrected blank image in the fisheye lens coordinate system, and determining the position of the corrected blank image according to the coordinate of the center point and the spherical projection surface of the fisheye lens coordinate system, wherein the plane where the corrected blank image is located and the spherical projection surface are tangent to the point D;
calculating the position of the point P in the fisheye lens coordinate system according to the relative position of the point P and the point D in the corrected blank image and the position of the point D in the fisheye lens coordinate system;
and calculating a mapping point M of the point P on the fisheye image according to the position of the point P in the fisheye lens coordinate system.
4. The method according to claim 3, wherein the calculating the position D of the center point of the corrected blank image in the fisheye lens coordinate system comprises:
and obtaining coordinates of the center point of the corrected blank image, calculating an incident angle and a deflection angle of the center point according to the width and the height of the fisheye corrected output image, the first deflection angle and the second deflection angle, and determining the position of the center point on the spherical projection plane according to the incident angle and the deflection angle.
5. The method for correcting an equi-proportional fisheye image according to claim 3, wherein the calculating the position of the P point in the fisheye lens coordinate system according to the relative positions of the P point and the D point in the corrected blank image and according to the position of the D point in the fisheye lens coordinate system comprises:
in the fisheye lens coordinate system, the coordinate of the D point is (x)d,yd,zd) Establishing a UV coordinate system on a plane where the corrected blank image is located, wherein the coordinate of the D point is (u)d,vd);
Acquiring the coordinate (u) of the P point in the corrected blank image in the UV coordinate systemp,vp) According to the coordinates (x) of said D pointd,yd,zd)、(ud,vd) And the coordinates (u) of the P pointp,vp) Calculating the coordinate (x) of the P point in the fisheye lens coordinate systemp,yp,zp)。
6. The method for correcting an equiproportional fisheye image according to claim 5, wherein the calculating the mapping point M of the point P on the fisheye image according to the position of the point P in the fisheye lens coordinate system comprises:
according to the coordinate (x) of the P point in the fisheye lens coordinate systemp,yp,zp) And trigonometric function relationship calculation
Figure FDA0002541744690000021
Calculating the distance from the point M to the original point in the coordinate system of the fisheye lens according to an equidistant projection formula, wherein the included angle alpha is formed between the included angle alpha and the z axis;
And calculating a projection point Q of the point P on an XY plane, wherein the point M is on a straight line OQ, and calculating the coordinate of the point M according to the distance from the point M to the origin in the fisheye lens coordinate system.
7. The device for correcting the fisheye image in equal proportion is characterized by comprising a fisheye lens coordinate system establishing module, a correction area calculating module, a mapping module and a drawing module
The fisheye lens coordinate system establishing module is used for acquiring the center coordinates and the radius of a fisheye circle in the fisheye image and establishing a fisheye lens coordinate system and a spherical projection surface;
the correction area calculation module is used for calculating a second deflection angle according to the width and the height of a preset fisheye correction output image and a first deflection angle, and establishing a correction blank image according to the width and the height of the preset fisheye correction output image, wherein the first deflection angle and the second deflection angle are on planes which are vertical to each other;
the mapping module calculates the mapping point of the correction point on the correction blank image in the fisheye image according to the center coordinate and the radius of the fisheye circle, the width and the height of the fisheye correction output image, the first deflection angle and the second deflection angle;
the drawing module is used for obtaining a pixel value of a mapping point in the fisheye image and applying the pixel value to the correction point to obtain the fisheye correction output image.
8. The apparatus of claim 7, wherein the correction region calculation module is further configured to:
and calculating a second deflection angle according to the preset width-to-width ratio of the fisheye correction output image equal to the ratio of the tangent of one half of the vertical deflection angle to the tangent of one half of the horizontal deflection angle, and according to the preset width-to-height ratio of the fisheye correction output image and a first deflection angle, wherein the second deflection angle is the horizontal deflection angle under the condition that the first deflection angle is the vertical deflection angle, and the first deflection angle is the vertical deflection angle under the condition that the first deflection angle is the horizontal deflection angle.
9. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor when executing the computer program implements the method for isometric fisheye image rectification of any one of claims 1 to 6.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the method for correcting an equiproportional fisheye image according to any of claims 1 to 6.
CN202010548836.0A 2020-06-16 2020-06-16 Equal-proportion fisheye correction method and device, computer equipment and readable storage medium Pending CN111861904A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010548836.0A CN111861904A (en) 2020-06-16 2020-06-16 Equal-proportion fisheye correction method and device, computer equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010548836.0A CN111861904A (en) 2020-06-16 2020-06-16 Equal-proportion fisheye correction method and device, computer equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN111861904A true CN111861904A (en) 2020-10-30

Family

ID=72987685

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010548836.0A Pending CN111861904A (en) 2020-06-16 2020-06-16 Equal-proportion fisheye correction method and device, computer equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN111861904A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112465696A (en) * 2020-12-04 2021-03-09 中国科学院深圳先进技术研究院 Panoramic presentation method and device
CN113409262A (en) * 2021-06-15 2021-09-17 苏州芯迈智能科技有限公司 PCB probe positioning method and device, graphic processor and storage medium
CN116739924A (en) * 2023-06-06 2023-09-12 中国人民解放军国防科技大学 Sequential observation image geometric correction method based on equivalent offset angle sparse measurement

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106780389A (en) * 2016-12-23 2017-05-31 浙江宇视科技有限公司 A kind of fisheye image correcting method and device based on Coordinate Conversion
US20190012766A1 (en) * 2016-06-17 2019-01-10 Nec Corporation Image processing device, image processing method, and storage medium
CN109308686A (en) * 2018-08-16 2019-02-05 北京市商汤科技开发有限公司 A kind of fish eye images processing method and processing device, equipment and storage medium
CN109544458A (en) * 2018-11-21 2019-03-29 陕西高速公路工程试验检测有限公司 Fisheye image correcting method, device and its storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190012766A1 (en) * 2016-06-17 2019-01-10 Nec Corporation Image processing device, image processing method, and storage medium
CN106780389A (en) * 2016-12-23 2017-05-31 浙江宇视科技有限公司 A kind of fisheye image correcting method and device based on Coordinate Conversion
CN109308686A (en) * 2018-08-16 2019-02-05 北京市商汤科技开发有限公司 A kind of fish eye images processing method and processing device, equipment and storage medium
CN109544458A (en) * 2018-11-21 2019-03-29 陕西高速公路工程试验检测有限公司 Fisheye image correcting method, device and its storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112465696A (en) * 2020-12-04 2021-03-09 中国科学院深圳先进技术研究院 Panoramic presentation method and device
CN113409262A (en) * 2021-06-15 2021-09-17 苏州芯迈智能科技有限公司 PCB probe positioning method and device, graphic processor and storage medium
CN116739924A (en) * 2023-06-06 2023-09-12 中国人民解放军国防科技大学 Sequential observation image geometric correction method based on equivalent offset angle sparse measurement
CN116739924B (en) * 2023-06-06 2024-05-03 中国人民解放军国防科技大学 Sequential observation image geometric correction method based on equivalent offset angle sparse measurement

Similar Documents

Publication Publication Date Title
CN111968235B (en) Object attitude estimation method, device and system and computer equipment
WO2017113731A1 (en) 360-degree panoramic displaying method and displaying module, and mobile terminal
US8730323B2 (en) Image converter
CN108198141B (en) Image processing method and device for realizing face thinning special effect and computing equipment
US20190251675A1 (en) Image processing method, image processing device and storage medium
EP3971841A1 (en) Three-dimensional model generation method and apparatus, and computer device and storage medium
CN111428579A (en) Face image acquisition method and system
CN112733797B (en) Method, device and equipment for correcting sight of face image and storage medium
CN109584168B (en) Image processing method and apparatus, electronic device, and computer storage medium
CN110059691B (en) Multi-view distorted document image geometric correction method based on mobile terminal
CN114143528B (en) Multi-video stream fusion method, electronic device and storage medium
CN111861904A (en) Equal-proportion fisheye correction method and device, computer equipment and readable storage medium
CN112509106A (en) Document picture flattening method, device and equipment
CN113838138A (en) System calibration method, system, device and medium for optimizing feature extraction
CN113610864B (en) Image processing method, device, electronic equipment and computer readable storage medium
CN116051737A (en) Image generation method, device, equipment and storage medium
CN115375543A (en) Image processing method and device, electronic equipment and storage medium
CN114862866A (en) Calibration plate detection method and device, computer equipment and storage medium
CN112308778B (en) Method and terminal for assisting panoramic camera splicing by utilizing spatial three-dimensional information
CN113570659A (en) Shooting device pose estimation method and device, computer equipment and storage medium
CN110786017B (en) Distributed image generation method
CN109003327B (en) Image processing method, image processing device, computer equipment and storage medium
CN113724141A (en) Image correction method and device and electronic equipment
CN111556304A (en) Panoramic image processing method, device and system
CN113470154B (en) Image processing method, device, electronic equipment and storage medium

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