Disclosure of Invention
The present invention provides a projector picture correction method, a projector picture correction device and a projector, aiming at the defects of the prior art.
The technical scheme for solving the technical problems is as follows:
a projector picture correction method comprises the following steps:
projecting a projection picture to a curtain, so that all vertexes of the projection picture are projected in the curtain;
acquiring an image containing the curtain and the projection picture;
constructing a graph R3 of an undistorted projection picture in the image, and transforming the graph R2 of the projection picture to the graph R3 to obtain a transformation matrix;
transforming the graph R1 of the curtain according to the transformation matrix to obtain a graph R4;
respectively acquiring the vertexes d of the graphs R3iTo the corresponding vertex D on said graph R4iVector n ofiI is 1, 2, 3, …, N is the number of vertices;
according to the vector niAnd correcting the projection picture.
The invention has the beneficial effects that: according to the invention, the relative displacement of the projection picture in the shot image and the four corners and the vertexes of the curtain is converted into the four-point trapezoidal correction absolute displacement of the projector picture through the perspective transformation matrix, so that the factors such as the placement distance, the angle, the jitter and the like of the camera do not need to be considered, and even if the projection picture and the curtain are shot from the side surface, the trapezoidal correction can be accurately and automatically completed, so that the curtain is automatically paved with the projector picture, and the method has the advantages of simple and rapid correction process, low correction cost, high accuracy and strong practicability.
On the basis of the above, the present invention can be further modified as follows.
Further, after acquiring the image including the curtain and the projection screen, the method further includes:
carrying out edge detection on the curtain in the image to obtain a graph R1 of the curtain;
and carrying out edge detection on the projection picture in the image to obtain a graph R2 of the projection picture.
The beneficial effect of adopting the further scheme is that: the edge detection method is used for detecting the curtain edge and the projection picture edge in the image, so that more accurate edge graphics can be obtained, and the accuracy of the subsequent correction process is further improved.
Further, constructing a graph R3 of an undistorted projection picture in the image specifically includes:
establishing a two-dimensional coordinate system in the image;
acquiring the length and width of an undistorted projection picture;
and constructing a graph R3 of an undistorted projection picture in the two-dimensional coordinate system according to the length and the width.
The beneficial effect of adopting the further scheme is that: by constructing the graph R3 in a two-dimensional coordinate system, the coordinates of each vertex of the graph R3 can be obtained conveniently, the vector from the graph R3 to the corresponding vertex of the graph R4 can be calculated quickly through coordinate calculation, and the calculation efficiency is improved.
Further, either side of the graph R3 is parallel to the X-axis or the Y-axis of the two-dimensional coordinate system.
The beneficial effect of adopting the further scheme is that: by setting any side of the graph R3 to be parallel to the X axis or the Y axis of the two-dimensional coordinate system, the calculation efficiency can be further improved.
Further, constructing a graph R3 of the undistorted projection picture in the two-dimensional coordinate system according to the length and the width specifically includes:
calculating an aspect ratio of the length and the width;
and constructing a graph R3 of the undistorted projection picture in the two-dimensional coordinate system according to the aspect ratio.
Further, according to the vector niCorrecting the projection picture, specifically comprising:
obtaining the vector niComponent length n on the X-axis of the two-dimensional coordinate systemxiAnd the length n of the component vector on the Y axisyi;
According to the length n of the component vector on the X axisxiFor the ith vertex of the projection pictureCarrying out horizontal correction;
according to the length n of the component vector on the Y axisyiAnd vertically correcting the ith vertex of the projection picture.
Further, projecting a projection picture to a curtain so that all vertexes of the projection picture are projected in the curtain specifically includes:
projecting a projection picture to the curtain;
and controlling the projection picture to be reduced until all vertexes of the projection picture are projected in the curtain.
Another technical solution of the present invention for solving the above technical problems is as follows:
a projector corrects a projection picture by using the projector picture correction method according to any one of the above technical solutions.
Another technical solution of the present invention for solving the above technical problems is as follows:
a projector picture correction device includes:
an optical projection system for projecting a projection image onto a curtain such that all vertices of the projection image are projected within the curtain;
the camera device is used for acquiring an image containing the curtain and the projection picture;
a processor for constructing a graph R3 of an undistorted projected picture in the image, transforming the graph R2 of the projected picture to the graph R3, resulting in a transformation matrix; transforming the graph R1 of the curtain according to the transformation matrix to obtain a graph R4; respectively acquiring the vertexes d of the graphs R3iTo the corresponding vertex D on said graph R4iVector n ofiI is 1, 2, 3, …, N is the number of vertices;
a correction system for correcting the vector niAnd correcting the projection picture.
Further, the processor is specifically configured to perform edge detection on a curtain in the image, so as to obtain a graph R1 of the curtain;
and carrying out edge detection on the projection picture in the image to obtain a graph R2 of the projection picture.
Further, the processor is specifically configured to establish a two-dimensional coordinate system in the image;
acquiring the length and width of an undistorted projection picture;
and constructing a graph R3 of an undistorted projection picture in the two-dimensional coordinate system according to the length and the width.
Further, either side of the graph R3 is parallel to the X-axis or the Y-axis of the two-dimensional coordinate system.
Further, the processor is specifically configured to calculate an aspect ratio of the length and the width;
and constructing a graph R3 of the undistorted projection picture in the two-dimensional coordinate system according to the aspect ratio.
Further, the processor is specifically configured to obtain the vector niComponent length n on the X-axis of the two-dimensional coordinate systemxiAnd the length n of the component vector on the Y axisyi;
According to the length n of the component vector on the X axisxiHorizontally correcting the ith vertex of the projection picture;
according to the length n of the component vector on the Y axisyiAnd vertically correcting the ith vertex of the projection picture.
Further, the optical projection system is specifically configured to project a projection picture to a curtain;
and controlling the projection picture to be reduced until all vertexes of the projection picture are projected in the curtain.
Another technical solution of the present invention for solving the above technical problems is as follows:
a projector comprising the projector image correction apparatus according to any one of the above-mentioned claims.
Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Detailed Description
The principles and features of this invention are described below in conjunction with the following drawings, which are set forth to illustrate, but are not to be construed to limit the scope of the invention.
At present, a projector is usually used with a curtain, a projection picture projected by the projector has the same shape and size with the curtain, and under normal conditions, the projection picture projected by the projector can completely cover the curtain. However, the existing keystone correction schemes have many defects, and based on this, the invention provides a projector picture correction method, a projector picture correction device and a corresponding projector.
As shown in fig. 1, a schematic flow chart of a method for correcting a picture of a projector according to an embodiment of the present invention is provided, where the method includes:
s1, the projection screen is projected onto the curtain such that all the vertices of the projection screen are projected into the curtain.
It will be appreciated that the curtain is typically hung on a wall and that the color of the curtain may be set to be different from the color of the wall surface in order to more clearly identify the curtain in the image.
Preferably, the curtain may be set to a pure black color. The wall surface is usually rarely pure black, so the black curtain is used, and the application range is wider.
Likewise, in order to more clearly identify the projection screen in the image, the color of the edge of the projection screen may be set to be different from the color of the curtain.
Preferably, the color of the projection screen may be set to a solid image different from the color of the curtain.
S2, an image including a curtain and a projection screen is acquired.
It should be noted that the image of the projection picture can be captured by a camera provided on the projector, and then transmitted to the information processing device in the projector through the internal circuit structure for processing. The terminal can also be held by a user to shoot, such as a mobile phone, a camera, a tablet personal computer and the like, and then the shot image is transmitted to the projector for processing through information transmission modes such as a wireless local area network, Bluetooth, a USB data line and the like.
S3, a graph R3 of an undistorted projection picture is constructed in the image, and the graph R2 of the projection picture is transformed to a graph R3 to obtain a transformation matrix.
It should be understood that the undistorted projected picture refers to a picture that is completely rolled out when the projector projects onto the curtain, and the size of the picture can be adjusted to fit the curtain, and the aspect ratio is fixed. The specific size of the undistorted projection picture can be set according to actual requirements.
The perspective transformation operation is performed on the graph R2 of the projection picture, the perspective transformation matrix transformed from the graph R2 to the graph R3 is uniquely determined and can be obtained by common calculation, and the perspective transformation theory and the perspective transformation matrix calculation method are contents mature and disclosed in the field of digital image processing and are not repeated herein.
And S4, transforming the graph R1 of the curtain according to the transformation matrix to obtain a graph R4.
It should be understood that after the image is obtained, edge detection may be performed on the image to identify two nested rectangles, and the edge detection is a content that is well-known in the field of digital image processing and will not be described herein again. Those skilled in the art can select other image recognition methods to recognize the shapes of the projection picture and the curtain according to actual requirements, and there are many mature technologies in the art, which are not listed here.
S5, obtaining the vertexes d of the graph R3iTo the corresponding vertex D on the graph R4iVector n ofiI is 1, 2, 3, …, and N is the number of vertices.
In addition, since the projection screen projected by the projector is rectangular in the related art, the number of vertices is 4. The invention provides a correction method based on the problem that a projector generates a tiny error when projecting a projection picture to a curtain and cannot cover the curtain.
For example, as shown in FIG. 2, assume that after correction, the vertex d of the graph R31And vertex D of graph R41Coincide, then vertex D1Is the vertex d1The corresponding vertex of (2).
For another example, as shown in FIG. 3, when the shapes of the projection screen and the curtain are polygons, it is assumed that the vertex d of the graph R3 is corrected2And vertex D of graph R42Coincide, then vertex D2Is the vertex d2The corresponding vertex of (2).
It should be understood that when the projected picture and the curtain contain curved edges, the vertex still exists, and the picture correction can still be performed by using the method of the present invention.
S6, according to the vector niAnd correcting the projection picture.
It should be understood that the vector niThe vertex d of the graphic R3iTo the corresponding vertex D on the graph R4iDirection and distance of projection screen according to whichAnd adjusting the corresponding vertex to move the corresponding vertex of the projection picture in the direction and distance, so that the automatic accurate correction of the projection picture can be realized. The whole correction process can be realized by the correction program carried by the projector.
In the embodiment, the relative displacement of four corners and vertexes of a projection picture in a shot image and a curtain is converted into four-point trapezoidal correction absolute displacement of the projection picture through the perspective transformation matrix, so that the factors such as the placement distance, the angle, the jitter and the like of a camera do not need to be considered, even if the projection picture and the curtain are shot from the side surface, the trapezoidal correction can be accurately and automatically completed, the curtain is automatically paved with the projection picture, and the method has the advantages of simple and rapid correction process, low correction cost, high accuracy and strong practicability.
Optionally, in some embodiments, after acquiring the image including the curtain and the projection screen, the method further includes:
carrying out edge detection on the curtain in the image to obtain a graph R1 of the curtain;
the edge detection is performed on the projection picture in the image, and a graph R2 of the projection picture is obtained.
The edge detection method is used for detecting the curtain edge and the projection picture edge in the image, so that more accurate edge graphics can be obtained, and the accuracy of the subsequent correction process is further improved.
Optionally, in some embodiments, constructing the graph R3 of the undistorted projection picture in the image specifically includes:
establishing a two-dimensional coordinate system in the image;
acquiring the length and width of an undistorted projection picture;
the graph R3 of the undistorted projection screen is constructed in a two-dimensional coordinate system according to the length and width.
It should be understood that the specific length and width of the graphic R3 can be set according to actual requirements, and it is sufficient to ensure that the aspect ratio of the graphic R3 is the same as the aspect ratio of the actual undistorted projection screen.
By constructing the graph R3 in a two-dimensional coordinate system, the coordinates of each vertex of the graph R3 can be obtained conveniently, the vector from the graph R3 to the corresponding vertex of the graph R4 can be calculated quickly through coordinate calculation, and the calculation efficiency is improved.
Optionally, in some embodiments, any side of the graphic R3 is parallel to the X-axis or the Y-axis of the two-dimensional coordinate system.
By setting any side of the graph R3 to be parallel to the X axis or the Y axis of the two-dimensional coordinate system, the calculation efficiency can be further improved.
Preferably, either side of the graph R3 coincides with the X-axis or the Y-axis of the two-dimensional coordinate system.
Optionally, in some embodiments, constructing the graph R3 of the undistorted projection picture in the two-dimensional coordinate system according to the length and the width specifically includes:
calculating the aspect ratio of the length and the width;
the image R3 of the undistorted projection screen is constructed in a two-dimensional coordinate system according to the aspect ratio.
Optionally, in some embodiments, according to vector niCorrecting the projection picture, specifically comprising:
obtaining a vector niComponent length n on the X-axis of a two-dimensional coordinate systemxiAnd the length n of the component vector on the Y axisyi;
According to the length n of the component vector on the X axisxiHorizontally correcting the ith vertex of the projection picture;
according to the length n of the component vector on the Y axisyiThe ith vertex of the projection picture is corrected vertically.
Optionally, in some embodiments, projecting the projection picture to the curtain such that all vertices of the projection picture are projected within the curtain specifically includes:
projecting a projection picture to the curtain;
and controlling the projection picture to be reduced until all the vertexes of the projection picture are projected in the curtain.
Preferably, the projection screen can be reduced to a minimum size, which ensures that all vertices of the projection screen are projected within the curtain.
It is understood that some or all of the alternative embodiments described above may be included in some embodiments.
The invention is further illustrated below by means of a specific example.
First, the projector projects a pure white projection picture to the black screen, and the environment color is white. Then, the projection picture is roughly adjusted to be approximately overlapped with the curtain.
Then, the size of the projection picture is continuously reduced, so that 4 vertexes of the projection picture are all positioned in the range of the curtain. In this case, as shown in fig. 4, the projection screen obtained is deviated to the right side and cannot completely overlap the screen.
At this time, the screen is photographed and the image obtained is as shown in fig. 5, and it can be seen from the figure that the screen is deformed in the photographed image because the angle between the projector and the screen is deviated to a certain degree.
Then, edge detection is performed on the curtain to obtain a quadrangle R1, and edge detection is performed on the projection picture to obtain a quadrangle R2.
Then, the width and height of the output picture of the projector lens are obtained, wherein the width is w pixels, the height is h pixels, and generally, the width is 1920 pixels, and the height is 1080 pixels.
Then, a plane coordinate system XOY is established on the image, and the origin of coordinates, the X-axis direction, and the Y-axis direction can be freely selected. Constructing a quadrilateral R3 on a coordinate system according to the width and the height, and selecting d in the coordinate system XOY1=(0,h)、d2=(w,h)、d3=(0,0)、d4Four vertices (w, 0) are connected in sequence to form a quadrangle R3, as shown in fig. 6. For convenience of explanation, the long side of the quadrangle R3 is set to coincide with the Y axis, and the short side is set to coincide with the X axis.
Four vertexes of the quadrangle R3 and four vertexes of the quadrangle R2 have only one perspective transformation third-order matrix, which is recorded as a matrix M, and after perspective transformation of the matrix M, the distorted and twisted quadrangle R2 can be mapped to the horizontal, flat and vertical quadrangle R3. Similarly, after the quadrangle R1 is converted by the matrix M, a new quadrangle can be obtained and is marked as R4. As shown in FIG. 7, the upper left, upper right, lower left and lower right quadrangle marks of R4 are respectively marked as D1=(x0,y0)、D2=(x1,y1)、D3=(x2,y2)、D4=(x3,y3)。
Then, the vertices d are calculated respectively1To vertex D1Displacement of (d), vertex2To vertex D2Displacement of (d), vertex3To vertex D3Displacement of (d), vertex4To vertex D4Displacement of (2).
The results are as follows: vertex d1X0 pixels shifted in the X-axis and (Y0-h) pixels shifted in the Y-axis; vertex d2Moving (X1-w) pixels in the X-axis and (Y1-h) pixels in the Y-axis; vertex d3X2 pixels on the X-axis and Y2 pixels on the Y-axis; vertex d4The X-axis is shifted (X3-w) by Y3 pixels and the Y-axis is shifted by Y3 pixels.
The X axis of the coordinate system corresponds to the horizontal direction of the projector picture, and the Y axis of the coordinate system corresponds to the vertical direction of the projector picture. After the displacement data is sent to a trapezoidal correction control module of the projector, the projector can automatically execute trapezoidal correction, and after four-point movement, a projection picture is paved on a curtain.
In another embodiment of the present invention, there is further provided a projector, which corrects a projection picture by using the projector picture correction method according to any one of the above embodiments.
As shown in fig. 8, a structural frame diagram of a projector image correction device according to an embodiment of the present invention is provided, the correction device includes:
an optical projection system 1 for projecting a projection screen onto a screen such that all the vertexes of the projection screen are projected into the screen;
the camera device 2 is used for acquiring an image containing a curtain and a projection picture;
a processor 3, configured to construct a graph R3 of an undistorted projection picture in the image, and transform the graph R2 of the projection picture to a graph R3 to obtain a transformation matrix; transforming the graph R1 of the curtain according to the transformation matrix to obtain a graph R4; respectively acquiring the vertex d of the graph R3iTo the corresponding vertex D on the graph R4iVector of (2)niI is 1, 2, 3, …, N is the number of vertices;
a correction system 4 for correcting the vector niAnd correcting the projection picture.
Optionally, in some embodiments, the processor 3 is specifically configured to perform edge detection on the curtain in the image, so as to obtain a graph R1 of the curtain;
the edge detection is performed on the projection picture in the image, and a graph R2 of the projection picture is obtained.
Optionally, in some embodiments, the processor 3 is specifically configured to establish a two-dimensional coordinate system in the image;
acquiring the length and width of an undistorted projection picture;
the graph R3 of the undistorted projection screen is constructed in a two-dimensional coordinate system according to the length and width.
Optionally, in some embodiments, any side of the graphic R3 is parallel to the X-axis or the Y-axis of the two-dimensional coordinate system.
Optionally, in some embodiments, the processor 3 is specifically configured to calculate an aspect ratio of the length and the width;
the image R3 of the undistorted projection screen is constructed in a two-dimensional coordinate system according to the aspect ratio.
Optionally, in some embodiments, the processor 3 is specifically configured to obtain the vector niComponent length n on the X-axis of a two-dimensional coordinate systemxiAnd the length n of the component vector on the Y axisyi;
According to the length n of the component vector on the X axisxiHorizontally correcting the ith vertex of the projection picture;
according to the length n of the component vector on the Y axisyiThe ith vertex of the projection picture is corrected vertically.
Optionally, in some embodiments, the optical projection system 1 is specifically configured to project a projection picture to a curtain;
and controlling the projection picture to be reduced until all the vertexes of the projection picture are projected in the curtain.
It is understood that some or all of the alternative embodiments described above may be included in some embodiments.
It should be noted that the above embodiments are product embodiments corresponding to the previous method embodiments, and for the description of each optional implementation in the product embodiments, reference may be made to corresponding descriptions in the above method embodiments, and details are not described here again.
In another embodiment of the present invention, there is provided a projector including the projector image correction device according to any one of the above embodiments.
The reader should understand that in the description of this specification, reference to the description of the terms "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present invention.
While the invention has been described with reference to specific embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.