Disclosure of Invention
Based on this, it is necessary to provide a projected image correction method, a projection system, and a readable storage medium, which solve the problems of the related art that the correction of a projected image takes a long time, the correction accuracy is low, and the versatility is poor.
The embodiment of the application provides a projected image correction method, which comprises the following steps: projecting a projection image on a projection plane, wherein the projection image comprises a plurality of calibration points; obtaining the relative position relation between the calibration point and the projection origin; acquiring a correction parameter according to the relative position relation between the calibration point and the projection origin; the projection image is corrected according to the correction parameters.
In one embodiment, a projection image is formed using a first polygon projection, the projection image including a second polygon corresponding to the first polygon, and the index points include vertices of the second polygon.
In one embodiment, the first polygon has a first center point at a central position, and the projection image further comprises a second center point corresponding to the first center point.
In one embodiment, the step of obtaining the relative position relationship between the calibration point and the projection origin comprises: and establishing a coordinate system by taking the projection origin as an origin, the axis in the projection direction as a z-axis, the axis in the horizontal direction in a plane perpendicular to the projection direction as an x-axis and the axis in the vertical direction in the plane perpendicular to the projection direction as a y-axis, and acquiring the x-axis coordinate, the y-axis coordinate and the z-axis coordinate of the calibration point in the coordinate system.
In one embodiment, the step of obtaining the x-axis coordinate, the y-axis coordinate, and the z-axis coordinate of the calibration point in the coordinate system comprises: taking the component of the distance between the vertex of the second polygon and the second central point in the x-axis direction as the x-axis coordinate x of the calibration point in the coordinate system1(ii) a Taking the component of the distance between the vertex of the second polygon and the second central point in the y-axis direction as the y-axis coordinate y of the calibration point in the coordinate system1(ii) a Projecting a contrast image on a preset plane vertical to the projection direction, wherein the contrast image comprises a plurality of contrast vertexes; acquiring coordinates of the comparison vertex in a coordinate system; calculating z-axis coordinate z of vertex of the second polygon corresponding to the contrasting vertex1。
In one embodiment, the component x in the x-axis direction is the distance of the comparison vertex from the center point0As the x-axis coordinate of the contrasting vertex in the coordinate system, the distance z of the preset plane from the projection origin0As a z-axis coordinate of the contrasting vertex in the coordinate system, then z1=x1*z0/x0。
In one embodiment, the step of obtaining the correction parameter according to the relative position relationship between the calibration point and the projection origin comprises: and calculating the normal vector of the projection plane according to the x-axis coordinate, the y-axis coordinate and the z-axis coordinate of the calibration point in the coordinate system.
In one embodiment, the step of correcting the projection image according to the correction parameters comprises: calculating included angles between the projection plane and an x axis, a y axis and a z axis according to the normal vector; and deflecting the projection plane along the x axis, the y axis and the z axis respectively according to the included angles of the projection plane and the x axis, the y axis and the z axis, so that the included angles of the projection plane and the x axis, the y axis and the z axis are all 0.
An embodiment of the present application further provides a projection system, including: a projection device having a projection origin, the projection device for projecting a projection image, the projection image including a plurality of index points; the camera device is arranged on one side of the projection device and is used for shooting a projection image to acquire the relative position relation between the calibration point and the projection origin; and an arithmetic device comprising a memory and a processor, the memory storing a computer program, the processor implementing the steps of the method when executing the computer program.
Embodiments of the present application also provide a readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the method as described above.
Based on the projected image correction method, the projection system and the readable storage medium of the embodiment of the application, the relative position relationship between the plurality of calibration points and the projection origin in the projected image is obtained, the correction parameter is obtained according to the relative position relationship, and finally the projected image is corrected by using the correction parameter without manually adjusting the position of the projector, so that the time consumed in the correction process is greatly reduced, the correction process is more convenient and faster, and the correction precision is relatively higher. Moreover, the correction method can be used for correcting the projected image from a plurality of different angles, can be suitable for a plurality of different scenes, and has strong universality.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, embodiments accompanying the present application are described in detail below with reference to the accompanying drawings. In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is capable of embodiments in many different forms than those described herein and that modifications may be made by one skilled in the art without departing from the spirit and scope of the application and it is therefore not intended to be limited to the specific embodiments disclosed below.
In the description of the present application, it is to be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," "circumferential," and the like are used in the orientations and positional relationships indicated in the drawings for convenience in describing the present application and for simplicity in description, and are not intended to indicate or imply that the referenced devices or elements must have a particular orientation, be constructed and operated in a particular orientation, and are therefore not to be considered limiting of the present application.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
In this application, unless expressly stated or limited otherwise, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can include, for example, fixed connections, removable connections, or integral parts; can be mechanically or electrically connected; they may be directly connected or indirectly connected through intervening media, or they may be connected internally or in any other suitable relationship, unless expressly stated otherwise. The specific meaning of the above terms in the present application can be understood by those of ordinary skill in the art as appropriate.
In this application, unless expressly stated or limited otherwise, the first feature "on" or "under" the second feature may be directly contacting the first and second features or indirectly contacting the first and second features through intervening media. Also, a first feature "on," "over," and "above" a second feature may be directly or diagonally above the second feature, or may simply indicate that the first feature is at a higher level than the second feature. A first feature being "under," "below," and "beneath" a second feature may be directly under or obliquely under the first feature, or may simply mean that the first feature is at a lesser elevation than the second feature.
It will be understood that when an element is referred to as being "secured to" or "disposed on" another element, it can be directly on the other element or intervening elements may also be present. When an element is referred to as being "connected" to another element, it can be directly connected to the other element or intervening elements may also be present. The terms "vertical," "horizontal," "upper," "lower," "left," "right," and the like as used herein are for illustrative purposes only and do not denote a unique embodiment.
In order to make the shape of the projected image projected by the projector consistent with the shape of the original image, the relative angle between the projection direction and the projection plane needs to be adjusted, so that the projection direction and the projection plane are kept as vertical as possible, the projected image can be well corrected, and the use experience of the projector is improved. In the related art, one method is to correct the projected image by manually adjusting the position of the projector, and the problems are that the correction takes a long time, the correction accuracy is low, and an ideal result cannot be achieved. In addition, a gravity sensor can be used for correcting the projected image, and the problem that the correction can be performed only at one angle is solved, so that the universality is poor.
Fig. 1 is a simplified schematic structural diagram of a projection system 10 according to an embodiment of the present application, fig. 2 is a schematic structural diagram of a projected image 110 in the projection system 10 according to an embodiment of the present application, and fig. 3 is a block diagram of a computing device 300 in the projection system 10 according to an embodiment of the present application.
In order to at least partially solve the above problem, referring to fig. 1 to fig. 3, an embodiment of the application provides a projection system 10, where the projection system 10 includes a projection device 100, an image capturing device 200, and a computing device 300.
The projection apparatus 100 has a projection origin O, and the projection apparatus 100 projects the projection image 110 from the projection origin O. The shape and size of the projection image 110 depend on the shape and size of the original image, the distance and relative angle between the projection device 100 and the projection surface, and the like. In order to meet the use requirements in different scenes, the original image and the projected image 110 may be any regular or irregular images, and in order to facilitate the correction of the projected image 110, so that the shape of the projected image 110 is consistent with the shape of the original image, and the use experience of the projector is improved, the projected image 110 includes a plurality of calibration points P, and the calibration points P may be used as reference points when the projected image 110 is corrected. Note that the calibration point P is a plurality of points manually selected from the projection image 110, and the position, number, and the like of the points can be flexibly adjusted, which is not particularly limited herein.
The imaging device 200 is provided on one side of the projection device 100, and the imaging device 200 is used to capture the projection image 110 to obtain the relative positional relationship between the calibration point P and the projection origin O. The image capturing device 200 may be any device having a shooting function, such as a camera, a video camera, a mobile phone, and the like, in some embodiments, the image capturing device 200 is disposed at one side of the projection device 100, and is disposed adjacent to the projection device 100, and shoots towards the projection direction of the projection device 100, so as to obtain image information of the calibration point P, and after analyzing and calculating the image information, the relative position relationship between the calibration point P and the projection origin O can be obtained.
The computing device 300 comprises a memory 310 and a processor 320, the memory 310 storing a computer program 410, the processor 320 implementing the steps of the method for correcting the projected image 110 as described below when executing the computer program 410 for correcting the projected image 110. The method for correcting the projection image 110 in the embodiment of the present application will be described below with reference to the projection system 10.
Fig. 4 is a flowchart of a method for correcting the projected image 110 according to an embodiment of the present application, and fig. 5 is a schematic diagram of a method for correcting the projected image 110 according to an embodiment of the present application when calculating a z-axis coordinate of a vertex of the second polygon corresponding to the vertex of the contrast.
Referring to fig. 1 to 5, an embodiment of the present application provides a method for correcting a projected image 110, where the method for correcting the projected image 110 includes the following steps:
s102, a projection image 110 is projected on a projection plane, and the projection image 110 includes a plurality of calibration points P.
The projection plane is an arbitrary plane facing the projection apparatus 100, and if the projection plane is not perpendicular to the projection direction of the projection apparatus 100, the projection image 110 on the projection plane is deformed, so that the shape of the projection image 110 does not coincide with the shape of the original image, which affects normal viewing, and therefore, the projection image 110 needs to be corrected.
S104, acquiring the relative position relation between the calibration point P and the projection origin O.
Since the imaging device 200 is disposed at the position of the projection origin O of the projection device 100, the imaging device 200 can capture the projection image 110 to obtain the image information of the calibration point P, and the relative position relationship between the calibration point P and the projection origin O can be obtained by analyzing and calculating the image information.
And S106, acquiring a correction parameter according to the relative position relation between the calibration point P and the projection origin O.
After the relative position relation between the calibration point P and the projection origin O is obtained, the correction parameters can be obtained by establishing a mathematical relation or searching a database. The correction parameter may be a deflection angle of the projection plane with respect to the projection direction of the projection apparatus 100, or a coordinate position of the calibration point P on the projection image 110 with respect to the projection origin O, or a perspective transformation coefficient for deforming the projection image 110 with respect to the projection origin O, or a point map for deforming the projection image 110 with respect to the projection origin O, or the like.
S108, correcting the projection image 110 according to the correction parameters.
By correcting the projection image 110 according to the correction parameters acquired in step S106, the shape of the projection image 110 can be kept consistent with the shape of the original image, and the use experience of the projector can be improved.
According to the projected image 110 correction method provided by the embodiment of the application, the relative position relationship between the plurality of calibration points P in the projected image 110 and the projection origin O is obtained, the correction parameters are obtained according to the relative position relationship, and finally the projected image 110 is corrected by using the correction parameters without manually adjusting the position of the projector, so that the time consumed in the correction process is greatly reduced, the correction process is more convenient and faster, and the correction precision is relatively high. Moreover, the projection image 110 can be corrected from a plurality of different angles by adopting the correction method, and the correction method is suitable for a plurality of different scenes and has strong universality.
To facilitate implementation of the projected image 110 correction method, in some embodiments, the projected image 110 is formed using a first polygon projected in the projection device 100. The first polygon is a closed figure formed by sequentially connecting three or more line segments end to end in a plane, and includes a triangle, a quadrangle, a pentagon, and the like, the projection image 110 includes a second polygon corresponding to the first polygon, and the number of side lengths of the second polygon is equal to that of the first polygon, so that the vertex of the second polygon can be used as the calibration point P, and the position information of the calibration point P can be conveniently obtained.
On the basis of the above embodiment, further, the first polygon has a first center point located at the center position, and the projection image 110 further includes a second center point k corresponding to the first center point. As shown in fig. 1 and 2, in the present embodiment, the first polygon is a rectangle, and the second polygon is a trapezoid corresponding to the rectangle.
The imaging device 200 captures the projection image 110 to obtain image information of the calibration point P, and after analyzing and calculating the image information, the relative positional relationship between the calibration point P and the projection origin O can be obtained. Specifically, in some embodiments, step S104 includes:
firstly, a coordinate system is established by taking a projection origin O as an origin, an axis in a projection direction as a z-axis, an axis in a horizontal direction in a plane perpendicular to the projection direction as an x-axis, and an axis in a vertical direction in the plane perpendicular to the projection direction as a y-axis.
Then, the component of the distance of the vertex of the second polygon from the second center point k in the x-axis direction is taken as the x-axis coordinate x of the calibration point P in the coordinate system1. Taking the component of the distance between the vertex of the second polygon and the second center point k in the y-axis direction as the y-axis coordinate y of the calibration point P in the coordinate system1. Wherein the second isThe distance between the vertex of the polygon and the second center point k may be measured in the projection system 10, and both the component of the polygon in the x-axis direction and the component of the polygon in the y-axis direction may be calculated according to the distance between the vertex of the second polygon and the second center point k, and the included angle between the line connecting the vertex of the second polygon and the second center point k and the x-axis and the y-axis, or the distance between the vertex of the second polygon and the x-axis and the distance between the vertex of the second polygon and the y-axis may be directly measured. As shown in FIG. 2, the coordinates of the four vertices of the second polygon in the xoy plane are p1(x1,y1)、p2(x2,y2)、p3(x3,y3)、p4(x4,y4)。
The contrast image 120 is projected on a predetermined plane perpendicular to the projection direction, and the contrast image 120 includes a plurality of contrast vertexes. Since the preset plane is perpendicular to the projection direction of the projection apparatus 100, the shape of the comparison image 120 and the shape of the first polygon are kept consistent as a rectangle, and the distance d from the projection origin O of the preset plane is measured, and the length and the width of the comparison image 120 are L, W respectively. Since both the projection image 110 and the contrast image 120 are projected from the original image, the number of contrast vertices in the contrast image 120 is equal to the number of the calibration points P, and the contrast vertices correspond to the calibration points P one to one.
Calculating z-axis coordinate z of vertex of the second polygon corresponding to the contrasting vertex1. Component x in the x-axis direction by the distance of the comparison vertex from the center point0As the x-axis coordinate of the contrasting vertex in the coordinate system, the distance z of the preset plane from the projection origin O0As a z-axis coordinate of the contrasting vertex in the coordinate system, then z1=x1*z0/x0。
The coordinates (L/2, W/2, d) of the contrasting vertex in the coordinate system can be known, as shown in fig. 1 and 5, in the xoz plane or the yoz plane, the projection origin O, the calibration point P and the contrasting vertex are connected in sequence, and according to the similarity principle of the triangle, the following can be obtained: z is a radical of1/d=x1L/2) where x1In the above step, it has been found that d and L are knownA value, then z is calculated1=x1d/(L/2), the vertex p of the second polygon can be obtained1Coordinate p in a coordinate system1(x1,y1,z1) Similarly, it can be obtained that the coordinates of the four vertices of the second polygon in the coordinate system are p respectively1(x1,y1,z1)、p2(x2,y2,z2)、p3(x3,y3,z3)、p4(x4,y4,z4)。
Thus, step S106 includes: and calculating the normal vector of the projection plane according to the x-axis coordinate, the y-axis coordinate and the z-axis coordinate of the calibration point P in the coordinate system. In particular, due to the fact that the point Pp is marked in the
projection image 110 on the projection plane
1、p
2、p
3、p
4The coordinates of (a) are known, the plane equation of the projection plane is a (x-x)
1)+b(y-y
1)+c(z-z
1) 0. Using vectors
And
by the outer product of (2), the normal vector of the projection plane can be obtained
Wherein the content of the first and second substances,
is a unit vector of the x-axis,
is a unit vector of the z-axis,
is the unit vector of the z-axis. The method is simplified to obtain:
wherein a ═ y
2-y
3)*(z
2-z
4)-(z
2-z
3)*(y
2-y
4),b=(z
2-z
3)*(x
2-x
4)-(x
2-x
3)*(z
2-z
4),c=(x
2-x
3)*(y
2-y
4)-(y
2-y
3)*(x
2-x
4). The angle at which the projection plane is shifted in the x-axis direction is represented by θ
xThe angle of deviation of the projection plane in the y-axis direction is set to θ
yThe angle at which the projection plane is offset in the z-axis direction is set to θ
zThen, according to the mathematical relationship:
in addition to the above-described embodiments, the angle at which the projection plane is shifted in the x-axis direction can be calculated from the above-described equation as θ
xThe angle of deviation of the projection plane in the y-axis direction is set to θ
yAnd an angle offset from the projection plane in the z-axis direction is set to θ
z. Therefore, step S108 includes: calculating included angles between the projection plane and an x axis, a y axis and a z axis according to the normal vector; and deflecting the projection plane along the x axis, the y axis and the z axis respectively according to the included angles of the projection plane and the x axis, the y axis and the z axis, so that the included angles of the projection plane and the x axis, the y axis and the z axis are all 0. The coordinates (x ', y ', z ') corrected for the
projection image 110 and the coordinates (x, y, z) of the
projection image 110 in the projection plane satisfy the following relational expression:
wherein the content of the first and second substances,
the following examples are given by substituting specific numerical values.
Example one
A
rectangular contrast image 120 is projected on a predetermined plane perpendicular to the projection direction, in this embodiment, the distance d between the predetermined plane and the projection origin O is 500mm, the length L of the
contrast image 120 is 40mm, and the width W of the
contrast image 120 is 30 mm. Projecting a projected
image 110 on a projection plane, wherein the projected
image 110 is a quadrangle, the calibration points P of the projected
image 110 are four vertexes of the quadrangle, and the coordinates of the four vertexes of the quadrangle are calculated as: (x)
1,y
1,z
1)=(-22,16.5,550),(x
2,y
2,z
2)=(19.4,16.005,485),(x
3,y
3,z
3)=(22.4,16.8,560),(x
4,y
4,z
4)=(-18.8,41.1,470),a=(y
2-y
3)*(z
2-z
4)-(z
2-z
3)*(y
2-y
4)=130.95,b=(z
2-z
3)*(x
2-x
4)-(x
2-x
3)*(z
2-z
4)=-1353.6,c=(x
2-x
3)*(y
2-y
4)-(y
2-y
3)*(x
2-x
4) 24.654, then
Example two
A
rectangular contrast image 120 is projected on a preset plane perpendicular to the projection direction, in this embodiment, the distance d between the preset plane and the projection origin O is 250mm, the length L of the
contrast image 120 is 20mm, and the width W of the
contrast image 120 is 10 mm. Projecting a projected
image 110 on a projection plane, the projected
image 110 being a quadrangle, and the calibration of the projected image 110The point P is four vertexes of the quadrangle, and the coordinates of the four vertexes of the quadrangle are calculated as follows: (x)
1,y
1,z
1)=(-9.5,4.75,237.5),(x
2,y
2,z
2)=(11.5,5.4625,287.5),(x
3,y
3,z
3)=(9.8,4.9,245),(x
4,y
4,z
4)=(-11.3,5.65,282.5),a=(y
2-y
3)*(z
2-z
4)-(z
2-z
3)*(y
2-y
4)=10.7813,b=(z
2-z
3)*(x
2-x
4)-(x
2-x
3)*(z
2-z
4)=461.04,c=(x
2-x
3)*(y
2-y
4)-(y
2-y
3)*(x
2-x
4) When becoming-13.1438, then
EXAMPLE III
A
rectangular contrast image 120 is projected on a preset plane perpendicular to the projection direction, in this embodiment, the distance d between the preset plane and the projection origin O is 600mm, the length L of the
contrast image 120 is 100mm, and the width W of the
contrast image 120 is 50 mm. Projecting a projected
image 110 on a projection plane, wherein the projected
image 110 is a quadrangle, the calibration points P of the projected
image 110 are four vertexes of the quadrangle, and the coordinates of the four vertexes of the quadrangle are calculated as: (x)
1,y
1,z
1)=(-55,27.5,660),(x
2,y
2,z
2)=(60,33,720),(x
3,y
3,z
3)=(49,24.5,588),(x
4,y
4,z
4)=(-47.5,23.75,570),a=(y
2-y
3)*(z
2-z
4)-(z
2-z
3)*(y
2-y
4)=54,b=(z
2-z
3)*(x
2-x
4)-(x
2-x
3)*(z
2-z
4)=5747.5,c=(x
2-x
3)*(y
2-y
4)-(y
2-y
3)*(x
2-x
4) If is-812, then
Fig. 6 is a block diagram of a readable storage medium 400 according to an embodiment of the present application.
Referring to fig. 6, an embodiment of the present application further provides a readable storage medium 400, on which a computer program 410 is stored, and the computer program 410 implements the steps of the method as described above when being executed by the processor 320. The detailed methods are described above and will not be described herein. As can be seen from the above description, the computer program 410 in this embodiment is used to correct the projected image 110 without manually adjusting the position of the projector, which greatly reduces the time consumed by the correction process, and the correction process is more convenient and faster, and the correction accuracy is relatively higher. Moreover, the projection image 110 can be corrected from a plurality of different angles by adopting the correction method, and the correction method is suitable for a plurality of different scenes and has strong universality.
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 claims. 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.