CN117998065A - Correction method, device, equipment and storage medium for projection image - Google Patents
Correction method, device, equipment and storage medium for projection image Download PDFInfo
- Publication number
- CN117998065A CN117998065A CN202410068654.1A CN202410068654A CN117998065A CN 117998065 A CN117998065 A CN 117998065A CN 202410068654 A CN202410068654 A CN 202410068654A CN 117998065 A CN117998065 A CN 117998065A
- Authority
- CN
- China
- Prior art keywords
- image
- corner
- coordinates
- processed
- initialized
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 67
- 238000012937 correction Methods 0.000 title abstract description 29
- 239000011159 matrix material Substances 0.000 claims abstract description 19
- 238000012545 processing Methods 0.000 claims description 15
- 238000004590 computer program Methods 0.000 claims description 11
- 238000003708 edge detection Methods 0.000 claims description 10
- 230000000877 morphologic effect Effects 0.000 claims description 5
- 238000007781 pre-processing Methods 0.000 claims description 4
- 238000003702 image correction Methods 0.000 abstract description 7
- 238000001514 detection method Methods 0.000 description 9
- 230000009466 transformation Effects 0.000 description 9
- 238000010586 diagram Methods 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 7
- 238000012163 sequencing technique Methods 0.000 description 4
- 230000001360 synchronised effect Effects 0.000 description 3
- 240000004282 Grewia occidentalis Species 0.000 description 2
- 241001660693 Trapezia Species 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 239000002245 particle Substances 0.000 description 2
- 238000012216 screening Methods 0.000 description 2
- 238000013519 translation Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000005530 etching Methods 0.000 description 1
- 230000036244 malformation Effects 0.000 description 1
Landscapes
- Transforming Electric Information Into Light Information (AREA)
Abstract
The application discloses a correction method, a device, equipment and a storage medium of a projection image, wherein the correction method comprises the following steps: acquiring four original corner coordinates of an image to be processed, and initializing the original corner coordinates to obtain initialized corner coordinates; determining the coordinates of the target corner based on the initialized corner coordinates; obtaining a perspective matrix based on the initialized corner coordinates and the target corner coordinates; and obtaining corrected corner coordinates and corrected images based on the perspective matrix. By the projection image correction method, the convenience and efficiency of projection image correction can be improved.
Description
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for correcting a projection image.
Background
With the development of projection technology, projection devices are becoming popular in office and home fields, and the level of a projected image is an important factor in determining the user experience. In the daily use of the projector, the position of the projector needs to be at right angles to the projection screen to ensure the projection effect, and if the two can not be ensured to be vertical, the image can generate trapezia.
Currently, trapezoidal correction of a projected image is generally performed by using a camera to capture an image and a distance sensor. The camera is used for capturing the relative position of the projection screen and the projector, and the distance sensor is used for measuring the relative distance and the included angle between the curtain and the machine body. Through the information, a software interpolation algorithm can adjust and compensate the shape of the image before projection, and horizontal trapezoid correction and vertical trapezoid correction of the projected image are realized. However, the existing image correction scheme uses a camera to pick up the image and is associated with a distance sensor, so that the problems of complicated operation steps, operation delay and the like are caused.
Disclosure of Invention
The embodiment of the application provides a correction method, device and equipment for a projection image and a storage medium, which can improve the convenience and efficiency of projection image correction.
In a first aspect, the present application provides a method for correcting a projection image, the method for correcting a projection image including:
acquiring four original corner coordinates of an image to be processed, and initializing the original corner coordinates to obtain initialized corner coordinates;
determining the coordinates of the target corner based on the initialized corner coordinates;
Obtaining a perspective matrix based on the initialized corner coordinates and the target corner coordinates;
And obtaining corrected corner coordinates and corrected images based on the perspective matrix.
The further technical scheme is that the initialized angular point coordinates comprise initialized angular point coordinates of an upper left corner, an upper right corner, a lower left corner and a lower right corner, the initialized angular point coordinates are initialized, and the initialized angular point coordinates are obtained, and the method comprises the following steps:
Determining the initialization coordinates of the upper left corner and the lower right corner based on the sum of the horizontal coordinates and the vertical coordinates of the original corner coordinates;
The initialized coordinates of the upper right corner and the lower left corner are determined based on the absolute value of the difference between the abscissa and the ordinate of each original corner coordinate.
The further technical scheme is that the method for acquiring the four original corner coordinates of the image to be processed comprises the following steps:
acquiring all outline information of an image to be processed;
Selecting a preset number of contours in front of the area row from all contour information;
and performing similarity fitting on each contour to obtain the target contour and four original corner coordinates of the target contour.
The method further comprises the following steps of:
and carrying out preprocessing of graying, gaussian blur, edge detection and morphological operation on the image to be processed.
The method further comprises the following steps of:
acquiring a rectangular frame of a white field to be processed;
Performing obstacle avoidance treatment on the rectangular frame of the white field to be treated until no obstacle exists in the rectangular frame of the white field to be treated, and acquiring the definition of the image to be treated in the rectangular frame of the white field to be treated;
And if the definition of the image to be processed does not reach the preset definition threshold, focusing the image to be processed.
The further technical scheme is that after the corrected corner coordinates and the corrected image are obtained, the method further comprises the following steps:
judging whether the corrected image reaches a preset definition threshold;
if the corrected image does not reach the preset definition threshold, focusing the corrected image;
And matching the corrected image after focusing with a preset template image, and taking the corrected image after focusing as a target corrected image if matching is successful.
The further technical scheme is that the method for determining the target angular point coordinates based on the initialized angular point coordinates comprises the following steps:
determining the height and width of the image to be processed based on the initialized corner coordinates;
and determining the coordinates of the target corner points based on the height and width of the image to be processed.
In a second aspect, the application provides an apparatus for correcting a projected image, the apparatus comprising means for performing a method as described above.
In a third aspect, the present application provides an electronic device, the electronic device comprising a memory and a processor, the memory storing a computer program, the processor implementing a method as described above when executing the computer program.
In a fourth aspect, the application provides a computer readable storage medium storing a computer program which, when executed by a processor, performs a method as described above.
The beneficial effects of the application are: compared with the prior art, the method and the device have the advantages that four original corner coordinates of an image to be processed are automatically identified and acquired through an image processing technology, after the four original corner coordinates are acquired, the original corner coordinates are simply initialized to obtain the initialized corner coordinates, namely, the original corner coordinates are subjected to position sequencing to determine the correct position sequence of each original corner coordinate, the subsequent correction process can be automatically completed according to the initialized correct corner positions, and data exchange and linkage adjustment among a plurality of sensors are not needed, so that the problems of complicated operation steps, operation delay and the like caused by the association of camera shooting and distance sensors can be avoided, the convenience and the efficiency of projection image correction are improved, and the dependence on specific sensors is reduced.
And taking the initialized angular point coordinates and the target angular point coordinates as inputs, performing perspective transformation to obtain a perspective matrix, and obtaining a corrected image based on the perspective matrix. The original corner coordinates are subjected to position sequencing, so that perspective transformation is performed on the premise of determining the correct position sequence of each original corner coordinate, the operations such as rotation and translation of an image to be processed can be realized, the trapezoidal distortion in the horizontal direction and the trapezoidal distortion in the vertical direction can be eliminated, and the quality of a projection image is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art. Wherein:
FIG. 1 is a flowchart of a first embodiment of a method for correcting a projection image according to the present application;
fig. 2 is a schematic position diagram of original angular point coordinates in the method for correcting a projection image provided by the application;
fig. 3 is a schematic position diagram of an initialized angular point coordinate in the correction method of a projection image provided by the application;
fig. 4 is a schematic position diagram of coordinates of a target corner in the method for correcting a projection image provided by the application;
FIG. 5 is a schematic flow chart of a method for correcting a projection image according to the present application;
FIG. 6 is a schematic diagram of a gray scale image in the method for correcting a projection image according to the present application;
FIG. 7 is a schematic diagram of an edge detection image in the method for correcting a projection image according to the present application;
FIG. 8 is a schematic diagram of a contour detection image in a method for correcting a projection image according to the present application;
FIG. 9 is a schematic view of a corrected image finally presented in the method for correcting a projected image according to the present application;
FIG. 10 is a flowchart illustrating an embodiment of a projector control method according to the present application;
fig. 11 is a schematic structural diagram of an embodiment of a computer readable storage medium provided by the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. It is to be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present application are shown in the drawings. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases 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 skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
With the development of projection technology, projection devices are becoming popular in office and home fields, and the level of a projected image is an important factor in determining the user experience. In the daily use of the projector, the position of the projector needs to be at right angles to the projection screen to ensure the projection effect, and if the two can not be ensured to be vertical, the image can generate trapezia.
The trapezoidal correction is to achieve the purpose of adjusting the trapezoid by adjusting the physical position of a lens, and is usually performed by using a camera to pick up and a distance sensor to correct the trapezoid of a projected image. The camera is used for capturing the relative position of the projection screen and the projector, and the distance sensor is used for measuring the relative distance and the included angle between the curtain and the machine body. Through the information, a software interpolation algorithm can adjust and compensate the shape of the image before projection, and horizontal trapezoid correction and vertical trapezoid correction of the projected image are realized. However, the current image correction method using a camera to pick up images and associated with a distance sensor can cause problems of complicated steps, operation delay and the like.
Therefore, in order to solve the technical problems of complicated steps and operation delay caused by using a correction mode associated with a camera shooting and a distance sensor in the prior art, the application provides a correction method of a projection image, and particularly refers to the following embodiment.
The method for correcting the projection image provided by the application is described in detail below. Referring to fig. 1, fig. 1 is a flowchart illustrating a first embodiment of a method for correcting a projection image according to the present application. The method comprises the following steps:
Step 110: four original corner coordinates of the image to be processed are obtained, and the original corner coordinates are initialized to obtain initialized corner coordinates.
All contour information of the image to be processed can be acquired through an image processing technology (such as an edge detection algorithm), and then original corner coordinates are obtained according to the contour information. For example, in some embodiments, a preset number of contours in front of an area row may be selected from all the contour information; and then performing similarity fitting on each contour to obtain the target contour and four original corner coordinates of the target contour.
The preset number can be 3, 4, 5, 6, etc., and can be specifically adjusted according to actual situations.
Wherein the shape of each contour can be analyzed and the position of the corner point can be deduced from its vertices and edges. For example, the corner points of a rectangle are four vertices; the corner point of a circle or ellipse may be determined by a specific point on its edge.
For example, assuming that the preset number is 5, selecting 5 contours in front of the area rows as circles, triangles, pentagons, trapezoids and hexagons, obtaining circumferences corresponding to the circles, triangles, pentagons, trapezoids and hexagons, and performing similarity fitting on the 5 contours based on the circumferences.
For example, assuming that the target contour is a quadrilateral contour, a vertex threshold of 4 may be set, i.e., only contours with a vertex number of 4 remain. Traversing the 5 selected contours, and recording the number of vertexes of each contour. Screening the vertex if the number of the vertices is greater than or less than a threshold value; if the number of the vertexes is equal to the threshold value, the contour is reserved, and the reserved contour is the target contour.
For a selected target contour, the coordinates of the corner points need to be further determined. For example, corner detection algorithms may be used to determine the location of the corner points. Common corner detection algorithms include harris corner detection, SIFT (scale invariant feature transform) and the like. The algorithms can identify the locations of the corner points in the image and give corresponding coordinate values.
Because the order of the four original corner coordinates is not known, the four original corner coordinates need to be ordered so as to distinguish the coordinates of the upper left corner, the upper right corner, the lower right corner and the lower left corner, namely, the initialization of the original corner coordinates is realized, the initialized corner coordinates are obtained, and then the initialized corner coordinates are input into an algorithm to further realize correction.
In some embodiments, step 110 may include the steps of:
Step 111: and determining the initialization coordinates of the upper left corner and the lower right corner based on the sum of the horizontal coordinates and the vertical coordinates of the original corner coordinates.
Step 112: the initialized coordinates of the upper right corner and the lower left corner are determined based on the absolute value of the difference between the abscissa and the ordinate of each original corner coordinate.
And subtracting absolute values from the abscissa of each original angular point coordinate, taking the original angular point coordinate corresponding to the minimum value as an upper left corner, taking the original angular point coordinate corresponding to the maximum value as a lower right corner, taking the original angular point coordinate corresponding to the smaller value as the upper right corner and taking the original angular point coordinate corresponding to the larger value as the lower left corner, and completing the initialization of the coordinates.
Specifically, assuming that four original corner coordinates are a (x 1, y 1), B (x 2, y 2), C (x 3, y 3), and D (x 4, y 4), respectively, the positions are as shown in fig. 2.
After initialization, coordinates of a (x 1, y 1), B (x 2, y 2), C (x 3, y 3), and D (x 4, y 4) are obtained, which are respectively the upper left corner, the upper right corner, the lower right corner, and the lower left corner, as shown in fig. 3.
Step 120: and determining the coordinates of the target corner based on the initialized corner coordinates.
The initialization angular point coordinates can determine the positions of four point coordinates of an upper left corner, an upper right corner, a lower right corner and a lower left corner, so that the maximum angular point coordinates, namely the target angular point coordinates, can be determined based on the determined positions of the four point coordinates of the upper left corner, the upper right corner, the lower right corner and the lower left corner, and the corrected coordinates can be changed in the range of the maximum angular point coordinates.
The height and width of the image to be processed can be determined based on the initialized corner coordinates, and the maximum corner coordinates can be obtained based on the height and width.
For example, two straight line lengths of the initialized image to be processed in the abscissa direction may be determined, wherein one is a distance w1 between two points of the upper left corner and the upper right corner, namely an AD, and one is a distance w2 between two points of the lower left corner and the lower right corner, namely a BC, wherein w2 is greater than w1, and therefore, a larger value w2 of the two is selected as the width of the image to be processed; and then determining the lengths of two straight lines of the initialized image to be processed in the ordinate direction, wherein one is the distance h1 between the two points of the upper left corner and the lower right corner, namely the distance AB, and the other is the distance h2 between the two points of the upper right corner and the lower right corner, namely the distance DC, wherein h2 is larger than h1, and therefore, a larger value h2 in the two points is selected as the height of the image to be processed.
And obtaining the maximum angular point coordinate, namely the target angular point coordinate according to the maximum value of the abscissa, namely the determined width and height of the image to be processed, as shown in fig. 4.
It should be noted that, the starting point of the coordinates of the target corner may be a preset value.
Step 130: and obtaining a perspective matrix based on the initialized corner coordinates and the target corner coordinates.
Wherein, the initialized angular point coordinates and the target angular point coordinates, namely the maximum angular point coordinates, can be corresponding to each other: a (10, 30) and a '(10, 30), B (7, 25) and B' (10, 20), C (45, 10) and C '(30, 20), D (30, 32) and D' (30, 30), then elements of the perspective matrix are calculated from the x-and y-coordinates of the corresponding corner points.
Step 140: and obtaining corrected corner coordinates and corrected images based on the perspective matrix.
According to the embodiment, four original corner coordinates of an image to be processed are automatically identified and acquired through an image processing technology, after the four original corner coordinates are acquired, the original corner coordinates are simply initialized to obtain initialized corner coordinates, namely, the original corner coordinates are subjected to position sequencing to determine the correct position sequence of each original corner coordinate, the subsequent correction process can be automatically completed according to the correct corner positions after initialization, and data exchange and linkage adjustment among a plurality of sensors are not needed, so that the problems of complicated operation steps, operation delay and the like caused by the association of camera shooting and a distance sensor can be avoided, the convenience and the efficiency of projection image correction are improved, and the dependence on a specific sensor is reduced.
And taking the initialized angular point coordinates and the target angular point coordinates as inputs, performing perspective transformation to obtain a perspective matrix, and obtaining a corrected image based on the perspective matrix. The original corner coordinates are subjected to position sequencing, so that perspective transformation is performed on the premise of determining the correct position sequence of each original corner coordinate, the operations such as rotation and translation of an image to be processed can be realized, the trapezoidal distortion in the horizontal direction and the trapezoidal distortion in the vertical direction can be eliminated, and the quality of a projection image is improved.
In some embodiments, in order to effectively improve the image quality, the accuracy of corner detection is improved, and a better basis is provided for coordinate acquisition and image processing. The preprocessing operation may be performed on the image to be processed before the four original corner coordinates of the image to be processed are acquired, and specifically, the preprocessing operation may be performed on the image to be processed, such as graying, gaussian blur, edge detection, and morphological operation.
The image to be processed is grayed to obtain a black-and-white image, and then the black-and-white image is subjected to denoising treatment to eliminate noise points on the black-and-white image, for example, a Gaussian blur denoising mode can be used to eliminate noise points of larger particles.
The edge recognition detection can be performed on the denoised black-and-white image by using a canny edge detection algorithm, so that edge contour information in the black-and-white image is obtained.
After the edge profile information is extracted, the black-and-white image may be further de-noised, such as using a corrosive morphological operation to remove fine noise from the black-and-white image.
In some embodiments, before acquiring the four original corner coordinates of the image to be processed, the method includes:
1) And obtaining a rectangular frame of the white field to be processed.
The rectangular frame of the white field to be processed is a trapezoid rectangular frame of the white field emitted by the optical machine.
2) And carrying out obstacle avoidance treatment on the rectangular frame to be treated until no obstacle exists in the rectangular frame to be treated, and acquiring the definition of the image to be treated in the rectangular frame to be treated.
The method comprises the steps of detecting whether an obstacle exists in a to-be-processed white field rectangular frame, if so, performing obstacle avoidance processing, for example, shrinking the to-be-processed white field rectangular frame until no obstacle exists, and acquiring definition of to-be-processed images in the to-be-processed white field rectangular frame.
The image to be processed can be subjected to Laplacian transformation, and different definition representations can be carried out on the image to be processed through values obtained through transformation, for example, definition can be divided into four grades of clearest, next fuzziness and fuzziness.
3) And if the definition of the image to be processed does not reach the preset definition threshold, focusing the image to be processed.
The specific value of the preset definition threshold depends on the requirement of practical application. The sharpness threshold may be set to some fixed value, e.g., 300 or 400, etc., to achieve a particular sharpness requirement.
According to the definition degree of the image to be processed, synchronous focusing operation is carried out, specifically, from initial adjustment to fine adjustment until the picture keeps clear, namely, the preset definition threshold is met.
In some embodiments, in order to solve the problem that the projection plane obtained by zooming after correction is not parallel, after obtaining the coordinates of the correction angular points and the corrected image, the corrected image may be subjected to sharpness judgment again and focusing processing again, which specifically includes the following steps:
Step 150: and judging whether the corrected image reaches a preset definition threshold.
Step 160: and if the corrected image does not reach the preset definition threshold, focusing the corrected image.
The steps 150 to 160 have the same or similar technical schemes as those of the above embodiment, and are not described herein.
Step 170: and matching the corrected image after focusing with a preset template image, and taking the corrected image after focusing as a target corrected image if matching is successful.
In order to ensure the quality and accuracy of the corrected image, the corrected image after focusing can be matched with a preset template map. The template map is a standardized image for comparison and matching with the image to be processed. If the matching is successful, the corrected image after focusing can be considered to reach the preset standard, and the corrected image after focusing is taken as the target corrected image.
Based on the above embodiment, with reference to fig. 5, the method for correcting a projection image provided by the present application mainly includes the following steps:
s101: and acquiring an image to be processed.
S102: the size of the image to be processed is changed.
The amount of computation can be reduced by changing the size of the image to be processed.
S103: and carrying out graying treatment on the image to be treated to obtain a black-and-white image.
Referring to fig. 6, fig. 6 shows a black-and-white image obtained by graying the image, i.e., performing graying processing.
S104: and (5) Gaussian blur processing.
Wherein, the noise of larger particles can be eliminated by Gaussian blur processing.
S105: and (5) edge detection.
Wherein, the edge contour information of the image to be processed can be obtained by using a canny edge detection algorithm. Referring specifically to fig. 7, fig. 7 is an edge detection image obtained by edge detection.
S106: etching morphological operations.
Among other things, the corrosive morphology operation may remove fine noise.
S107: all contours are extracted.
Wherein all profile information can be obtained using a profile discovery algorithm.
Specifically, referring to fig. 8, fig. 8 is a contour detection image obtained by contour detection.
S108: and (5) contour screening.
All contours can be ordered according to the area size, and the contours with the largest areas in the first five contours are selected for comparison.
S109: and (5) performing contour fitting to obtain original corner coordinates.
The perimeter of the first five contours can be obtained, and similarity fitting is carried out on the contours to obtain the original corner coordinate information of the contours.
S201: initializing original corner coordinates.
After the information of the original angular point coordinates of the outline is obtained, whether the number of the angular points of the outline after the current fitting is four or not can be judged, and whether the angular point coordinates are the four-corner coordinate positions of the image or not is judged; if the corner coordinates are not the image corner coordinate positions, the corner coordinates can be initialized.
Specifically, four points of the upper left corner, the upper right corner, the lower left corner and the lower right corner can be initialized, the horizontal coordinates and the vertical coordinates are added, the minimum sum is used as the initialization coordinate of the upper left corner, the maximum value is used as the initialization coordinate of the lower right corner, the horizontal coordinates and the vertical coordinates are subtracted, the initialization coordinate of the upper right corner with the minimum absolute value is taken, and the initialization coordinate of the lower left corner with the maximum absolute value is taken, so that the initialization of the corner point coordinates is completed.
S202: and determining the coordinates of the target corner based on the initialized corner coordinates.
S203: and taking the initialized corner coordinates and the target corner coordinates as input data, and performing perspective transformation to obtain a perspective matrix.
S204: and obtaining corrected four corner coordinates and perspective images through the perspective matrix.
S205: the rectified image is displayed using an image overlay technique.
The perspective transformed image is overlaid on the original position through the image, and in particular, reference may be made to fig. 9, and fig. 9 is a corrected image finally presented. The image S' is a perspective image, i.e. a corrected image, and the image S is an original image to be processed.
S206: and (5) ending.
According to the method, the original coordinates of the image to be processed before the malformation are automatically obtained by using the image processing technology, the corrected image is automatically calculated and adjusted, other sensors are not required to be associated, the cost of the product can be reduced, and the fluency experience of the user on the product is improved.
In addition, the present application also provides a projector control method, and in conjunction with fig. 10, fig. 10 is a schematic flow chart of an embodiment of the projector control method provided by the present application, where the projector control method specifically may include the following steps:
S1: detecting whether the current projection equipment is in a horizontal position or not by using a gyroscope sensor, and executing S2 if the current projection equipment is in the horizontal position; if not, executing S3.
S2: and (5) normal display.
I.e. normally if the current projection device is in a horizontal position.
S3: and acquiring a white field trapezoid rectangular frame emitted by the optical machine.
I.e. if the current projection device is not in a horizontal position S2 is performed.
S4: and (5) obstacle avoidance detection.
Detecting whether an obstacle exists in the rectangular trapezoid frame of the white field, if so, performing obstacle avoidance processing, for example, reducing the rectangular trapezoid frame of the white field until no obstacle exists.
S5: judging whether the image to be processed is clear or not, and if the image to be processed is clear, executing S7; if not, S6 is performed.
The image to be processed can be subjected to Laplacian transformation, and different definition representations are carried out on the image to be processed through values obtained through transformation, for example, the definition of the image to be processed can be classified into four grades of clearest, next fuzziness and fuzzest.
S6: and (5) automatically focusing.
And performing synchronous focusing operation according to the definition degree of the image to be processed. The focusing step can be performed firstly and then fine adjustment is performed until the picture of the image to be processed remains clear.
S7: and (5) correcting the image.
When the image to be processed is in a malformed state, trapezoidal correction is carried out on the image to be processed.
S8: and acquiring corrected four original corner coordinates and corrected images.
The corrected coordinates can be returned to a related sensor such as a gyroscope sensor, the corrected image is displayed, and the projected image is kept in a horizontal normal state.
S9: judging whether the image to be processed is clear again, and executing S11 if the image to be processed is clear; if the image to be processed is not clear, S10-S11 are executed;
s10: and (5) automatically focusing.
The focusing process may refer to the relevant statements of the above embodiments, and the disclosure is not repeated here.
S11: the template matches the standard image.
S12: and (5) ending.
And S8 to S11, namely, if the image to be processed is clear, the image to be processed is directly subjected to template matching with the template image, if the image to be processed is not clear enough, synchronous focusing is performed again, then template matching with the template image is performed, if the template matching is successful, the process is ended, and if the matching is unsuccessful, focusing operation is performed again, namely, S10 is performed until the matching is successful.
The projector control method provided by the application can automatically realize obstacle avoidance, focusing and trapezoid correction, so that a user can obtain a clear and horizontal projection picture without adjustment. And the problem that the projection surfaces obtained by zooming after correction are not parallel can be solved by judging the definition of the corrected image again and focusing again.
The present application also provides a correction device for a projection image, corresponding to the correction method for a projection image of the above embodiment, where the correction device for a projection image includes an acquisition unit, a processing unit, and a correction unit.
The acquisition unit is used for acquiring four original corner coordinates of the image to be processed, initializing the original corner coordinates and obtaining initialized corner coordinates;
The processing unit is used for determining the coordinates of the target corner based on the initialized corner coordinates; obtaining a perspective matrix based on the initialized corner coordinates and the target corner coordinates;
the correction unit is used for obtaining correction angular point coordinates and correction images based on the perspective matrix.
It will be appreciated that the above units are also used to implement the technical solution of any of the embodiments of the present application.
The application also provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program; the processor is configured to implement the method for correcting the projection image provided by any one of the foregoing method embodiments when executing the computer program.
Referring to fig. 11, fig. 11 is a schematic structural diagram of an embodiment of a computer readable storage medium provided by the present application, where the computer readable storage medium 90 is used to store a computer program 91, and the computer program 91 when executed by a processor is used to implement the following method steps:
acquiring four original corner coordinates of an image to be processed, and initializing the original corner coordinates to obtain initialized corner coordinates;
determining the coordinates of the target corner based on the initialized corner coordinates;
Obtaining a perspective matrix based on the initialized corner coordinates and the target corner coordinates;
And obtaining corrected corner coordinates and corrected images based on the perspective matrix.
It will be appreciated that the computer program 91, when executed by a processor, is also operative to implement aspects of any of the embodiments of the present application.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other manners. For example, the above-described device embodiments are merely illustrative, e.g., the division of modules or units is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment.
The foregoing is only the embodiments of the present application, and therefore, the patent scope of the application is not limited thereto, and all equivalent structures or equivalent processes using the descriptions of the present application and the accompanying drawings, or direct or indirect application in other related technical fields, are included in the scope of the application.
Claims (10)
1. A method of correcting a projected image, the method comprising:
Acquiring four original corner coordinates of an image to be processed, and initializing the original corner coordinates to obtain initialized corner coordinates;
Determining a target corner coordinate based on the initialized corner coordinate;
obtaining a perspective matrix based on the initialized corner coordinates and the target corner coordinates;
And obtaining corrected corner coordinates and corrected images based on the perspective matrix.
2. The method for correcting a projection image according to claim 1, wherein the initialized corner coordinates include initialized coordinates of an upper left corner, an upper right corner, a lower left corner and a lower right corner, and initializing the corner coordinates to obtain initialized corner coordinates includes:
Determining initialization coordinates of the upper left corner and the lower right corner based on the sum of the abscissa and the ordinate of each original corner coordinate;
And determining the initialization coordinates of the upper right corner and the lower left corner based on the absolute value of the difference between the abscissa and the ordinate of each original corner coordinate.
3. The method for correcting a projection image according to any one of claims 1-2, wherein the acquiring four original corner coordinates of the image to be processed comprises:
acquiring all outline information of the image to be processed;
Selecting a preset number of contours in front of the area row from all the contour information;
And performing similarity fitting on each contour to obtain a target contour and four original corner coordinates of the target contour.
4. A method of correcting a projected image according to any of claims 1-3, characterized in that before the acquisition of the four original corner coordinates of the image to be processed, the method comprises:
and carrying out preprocessing of graying, gaussian blur, edge detection and morphological operation on the image to be processed.
5. The method of correcting a projected image according to any of claims 1-4, characterized in that before the four original corner coordinates of the image to be processed are obtained, the method comprises:
acquiring a rectangular frame of a white field to be processed;
Performing obstacle avoidance processing on the rectangular frame of the white field to be processed until no obstacle exists in the rectangular frame of the white field to be processed, and acquiring the definition of the image to be processed in the rectangular frame of the white field to be processed;
And if the definition of the image to be processed does not reach the preset definition threshold, focusing the image to be processed.
6. The method of correcting a projection image according to any one of claims 1 to 5, wherein after the obtaining the corrected corner coordinates and the corrected image, the method further comprises:
Judging whether the corrected image reaches a preset definition threshold;
if the corrected image does not reach the preset definition threshold, focusing the corrected image;
And matching the corrected image after focusing with a preset template image, and taking the corrected image after focusing as a target corrected image if matching is successful.
7. The method of correcting a projection image according to any one of claims 1 to 6, wherein determining target corner coordinates based on the initialized corner coordinates includes:
determining the height and width of the image to be processed based on the initialized corner coordinates;
and determining the coordinates of the target corner based on the height and width of the image to be processed.
8. An orthotic device for a projected image, characterized in that it comprises means for performing the method according to any one of claims 1-7.
9. An electronic device comprising a memory and a processor, the memory having a computer program stored thereon, the processor implementing the method of any of claims 1-7 when executing the computer program.
10. A computer readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method according to any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410068654.1A CN117998065A (en) | 2024-01-17 | 2024-01-17 | Correction method, device, equipment and storage medium for projection image |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410068654.1A CN117998065A (en) | 2024-01-17 | 2024-01-17 | Correction method, device, equipment and storage medium for projection image |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117998065A true CN117998065A (en) | 2024-05-07 |
Family
ID=90888128
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410068654.1A Pending CN117998065A (en) | 2024-01-17 | 2024-01-17 | Correction method, device, equipment and storage medium for projection image |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117998065A (en) |
-
2024
- 2024-01-17 CN CN202410068654.1A patent/CN117998065A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111145238B (en) | Three-dimensional reconstruction method and device for monocular endoscopic image and terminal equipment | |
US6400848B1 (en) | Method for modifying the perspective of a digital image | |
CN109785291B (en) | Lane line self-adaptive detection method | |
WO2020124988A1 (en) | Vision-based parking space detection method and device | |
US11663740B2 (en) | Method for calibrating the position and orientation of a camera relative to a calibration pattern | |
CN114727081B (en) | Projector projection correction method and device and projector | |
CN111815710A (en) | Automatic calibration method for fisheye camera | |
CN112837263B (en) | Identity card information positioning method under complex background | |
CN111105366A (en) | Image processing method and device, terminal device and storage medium | |
CN107680035B (en) | Parameter calibration method and device, server and readable storage medium | |
CN113723399A (en) | License plate image correction method, license plate image correction device and storage medium | |
CN114674826A (en) | Visual detection method and detection system based on cloth | |
CN114119437B (en) | GMS-based image stitching method for improving distortion of moving object | |
CN114648458A (en) | Fisheye image correction method and device, electronic equipment and storage medium | |
CN111951295A (en) | Method and device for determining flight trajectory based on polynomial fitting high precision and electronic equipment | |
CN111767752A (en) | Two-dimensional code identification method and device | |
CN117998065A (en) | Correction method, device, equipment and storage medium for projection image | |
CN116402904A (en) | Combined calibration method based on laser radar inter-camera and monocular camera | |
CN115147389A (en) | Image processing method, apparatus, and computer-readable storage medium | |
CN111210384B (en) | Image splicing method suitable for airport runway scene | |
CN114998571A (en) | Image processing and color detection method based on fixed-size marker | |
CN113947686A (en) | Method and system for dynamically adjusting feature point extraction threshold of image | |
CN111080542B (en) | Image processing method, device, electronic equipment and storage medium | |
CN115953332B (en) | Dynamic image fusion brightness adjustment method, system and electronic equipment | |
CN116703958B (en) | Edge contour detection method, system, equipment and storage medium for microscopic image |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination |