Projection picture pre-processing method and apparatus, keystone correction method and apparatus, device, and medium

By projecting a preset image containing the identification code, the projected screen is automatically adjusted to achieve efficient projected screen preprocessing, solving the problems of frequent and high cost adjustment of projection parameters in the prior art.

WO2025054880A1PCT designated stage expired Publication Date: 2025-03-20BOE TECHNOLOGY GROUP CO LTD
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/118725
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-09-14
Publication Date
2025-03-20

AI Technical Summary

Technical Problem

When changing scenes or moving, existing projectors need to adjust projection parameters multiple times, resulting in low efficiency in projection screen processing and need to be matched with distance sensors, which increases costs.

Method used

By projecting a preset image containing the identification code, the projected image is obtained, the target corner coordinates are determined, the optical machine adjustment information is generated, and the projected image is adjusted to realize preprocessing.

Benefits of technology

It reduces the time-consuming process of acquiring projected images during projection image preprocessing, improves processing efficiency, and eliminates the need for distance sensors, reducing projector costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023118725_20032025_PF_FP_ABST
    Figure CN2023118725_20032025_PF_FP_ABST
Patent Text Reader

Abstract

A projection picture pre-processing method and apparatus, a keystone correction method and apparatus, a device, and a medium. The pre-processing method comprises: projecting a preset image, the preset image being an image comprising an identification code; obtaining a projection image acquired from a projection picture of the preset image; on the basis of the projection image, determining target corner coordinates; on the basis of the target corner coordinates, determining optical engine adjustment information, the optical engine adjustment information being used for adjusting corner coordinates, of the projection picture, in the projection image to the target corner coordinates; and on the basis of the optical engine adjustment information, generating a final projection picture. On the basis of the pre-processing method provided above, pre-processing of the projection picture can be implemented by only acquiring the projection image once, so that the time for acquiring the projection image in the pre-processing process of the projection picture is shortened, and the efficiency of the pre-processing of the projection picture is improved. In addition, a distance sensor is not required, and the pre-processing of the projection picture can be implemented only on the basis of the projection image, so that the cost of a projector is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Projection image preprocessing method, trapezoidal correction method, device, equipment and medium Technical Field

[0001] The present disclosure relates to the field of projection technology, and in particular to a projection image preprocessing method, a trapezoidal correction method, a device, a device and a medium. Background Art

[0002] As a portable device with the function of rendering and playing pictures, the projector is widely popular in the fields of home / teaching / office. However, compared with TV screens, the clarity of the projection picture, whether the projection picture is rectangular, the size of the projection picture, etc. are greatly affected by the projection environment. Every time the scene is changed or the projector is moved, various projection parameters need to be readjusted (that is, the projection picture is processed). The projection picture preprocessing method in the related art needs to switch the projection picture or adjust the projection picture multiple times during the preprocessing process, and use the camera to continuously capture the switched projection picture or the adjusted projection picture. Since the projection image captured by the camera must be encoded before it can be sent down, after switching the projection picture or adjusting the projection picture, a certain delay is required to obtain the current projection picture. Therefore, the projection picture captured by the camera takes a long time, which makes the projection picture processing efficiency low. In addition, when preprocessing the projection picture, the projector needs to be equipped with a distance sensor to realize the projection picture preprocessing, which increases the cost of the projector and also increases the user's usage cost.

[0003] Summary of the Invention

[0004] In view of the above problems, the embodiments of the present disclosure provide a projection image preprocessing method, a trapezoidal correction method, an apparatus, a device and a medium to overcome the above problems or at least partially solve the above problems.

[0005] In a first aspect of the embodiments of the present disclosure, a projection image preprocessing method is disclosed, the method comprising:

[0006] Projecting a preset image, wherein the preset image is an image including an identification code;

[0007] Acquire a projection image captured from a projection screen of the preset image;

[0008] Determining target corner coordinates according to the projection image;

[0009] Determining optical-mechanical adjustment information according to the target corner point coordinates, wherein the optical-mechanical adjustment information is used to adjust the coordinates of the corner point of the projection picture in the projection image to the target corner point coordinates;

[0010] A final projection image is generated according to the optical-mechanical adjustment information.

[0011] A second aspect of the present disclosure discloses a trapezoidal correction method, the method comprising:

[0012] Detecting the coordinates of the corner points of the identification code in the projected image;

[0013] Determining a projector torsion angle parameter value according to the corner coordinates of the identification code in the projected image;

[0014] Inputting the projector torsion angle parameter value into a torsion angle calculation function to obtain the projector torsion angle;

[0015] The coordinates of corner points of a second target rectangle in the image area where the projection image is located are determined according to the projector twist angle, where the second target rectangle represents the area where the projection image is located after trapezoidal correction.

[0016] A third aspect of the present disclosure discloses a projection image preprocessing device, the device comprising:

[0017] A projection module, configured to project a preset image, wherein the preset image is an image including an identification code;

[0018] An acquisition module, configured to acquire a projection image captured from a projection screen of the preset image;

[0019] A first determining module, configured to determine the coordinates of a target corner point based on the projection image;

[0020] A second determining module is configured to determine optical-mechanical adjustment information according to the target corner point coordinates, wherein the optical-mechanical adjustment information is used to adjust the corner point coordinates of the projection picture in the projection image to the target corner point coordinates;

[0021] A generation module is used to generate a final projection image according to the optical machine adjustment information.

[0022] According to a fourth aspect of the present disclosure, a trapezoidal correction device is disclosed, the device comprising:

[0023] A detection module, used to detect the coordinates of corner points of the identification code in the projected image;

[0024] A third determining module is used to determine a projector torsion angle parameter value according to the coordinates of a corner point of the identification code in the projected image;

[0025] a calculation module, configured to input the projector torsion angle parameter value into a torsion angle calculation function to obtain the projector torsion angle;

[0026] The fourth determining module is configured to determine the coordinates of corner points of a second target rectangle in the image area where the projection image is located according to the projector twist angle, where the second target rectangle represents the area where the projection image is located after trapezoidal correction.

[0027] In a fifth aspect of the embodiments of the present disclosure, an electronic device is disclosed, comprising a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, the steps of the projection image preprocessing method described in the first aspect of the embodiments of the present disclosure, or the steps of the trapezoidal correction method described in the second aspect of the embodiments of the present disclosure are implemented.

[0028] In a sixth aspect of the embodiments of the present disclosure, a computer-readable storage medium is disclosed, on which a computer program is stored. When the computer program is executed by a processor, the steps of the projection image preprocessing method described in the first aspect of the embodiments of the present disclosure, or the steps of the trapezoidal correction method described in the second aspect of the embodiments of the present disclosure are implemented.

[0029] In the seventh aspect of the embodiments of the present disclosure, a computer program product is disclosed, including a computer program, which, when executed by a processor, implements the steps of the projection image preprocessing method described in the first aspect of the embodiments of the present disclosure, or the steps of the trapezoidal correction method described in the second aspect of the embodiments of the present disclosure.

[0030] The embodiments of the present disclosure include the following advantages:

[0031] In the disclosed embodiment, a preset image containing an identification code is projected, and a projection image captured for the projection screen of the preset image is acquired, and then the target corner coordinates are determined based on the projection image; then, based on the target corner coordinates, optical-mechanical adjustment information is determined, and the optical-mechanical adjustment information is used to adjust the corner coordinates of the projection screen in the projection image to the target corner coordinates; finally, the final projection screen is generated based on the optical-mechanical adjustment information. Since the projection screen preprocessing can be achieved by only capturing the projection image once during the projection screen preprocessing, the time consumed in acquiring the projection image during the projection screen preprocessing process is reduced, thereby improving the efficiency of the projection screen preprocessing. Furthermore, there is no need for a distance sensor, and the projection screen preprocessing can be achieved based solely on the projection image, thereby reducing the cost of the projector.

[0032] The above description is only an overview of the technical solution of the present disclosure. In order to more clearly understand the technical means of the present disclosure, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present disclosure more obvious and easy to understand, the specific implementation methods of the present disclosure are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or related technologies, the following is a brief introduction to the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0034] FIG1 is a schematic diagram of the working environment of a projector;

[0035] FIG2 is a flowchart of a method for preprocessing a projection image according to an embodiment of the present disclosure;

[0036] FIG3 is a schematic diagram of a preset image provided by an embodiment of the present disclosure;

[0037] FIG4 is a flowchart of another projection image preprocessing method provided by an embodiment of the present disclosure;

[0038] FIG5 is a schematic diagram of a two-dimensional code projection image and an image area where the projection image is located, provided by an embodiment of the present disclosure;

[0039] FIG6 is a schematic diagram of a binarized image, a simulated blank image, and a first target rectangle for avoiding obstacles provided by an embodiment of the present disclosure;

[0040] FIG7 is a flowchart of a method for determining target corner coordinates in the presence of an imaging medium according to an embodiment of the present disclosure;

[0041] FIG8 is a flowchart of a method for determining target corner coordinates in the presence of an imaging medium according to an embodiment of the present disclosure;

[0042] FIG9 is a flowchart of a trapezoidal correction method according to an embodiment of the present disclosure;

[0043] FIG10 is a schematic diagram of a projection screen trapezoidal correction according to an embodiment of the present disclosure;

[0044] FIG11 is a schematic diagram of a projection screen and a captured projection image provided by an embodiment of the present disclosure;

[0045] FIG12 is a schematic diagram of a torsion angle calculation function fitting provided by an embodiment of the present disclosure;

[0046] FIG13 is a schematic structural diagram of a projection image preprocessing device provided by an embodiment of the present disclosure;

[0047] FIG14 is a schematic structural diagram of a trapezoidal correction device provided in an embodiment of the present disclosure. Specific embodiments

[0048] To make the above-mentioned purposes, features, and advantages of the present disclosure more clearly understood, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of them. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments of the present disclosure without creative work are within the scope of protection of the present disclosure.

[0049] To facilitate understanding of the technical solutions provided by the present disclosure, the working environment of the projector is briefly described below. Figure 1 is a schematic diagram of the working environment of the projector. In Figure 1, 1 is the projector body, 2 is the camera, 3 is the projection screen, 4 is the imaging medium / wall, 5 is the projector lens, and 6 is the projection light. As shown in Figure 1, when the projector body is at a left / right / up / down / tilt angle relative to the imaging medium / wall, the projection screen will present a non-rectangular distortion state. At this time, the image can be adjusted by adjusting the four corner coordinates of the optical machine inside the projector to eventually achieve a rectangular shape. When the distance between the projector body and the imaging medium / wall changes, the clarity of the projection screen will change, presenting a defocused state. At this time, the distance between the optical drive and the lens can be changed by adjusting the motor inside the projector to adjust the clarity of the image and achieve a focused state. When the position of the imaging medium / obstacle is identified, the coordinates of the four corners of the optical machine inside the projector can be adjusted to allow a picture to enter the screen and avoid the obstacle.

[0050] A projection image preprocessing method provided by an embodiment of the present disclosure is shown in FIG2 , which is a flowchart of the steps of a projection image preprocessing method provided by an embodiment of the present disclosure. As shown in FIG2 , the method may include steps S210 to S250:

[0051] Step S210: Projecting a preset image, wherein the preset image is an image including an identification code.

[0052] In the embodiment of the present disclosure, preprocessing refers to at least one of the following processes: imaging medium detection, projection screen adjustment (for example, adjusting the projection screen to a rectangle, adjusting the projection screen to within the imaging medium), and projection screen obstacle avoidance. The identification code in the preset image enables the image to have position identification information. The identification code is a code image with position identification information. The identification code can be a QR code, bar code, etc. with position identification information. Different preset images can be designed according to different algorithms. For example, Figure 3 is a schematic diagram of a preset image provided by an embodiment of the present disclosure. The identification code in the preset image is a QR code. Specifically, the preset image contains 4 ARUCO QR codes. ARUCO is often used for positioning in industry.

[0053] In a specific embodiment, upon detecting a projection image preprocessing instruction, the projector projects a preset image so that the camera can capture a projection image of the projection image. Specifically, the projection image preprocessing instruction is generated directly after the projector's operating environment changes; the projection image preprocessing instruction can also be generated after the projector completes coarse focus (i.e., adjusts the clarity of the projected image).

[0054] Step S220: Acquire a projection image captured from the projection screen of the preset image.

[0055] In the disclosed embodiment, the projection image is captured by a camera. As shown in FIG1 , the camera is located below the projector lens. After the projector projects a projection screen of a preset image, the camera captures the projection image corresponding to the projection screen.

[0056] Step S230: Determine the coordinates of the target corner points according to the projected image.

[0057] In the disclosed embodiments, the target corner coordinates refer to the coordinates corresponding to the four corners of the final projection image after the projection image preprocessing is completed. Specifically, the final projection image is calculated based on the projected image, and the coordinates corresponding to the four corners of the calculated final projection image are then determined as the target corner coordinates.

[0058] Step S240: determining optical-mechanical adjustment information according to the target corner point coordinates, wherein the optical-mechanical adjustment information is used to adjust the corner point coordinates of the projection picture in the projection image to the target corner point coordinates.

[0059] In the disclosed embodiments, the corner point coordinates in the projected image refer to the coordinates corresponding to the four corners of the projected image. Adjusting the corner point coordinates in the projected image to the target corner point coordinates is equivalent to adjusting the current projected image to the target projected image. Adjustment of the projected image is achieved by adjusting the optical-mechanical coordinates of the projector. Different optical-mechanical coordinates correspond to different projected images. Based on the adjustment of the corner point coordinates of the projected image to the target corner point coordinates, corresponding optical-mechanical adjustment information is generated, where the optical-mechanical adjustment information refers to the coordinate adjustment information of the projector's optical-mechanical coordinates.

[0060] Step S250: generating a final projection image according to the optical-mechanical adjustment information.

[0061] In the embodiment of the present disclosure, the optical-mechanical coordinates of the projector are adjusted based on the optical-mechanical adjustment information to obtain a pre-processed projection image (ie, generate a final projection image).

[0062] In summary, in the embodiment of the present disclosure, a preset image containing an identification code is projected, and a projection image captured for the projection screen of the preset image is obtained, and then the target corner coordinates are determined based on the projection image; then, based on the target corner coordinates, the optical-mechanical adjustment information is determined, and the optical-mechanical adjustment information is used to adjust the corner coordinates of the projection screen in the projection image to the target corner coordinates; finally, the final projection screen is generated based on the optical-mechanical adjustment information. Since the projection screen preprocessing can be achieved by capturing the projection image only once during the projection screen preprocessing, the time spent on acquiring the projection image during the projection screen preprocessing is reduced, thereby improving the efficiency of the projection screen preprocessing. Moreover, there is no need to use a distance sensor, and the projection screen preprocessing can be achieved based only on the projection image, thereby reducing the cost of the projector.

[0063] 4 , FIG4 is a flowchart of another method for preprocessing a projection image provided by an embodiment of the present disclosure. The method may include steps S410 to S490:

[0064] Step S410: Projecting a preset image, where the preset image is an image including an identification code.

[0065] Step S420: Acquire a projection image captured from the projection screen of the preset image.

[0066] In the embodiment of the present disclosure, steps S410 to S430 may correspond to the relevant descriptions of the aforementioned steps S210 to S420, and will not be described again here to avoid repetition.

[0067] Step S430: obtaining a binary image according to the projected image.

[0068] In the embodiment of the present disclosure, it is considered that when the projector is working, it may project the projection picture onto an imaging medium, or it may directly project the projection picture onto a wall. Depending on the working environment of the projector (i.e., whether there is an imaging medium or not), the corresponding projection picture preprocessing method is also different (i.e., the method of determining the target corner coordinates is different). Therefore, after obtaining the projection image, it is necessary to perform imaging medium detection so that the target corner coordinates can be determined based on the imaging medium detection results and the image area where the projection picture is located. Imaging medium detection requires the use of a blank image for detection in order to reduce the switching of the projection picture and the number of times the projection image is captured. Therefore, the embodiment of the present disclosure directly processes the image area where the projection picture is located into a simulated blank image, and then performs imaging medium detection based on the simulated blank image.

[0069] In a specific embodiment, obtaining a binarized image according to the projected image includes steps S430-1 and S430-2:

[0070] Step S430 - 1 : obtaining an image area where the projection image is located according to the projection image.

[0071] In the disclosed embodiments, the projected image captured by the camera includes not only the image area where the projection screen is located, but also the image area outside the projection screen. The image area outside the projection screen does not require attention and increases the complexity of the algorithm calculation. Therefore, the image area where the projection screen is located is obtained from the projected image, and then the image area where the projection screen is located is binarized to obtain a binary image. For example, Figure 5 (a) is a schematic diagram of the projected image, and Figure 5 (b) is a schematic diagram of the image area where the projection screen is located.

[0072] Specifically, according to the projected image, the image area where the projection screen is located is obtained, including: detecting the projection corner point coordinates of the identification code in the projected image; obtaining the source corner point coordinates of the identification code in the preset image; determining a first perspective transformation matrix according to the projection corner point coordinates and the source corner point coordinates; and performing a perspective transformation on the projection image according to the first perspective transformation matrix to obtain the image area where the projection screen is located.

[0073] Perspective transformation refers to projecting an image from an original viewing plane to a new viewing plane to obtain an image on the new viewing plane. Perspective transformation is specifically implemented based on the perspective transformation matrix between the original image and the image on the new viewing plane. In the disclosed embodiment, a perspective transformation is performed on the projected image, projecting the projected image onto the viewing plane where the preset image resides, thereby obtaining the image region where the projection image resides. To implement the perspective transformation, a first perspective transformation matrix is ​​determined based on the coordinate positions of corresponding pixels between the projected image and the preset image. Specifically, the first perspective transformation matrix is ​​determined using the projection corner coordinates and the source corner coordinates. The projection corner coordinates refer to the coordinates of a point on the identification code in the projected image. For example, the coordinates of the upper left corner of the identification code in the projected image are used as the projection corner coordinates. In a specific implementation, the projection corner coordinates are obtained by detecting the projected image using an image processing algorithm library (e.g., the OpenCV algorithm library). The source corner coordinates refer to the coordinates of a point on the identification code in the preset image. For example, the coordinates of the upper left corner of the identification code in the preset image are used as the source corner coordinates. Since the preset image is pre-designed, the source corner coordinates are determined and recorded when the preset image is designed.

[0074] The projection corner coordinates and the source corner coordinates are a set of data pairs (i.e., the coordinate positions of the corresponding pixels), and then a first perspective transformation matrix is ​​determined based on the projection corner coordinates and the source corner coordinates. The first perspective transformation matrix can characterize the perspective change relationship between the preset image and the projected image, and then the projection image is perspective transformed according to the first perspective transformation matrix to obtain the image area where the projection screen is located. Specifically, the image area where the projection screen is located is the same size as the preset image, and then the coordinates of each pixel in the image area where the projection screen is located are traversed, and then the first perspective transformation matrix is ​​used to calculate the corresponding position of the coordinate in the projected image, and then the pixel value of the position in the projected image is assigned to the corresponding position in the image area where the projection screen is located. After completing the traversal of all pixels, the image area where the projection screen is located is obtained.

[0075] Step S430 - 2 : performing binarization processing on the image area where the projection image is located to obtain a binarized image.

[0076] In the embodiment of the present disclosure, in order to obtain a simulated blank image, the image area where the projection screen is located is binarized in this step to obtain a binarized image. Wherein, a binarized image means that the grayscale value of any pixel in the image is 0 (indicating black) or 255 (indicating white). In a specific implementation, the image area where the projection screen is located is Gaussian blurred, Canny edge map calculated, and binarized by calling the OpenCV library function in sequence to obtain a binarized image. Figure 6 (a) is a schematic diagram of the binarized image.

[0077] Step S440: erasing the identification code in the binary image to obtain a simulated blank image.

[0078] In the disclosed embodiment, the position and size of the identification code in the binary image are detected, and the identification code region in the binary image is determined. The pixels in the identification code region are then set to 0, thereby erasing the identification code in the binary image. Figure 6(b) is a schematic diagram of a simulated blank image.

[0079] Step S450: performing imaging medium detection on the simulated blank image to obtain an imaging medium detection result.

[0080] In the disclosed embodiment, the imaging medium refers to a device for displaying a projection image, such as a screen. An imaging medium detection algorithm is used to perform imaging medium detection on a simulated blank image to determine whether the simulated blank image has edge information of the imaging medium. If there is edge information of the imaging medium, the imaging medium detection result is that there is imaging medium. If there is no edge information of the imaging medium, the imaging medium detection result is that there is no imaging medium. The method for determining the target corner point coordinates corresponding to the presence or absence of imaging medium is different. The target corner point coordinates are determined based on the imaging medium detection result. Specifically, the execution of step S460 or step S470 is selected based on the imaging medium detection result.

[0081] Step S460: When the imaging medium detection result indicates that imaging medium is present, the target corner coordinates are determined according to the simulated blank image.

[0082] Step S470: When the imaging medium detection result is that there is no imaging medium, determine the target corner coordinates according to the projection image.

[0083] In the embodiment of the present disclosure, the implementation process of step S460 and step S470 will be described in detail later.

[0084] Step S480: determining optical-mechanical adjustment information according to the target corner point coordinates, wherein the optical-mechanical adjustment information is used to adjust the corner point coordinates of the projection picture in the projection image to the target corner point coordinates.

[0085] Step S490: generating a final projection image according to the optical-mechanical adjustment information.

[0086] In the embodiment of the present disclosure, step S480 and step S490 may correspond to the description of the aforementioned step S240 and step S250, and will not be repeated here to avoid repetition.

[0087] In the disclosed embodiments, the projected image is processed into a simulated blank image, and imaging medium detection is then performed based on this simulated blank image to determine the coordinates of the target corner points. This method only requires a single projection image acquisition to perform projection image preprocessing, reducing the time required to acquire the projection image during the preprocessing process and improving its efficiency. Furthermore, the method eliminates the need for a distance sensor for preprocessing, reducing the cost of the projector.

[0088] In an optional embodiment, when there is an imaging medium, the projected image needs to be adjusted to be displayed within the imaging medium. Referring to FIG. 7 , when the imaging medium detection result indicates that there is an imaging medium, the target corner coordinates are determined based on the simulated blank image, specifically including the following steps S710 to S760:

[0089] Step S710: Detecting the contour of the imaging medium from the simulated blank image.

[0090] In the disclosed embodiment, when an imaging medium is present, the projected image needs to be adjusted to the imaging medium for display. Therefore, the imaging medium outline must first be detected from a simulated blank image. In a specific implementation, if the imaging medium is present, the simulated blank image contains edge information of the imaging medium, and the imaging medium outline is determined based on this edge information.

[0091] Step S720: Determine the coordinates of the imaging medium corners according to the imaging medium outline.

[0092] In the disclosed embodiment, the imaging medium is shaped like a matrix. The imaging medium corner coordinates refer to the coordinates corresponding to the four corners of the imaging medium. The imaging medium's position in space can be determined based on the imaging medium corner coordinates. After determining the imaging medium corner coordinates, the execution of step S730 or steps S740 through S760 is determined based on the detection of the obstacle avoidance indicator.

[0093] Step S730: When no obstacle avoidance indication is detected, the coordinates of the imaging medium corner point are determined as the coordinates of the target corner point.

[0094] In the embodiment of the present disclosure, when no obstacle avoidance indication is detected, there is no need to perform obstacle avoidance processing. Since the shape of the imaging medium is rectangular, the coordinates of the corner points of the imaging medium can be directly determined as the coordinates of the target corner points.

[0095] Step S740: When the obstacle avoidance indication is detected, the image area in the imaging medium is obtained according to the coordinates of the corner points of the simulated blank image and the coordinates of the corner points of the imaging medium.

[0096] In the disclosed embodiment, when an obstacle avoidance instruction is detected, if an obstacle is detected within the image region where the projected image is located, obstacle avoidance processing is required to avoid the obstacle within the image region where the projected image is located. Specifically, if an obstacle is present, a screen entry calculation is first performed to obtain the projected image after entering the screen, that is, to obtain the image region within the imaging medium. Subsequent steps then perform obstacle avoidance calculations based on the image region within the imaging medium.

[0097] In a specific embodiment, according to the simulated blank image, according to the corner point coordinates of the simulated blank image and the corner point coordinates of the imaging medium, the image area in the imaging medium is obtained, including: obtaining the corner point coordinates of the simulated blank image; determining a second perspective transformation matrix according to the corner point coordinates of the simulated blank image and the corner point coordinates of the imaging medium; according to the second perspective transformation matrix, performing perspective transformation on the simulated blank image to obtain the image area in the imaging medium.

[0098] For example, the corner coordinates of the simulated blank image are equivalent to the corner coordinates of the image region where the projection image is located. The corner coordinates of the simulated blank image are expressed as projectimg_src = {P0, P1, P2, P3}; the corner coordinates of the imaging medium can be expressed as couter = {cp0, cp1, cp2, cp3}. The corner coordinates of the simulated blank image projectimg_src and the corner coordinates of the imaging medium couter form a data pair. A second perspective transformation matrix is ​​calculated based on the data pair. The second perspective transformation matrix can represent the perspective transformation relationship between the simulated blank image and the imaging medium. Then, the simulated blank image is perspective transformed according to the second perspective transformation matrix to obtain the image region within the imaging medium. Specifically, the coordinates of each pixel in the image region within the imaging medium are traversed, and then the second perspective transformation matrix is ​​used to calculate the corresponding position of the coordinate in the simulated blank image. Then, the pixel value of the position in the simulated blank image is assigned to the corresponding position in the image region within the imaging medium. After all pixels are traversed, the image region within the imaging medium is obtained.

[0099] Step S750: performing obstacle avoidance calculation on the image area within the imaging medium to obtain the coordinates of corner points of a first target rectangle for avoiding obstacles in the image area within the imaging medium.

[0100] In the disclosed embodiment, the largest rectangle determined in a 16:9 ratio within the image area of ​​the imaging medium after avoiding the obstacle is used as the first target rectangle, and the coordinates of the four vertices of the first target rectangle are then determined as the coordinates of the corner points of the first target rectangle. Figure 6(c) is a schematic diagram of the first target rectangle after avoiding the obstacle.

[0101] Step S760: Determine the corner point coordinates of the first target rectangle as the target corner point coordinates.

[0102] In the embodiment of the present disclosure, by determining the coordinates of the corner points of the first target rectangle as the target corner point coordinates, the projection image after final preprocessing is the area where the first target rectangle is located.

[0103] In an optional embodiment, when there is no imaging medium, since the shape of the projected image is a trapezoid, the projected image needs to be corrected to a rectangle for display. Referring to FIG8 , when the imaging medium detection result indicates that there is no imaging medium, the target corner coordinates are determined based on the projected image, specifically including the following steps S810 to S850:

[0104] Step S810: Correcting the projected image using a trapezoidal correction algorithm to obtain the coordinates of the corner points of the second target rectangle.

[0105] In an embodiment of the present disclosure, when the position of the projector facing the wall is not perpendicular, the projected image will show a non-rectangular deformed state, that is, the shape of the projected image is a trapezoid. The process of correcting the non-rectangular deformed projection image into a rectangle is called trapezoidal correction. The present disclosure proposes a projection image correction method (i.e., a projection image correction algorithm) to correct the projection image, and obtain the area where the projection image is located after trapezoidal correction, that is, the second target rectangle, and then determine the four vertex coordinates of the second target rectangle as the corner coordinates of the second target rectangle. After determining the corner coordinates of the second target rectangle, it is determined to execute step S820 or to execute steps S830 to S850 according to the detection of the obstacle avoidance indication. Since the trapezoidal correction algorithm does not need to be used with a distance sensor, the projection image captured by the camera is used to implement trapezoidal correction, thereby reducing the cost of the projector.

[0106] Step S820: When no obstacle avoidance indication is detected, the coordinates of the corner points of the second target rectangle are determined as the target corner point coordinates.

[0107] In the embodiment of the present disclosure, when no obstacle avoidance instruction is detected, there is no need to perform obstacle avoidance processing, and the corner point coordinates of the second target rectangle are directly determined as the target corner point coordinates.

[0108] Step S830: When the obstacle avoidance instruction is detected, the image area within the second target rectangle is obtained according to the coordinates of the corner points of the simulated blank image and the coordinates of the corner points of the second target rectangle.

[0109] In the embodiment of the present disclosure, when an obstacle avoidance instruction is detected, if an obstacle is detected in the image area where the projection screen is located, obstacle avoidance processing is also required to avoid the obstacle in the image area where the projection screen is located.

[0110] In a specific embodiment, the image area within the second target rectangle is obtained based on the corner point coordinates of the simulated blank image and the corner point coordinates of the second target rectangle, including: obtaining the corner point coordinates of the simulated blank image; performing a perspective transformation on the simulated blank image based on the corner point coordinates of the simulated blank image and the corner point coordinates of the second target rectangle to obtain the image area within the second target rectangle.

[0111] For example, the corner coordinates of the simulated blank image are equivalent to the corner coordinates of the image area where the projection screen is located. The corner coordinates of the simulated blank image are expressed as projectimg_src = {P0, P1, P2, P3}; the corner coordinates of the second target rectangle can be expressed as correct = {c0, c1, c2, c3}. The corner coordinates of the simulated blank image projectimg_src and the corner coordinates of the second target rectangle correct form a data pair. Then, the simulated blank image is perspective transformed to obtain the image area within the second target rectangle. Specifically, a third perspective transformation matrix is ​​determined based on the corner coordinates of the simulated blank image projectimg_src and the corner coordinates of the second target rectangle correct. This third perspective transformation matrix can represent the perspective transformation relationship between the simulated blank image and the image area within the second target rectangle. Then, the simulated blank image is perspective transformed based on the third perspective transformation matrix to obtain the image area within the second target rectangle. Specifically, the coordinates of each pixel of the second target rectangle are traversed, and then the corresponding position of the coordinate in the simulated blank image is calculated using the third perspective transformation matrix, and then the pixel value of the position in the simulated blank image is assigned to the corresponding position of the second target rectangle. After completing the traversal of all pixels, the image area within the second target rectangle is obtained.

[0112] Step S840: performing obstacle avoidance calculation on the image area within the second target rectangle to obtain the coordinates of corner points of a third target rectangle that avoids obstacles in the image area within the second target rectangle.

[0113] In the embodiment of the present disclosure, the largest rectangle determined in the image area of ​​the second target rectangle according to the 16:9 ratio after avoiding the obstacle is used as the third target rectangle, and the four vertex coordinates of the third target rectangle are determined as the corner point coordinates of the third target rectangle.

[0114] Step S850: Determine the corner point coordinates of the third target rectangle as the target corner point coordinates.

[0115] In the embodiment of the present disclosure, by determining the corner point coordinates of the third target rectangle as the target corner point coordinates, the final pre-processed projection image is the area where the third target rectangle is located.

[0116] The embodiment of the present disclosure also provides a trapezoidal correction method. When the position of the projector facing the imaging medium / wall is not perpendicular, the projected image will show a non-rectangular deformed state. The process of correcting this deformed state into a rectangle is called trapezoidal correction. The existing trapezoidal correction method requires an additional distance sensor to detect the projector torsion angle by measuring the distance from the projector to the imaging medium / wall, thereby achieving trapezoidal correction. The need for additional configuration of the distance sensor leads to an increase in the cost of the projector. Therefore, in order to achieve low-cost trapezoidal correction, the embodiment of the present disclosure also provides a trapezoidal correction method, which performs correction based on the projection image captured by the camera.

[0117] Referring to FIG9 , FIG9 is a flowchart of a trapezoidal correction method provided by an embodiment of the present disclosure. As shown in FIG9 , the method may include steps S910 to S940:

[0118] Step S910: Detecting the coordinates of the corner points of the identification code in the projected image.

[0119] Step S920: Determine a projector torsion angle parameter value according to the coordinates of the corner points of the identification code in the projected image.

[0120] Step S930: Inputting the projector torsion angle parameter value into a torsion angle calculation function to obtain the projector torsion angle.

[0121] Step S940: determining the coordinates of corner points of a second target rectangle in the image area where the projection image is located according to the projector twist angle, where the second target rectangle represents the area where the projection image is located after trapezoidal correction.

[0122] In the disclosed embodiments, the corner coordinates of the identification code in the projected image refer to the coordinates of a location on the identification code in the projected image. For example, the coordinates of the top-left corner of the identification code in the projected image are used as the corner coordinates of the identification code in the projected image. In a specific implementation, the projected image is detected using an image processing algorithm library (e.g., the OpenCV algorithm library) to obtain the corner coordinates of the identification code in the image area where the projection screen is located.

[0123] Then, based on the coordinates of the corner points of the identification code in the projected image, the projector twist angle parameter value is determined. The projector twist angle parameter value refers to a parameter value affected by the projection twist angle. Different projector twist angles correspond to different projector twist angle parameter values. There is a certain mapping relationship between the twist angle parameter value and the twist angle. This mapping relationship can be represented by a twist angle calculation function. Therefore, after the projector twist angle parameter value, the projector twist angle parameter value is input into the twist angle calculation function to obtain the projector twist angle.

[0124] After obtaining the projector's torsion angle, a coordinate system can be constructed in three-dimensional space to calculate the adjusted projector's optical and mechanical coordinates. The specific adjustment principle is to determine the largest inscribed rectangle in the image area where the projection screen is located according to the 16:9 ratio as the second target rectangle, and then determine the four vertex coordinates of the second target rectangle as the corner coordinates of the second target rectangle. The second target rectangle is the area where the projection screen is located after trapezoidal correction, thereby correcting the trapezoidal projection screen to a rectangular projection screen for display. Since this method can achieve trapezoidal correction based on the projection image captured by the camera, it does not require a distance sensor, thereby reducing the cost of the projector.

[0125] For example, FIG10 is a schematic diagram of a trapezoidal correction of a projection screen provided by an embodiment of the present disclosure, wherein the dotted trapezoidal frame represents the trapezoidal projection screen twisted on the left side of the projector, and the solid matrix frame represents the projection screen after trapezoidal correction. Specifically, the coordinates of the four corners of the light machine when the left side of the projector is twisted are: lower left (0, 0), lower right (1920, 0), upper right (1920, 1080), and upper left (0, 1080). After obtaining the projector torsion angle according to the above steps S910 to S930, the maximum inscribed rectangle (i.e., the second target matrix) is determined in the trapezoidal projection screen at a ratio of 16:9, and the optical machine coordinates corresponding to the second target matrix are used as the adjusted optical machine coordinates, as shown in FIG10. The positions of the two optical machine coordinates on the right side (upper right and lower right) are kept unchanged, and the upper left and lower left are adjusted to (30, 960) and (30, 40), respectively. In actual applications, after determining the adjusted optical machine coordinates, the optical machine can be driven by calling the API driver interface of the projector to drive the optical machine coordinates, so as to obtain the projection image after trapezoidal correction, that is, the projection image corresponding to the second target matrix.

[0126] In an optional embodiment, the torsion angle calculation function is used to characterize the mapping relationship between the torsion angle parameter value and the torsion angle. The torsion angle calculation function satisfies a quadratic linear relationship and is expressed as: y=ax2+bx+c

[0127] Where x represents the torsion angle parameter value, y represents the torsion angle, and a, b, and c represent the fitting coefficient values ​​of the torsion angle calculation function.

[0128] In a specific embodiment, the fitting coefficient values ​​a, b, and c of the torsion angle calculation function are pre-fitted and determined, and then after the torsion angle parameter value is brought into the torsion angle calculation function, the projector torsion angle can be calculated.

[0129] In an optional embodiment, the method for determining the projector twist angle parameter value varies depending on the number of identification codes in the preset image. Specifically, if the number of identification codes is four, determining the projector twist angle parameter value based on the coordinates of the corner points of the identification codes in the projected image includes steps A1 to A4:

[0130] Step A1: Determine a quadrilateral according to the coordinates of the corner points of the identification code in the projection image.

[0131] Step A2: Determine angle values ​​of the four corners of the quadrilateral, where the four corners include an upper left corner, an upper right corner, a lower left corner, and a lower right corner.

[0132] Step A3: Determine a first angle difference and a second angle difference based on the angle values ​​of the four corners of the quadrilateral, wherein the first angle difference is the angle difference between the upper left corner and the upper right corner of the quadrilateral, and the second angle difference is the angle difference between the lower left corner and the lower right corner of the quadrilateral.

[0133] Step A4: Determine the sum of the angle difference between the first angle difference and the second angle difference as the projector twist angle parameter value.

[0134] For example, Figure 11 illustrates the projected image and the captured projection image under different projection modes. 1(a) and 1(b) in Figure 11 show the projected image as seen by the human eye and the projected image actually captured by the camera when the projector is projecting forward. 2(a) and 2(b) in Figure 10 show the projected image as seen by the human eye and the projected image actually captured by the camera when the projector is rotated 15 degrees clockwise. The solid-line box represents the projected image, and the dashed-line box represents the captured image by the camera. When the projector projects forward perpendicular to the imaging medium / wall, the projected image appears as a downward-pointing trapezoid due to the inherent upward offset of the optical engine. Because the camera is installed at an upward angle of approximately 5 degrees (this upward angle is greater than the offset angle of the optical engine), the image captured by the camera also appears as a downward-pointing trapezoid from the human eye. However, the actual projected image captured by the camera is necessarily rectangular, so the captured image is compressed into an upward-pointing trapezoid. When the projector is rotated 15 degrees clockwise, the image seen by the human eye appears as a left-facing trapezoid. The right side is blurred due to the elongated distance between the optical engine and the imaging medium / wall, while the left side is relatively clear because the distance between the optical engine and the imaging medium / wall is shorter than the right side. The camera rotates with the projector, and its relative position to the optical engine remains unchanged. Therefore, the captured projected image is also stretched into a left-facing trapezoid. However, unlike the image captured by the optical engine, the edge of the image captured by the camera does not become blurred. Moreover, because there is no horizontal position between the camera and the optical engine, the left-right relative position of the projected image and the captured projected image remains unchanged.

[0135] Due to the above characteristics, the projection image captured by the camera must be rectangular. Therefore, when the camera captures the projection image and encodes it, the distorted projection image will be compressed accordingly. The captured projection image is rectangular, the upper right part of the projection image is compressed to the lower left, and the lower right part is compressed to the upper left. The final projection image is the quadrilateral abcd shown in (2b) in Figure 11, where ∠a is the upper left corner, ∠c is the upper right corner, ∠b is the lower left corner, and ∠d is the lower right corner. At this time, relative to the captured image of the front projection, the angle of ∠c becomes larger, the angle of ∠d becomes smaller, the angle of ∠a becomes smaller, and the angle of ∠b becomes larger. It is worth noting that it is difficult for the naked eye to distinguish the changes in these angles. Because the relative positions of the camera and the optical machine remain unchanged, the changes in these angles are slight. Tests have found that the difference is only about 2 degrees. If used directly, it may cause the accuracy of the designed algorithm to calculate the torsion angle to be difficult to meet the requirements.

[0136] By observing (2b) in 11, we can conclude that:

[0137] When the projector is twisted to the right, ∠a becomes smaller and ∠c becomes larger, so the first angle difference (∠a-∠c) should be a negative number, and its absolute value increases as the twist angle increases; ∠b becomes larger and ∠d becomes smaller, so the second angle difference (∠d-∠b) is a negative number, and its absolute value increases as the twist angle increases;

[0138] When the projector is twisted to the left, the angle changes in the opposite direction: ∠a becomes larger, ∠c becomes smaller, the first angle difference (∠a-∠c) is a positive number, and its absolute value increases as the twist angle increases; ∠b becomes smaller, ∠d becomes larger, the second angle difference (∠d-∠b) is a positive number, and its absolute value increases as the twist angle increases.

[0139] Therefore, the sum of the first and second angle differences is determined as the projector twist angle parameter value, i.e., the projector twist angle parameter value is (∠a - ∠c) + (∠d - ∠b). Based on this projector twist angle parameter value, the angular variation difference is amplified from 2 degrees to 8 degrees, and the projector's deflection direction can be determined based on the positive or negative sign of the first and second angle differences.

[0140] Specifically, the deflection direction of the projector is determined in the following manner: when the first angle difference and the second angle difference are both less than zero, the deflection direction of the projector is determined to be deflected to the right; when the first angle difference and the second angle difference are both greater than zero, the deflection direction of the projector is determined to be deflected to the left.

[0141] In a specific embodiment, the torsion angle calculation function is determined according to the following steps B1 and B2:

[0142] Step B1: obtaining a first set of parameter values ​​representing the torsion angle parameter value, and obtaining a second set of parameter values ​​representing the torsion angle, wherein the first set of parameter values ​​and the second set of parameter values ​​have a one-to-one correspondence;

[0143] That is, if there are 10 data in the first set of data, then the 10 data in the second set of data correspond to the 10 data in the first set of data, and then fitting can be performed based on the one-to-one correspondence to determine the mapping relationship.

[0144] Specifically, obtaining a first set of parameter values ​​representing the torsion angle parameter value, and obtaining a second set of parameter values ​​representing the torsion angle include:

[0145] Twisting the projector by N degrees, using N degrees as one parameter value in the second set of parameter values, and calculating a twist angle parameter value when the projector is twisted by N degrees, using the calculated twist angle parameter value as one parameter value in the first set of parameter values;

[0146] In the direction of twisting to -N degrees, twist once every M degrees until the projector is twisted to -N degrees, and use the twisting angle after each twisting as a parameter value in the second set of parameter values, and calculate the twisting angle parameter value after each twisting, and use the calculated twisting angle parameter value as a parameter value in the first set of parameter values.

[0147] In the embodiment of the present disclosure, twisting the projector N degrees means twisting it N degrees counterclockwise in the horizontal plane. Specifically, an XYZ coordinate system of the projector is constructed with the center of the projector lens as the origin of the coordinate system, the Y-axis is parallel to the projector lens, the X-axis is perpendicular to the projector lens in the horizontal plane, and the Z-axis is perpendicular to the X-axis and the Y-axis. In this coordinate system, twisting the projector N degrees means twisting the projector lens N degrees counterclockwise in the XOY plane (i.e., the horizontal plane).

[0148] Furthermore, in conjunction with the quadrilateral shown in FIG11 , with N equal to 30 degrees and M equal to 5 degrees, the method for obtaining the first set of parameter values ​​and the second set of parameter values ​​is explained. First, the projector is twisted 30 degrees counterclockwise in the horizontal plane as the starting position, recorded as y=30, and the corresponding value of x=(∠a-∠c)+(∠d-∠b) is recorded. Then, the projector is twisted clockwise every 5 degrees, and the y value is subtracted by 5 while the x value is recorded. When the projector is twisted to y=-30, it is recorded once and the data collection is terminated. At this point, a total of 13 pairs of one-to-one corresponding data are obtained. Table 1 is an example of the first and second sets of data collected.

[0149] Table 1 Examples of the first and second sets of data collected

[0150] Step B2: Fitting the first set of parameter values ​​and the second set of parameter values ​​to obtain the torsion angle calculation function.

[0151] In the disclosed embodiment, Table 1 shows that the torsion angle parameter values ​​and the torsion angle exhibit a positive correlation. Specifically, the least squares method is used to fit the first and second sets of parameter values ​​to obtain a torsion angle calculation function. FIG12 illustrates the results of fitting the data shown in Table 1, where the legend "date" represents the curve drawn based on the data in Table 1, and the legend "fit" represents the fitted curve. Through fitting, the torsion angle calculation function y = 0.104x² + 5.246x - 0.893 is obtained. The torsion angle calculation function is determined for each projector upon completion of production.

[0152] The present disclosure also provides a projection image preprocessing device, as shown in FIG13 , which is a schematic structural diagram of a projection image preprocessing device provided by the present disclosure. The device includes:

[0153] The projection module 1310 is used to project a preset image, where the preset image is an image including an identification code;

[0154] An acquisition module 1320 is configured to acquire a projection image captured from a projection screen of the preset image;

[0155] A first determining module 1330 is configured to determine the coordinates of a target corner point based on the projection image;

[0156] A second determining module 1340 is configured to determine optical-mechanical adjustment information according to the target corner point coordinates, wherein the optical-mechanical adjustment information is used to adjust the coordinates of the corner point of the projection picture in the projection image to the target corner point coordinates;

[0157] The generating module 1350 is configured to generate a final projection image according to the optical-mechanical adjustment information.

[0158] In an optional embodiment, the first determining module includes:

[0159] A binarization module, configured to obtain a binarized image based on the projection image;

[0160] an erasing module, configured to erase the identification code in the binary image to obtain a simulated blank image;

[0161] a medium detection module, configured to perform imaging medium detection on the simulated blank image to obtain an imaging medium detection result;

[0162] The first determination submodule is configured to determine the target corner coordinates according to the simulated blank image when the imaging medium detection result indicates that imaging medium is present.

[0163] In an optional embodiment, the first determining module includes:

[0164] A binarization module, configured to obtain a binarized image based on the projection image;

[0165] an erasing module, configured to erase the identification code in the binary image to obtain a simulated blank image;

[0166] a medium detection module, configured to perform imaging medium detection on the simulated blank image to obtain an imaging medium detection result;

[0167] The second determination submodule is configured to determine the coordinates of a target corner point according to the projection image when the imaging medium detection result is that there is no imaging medium.

[0168] In an optional embodiment, the first determining submodule includes:

[0169] A first detection submodule is configured to detect an imaging medium contour from the simulated blank image;

[0170] A medium corner point determination module, configured to determine the coordinates of the imaging medium corner points according to the imaging medium contour;

[0171] The first target corner point module is used to determine the imaging medium corner point coordinates as the target corner point coordinates when no obstacle avoidance indication is detected.

[0172] In an optional embodiment, the first determining submodule includes:

[0173] A contour detection module, configured to detect a contour of an imaging medium from the simulated blank image;

[0174] A medium corner point determination module, configured to determine the coordinates of the imaging medium corner points according to the imaging medium contour;

[0175] A first region acquisition module is configured to, when the obstacle avoidance instruction is detected, obtain an image region in the imaging medium based on the coordinates of the corner points of the simulated blank image and the coordinates of the corner points of the imaging medium;

[0176] a first obstacle avoidance calculation module, configured to perform obstacle avoidance calculation on the image area within the imaging medium to obtain the coordinates of corner points of a first target rectangle that avoids obstacles in the image area within the imaging medium;

[0177] The second target corner point module is configured to determine the coordinates of the corner points of the first target rectangle as the target corner point coordinates.

[0178] In an optional embodiment, the second determining submodule includes:

[0179] a correction module, configured to correct the projected image using a trapezoidal correction algorithm to obtain the coordinates of the corner points of a second target rectangle;

[0180] The third target corner point module is configured to determine the corner point coordinates of the second target rectangle as the target corner point coordinates when no obstacle avoidance indication is detected.

[0181] In an optional embodiment, the second determining submodule includes:

[0182] a correction module, configured to correct the projected image using a trapezoidal correction algorithm to obtain the coordinates of the corner points of a second target rectangle;

[0183] a second region acquisition module configured to, when the obstacle avoidance instruction is detected, obtain an image region within the second target rectangle based on the coordinates of the corner points of the simulated blank image and the coordinates of the corner points of the second target rectangle;

[0184] A second obstacle avoidance calculation module is used to perform obstacle avoidance calculation on the image area within the second target rectangle to obtain the coordinates of the corner points of a third target rectangle that avoids obstacles in the image area within the second target rectangle;

[0185] The fourth target corner point module is configured to determine the corner point coordinates of the third target rectangle as the target corner point coordinates.

[0186] In an optional embodiment, the first region acquisition module includes:

[0187] A first acquisition submodule is used to obtain the coordinates of the corner points of the simulated blank image;

[0188] a matrix determination module, configured to determine a second perspective transformation matrix based on the coordinates of the corner points of the simulated blank image and the coordinates of the corner points of the imaging medium;

[0189] The first perspective transformation module is configured to perform perspective transformation on the simulated blank image according to the second perspective transformation matrix to obtain an image region within the imaging medium.

[0190] In an optional embodiment, the second region acquisition module includes:

[0191] A second acquisition submodule is used to obtain the coordinates of the corner points of the simulated blank image;

[0192] The second perspective transformation module is used to perform perspective transformation on the simulated blank image according to the corner point coordinates of the simulated blank image and the corner point coordinates of the second target rectangle to obtain the image area within the second target rectangle.

[0193] In an optional embodiment, the binarization module includes:

[0194] A third acquisition submodule is configured to obtain an image area where the projection image is located based on the projection image;

[0195] The binarization processing module is used to perform binarization processing on the image area where the projection image is located to obtain a binarized image.

[0196] In an optional embodiment, the third acquisition submodule includes:

[0197] A second detection submodule is used to detect the coordinates of the projection corner points of the identification code in the projection image;

[0198] A fourth acquisition submodule is used to obtain the source corner coordinates of the identification code in the preset image;

[0199] A third determining submodule, configured to determine a first perspective transformation matrix according to the projection corner point coordinates and the source corner point coordinates;

[0200] The third perspective transformation module is used to perform perspective transformation on the projection image according to the first perspective transformation matrix to obtain the image area where the projection picture is located.

[0201] The present disclosure also provides a trapezoidal correction device, as shown in FIG14 , which is a schematic structural diagram of a trapezoidal correction device provided by the present disclosure. The device includes:

[0202] Detection module 1410, used to detect the coordinates of corner points of the identification code in the projected image;

[0203] A third determining module 1420 is configured to determine a projector torsion angle parameter value based on the coordinates of a corner point of the identification code in the projected image;

[0204] A calculation module 1430 is configured to input the projector torsion angle parameter value into a torsion angle calculation function to obtain the projector torsion angle;

[0205] The fourth determining module 1440 is configured to determine the coordinates of corner points of a second target rectangle in the image region where the projection image is located according to the projector twist angle, where the second target rectangle represents the region where the projection image is located after trapezoidal correction.

[0206] In an optional embodiment, the number of the identification codes is four, and the third determining module includes:

[0207] A fourth determining submodule is configured to determine a quadrilateral according to the coordinates of corner points of the identification code in the image area where the projection image is located;

[0208] a fifth determining submodule, configured to determine angle values ​​of four corners of the quadrilateral, the four corners comprising an upper left corner, an upper right corner, a lower left corner, and a lower right corner;

[0209] a sixth determining submodule, configured to determine a first angle difference and a second angle difference according to the angle values ​​of the four corners of the quadrilateral, wherein the first angle difference is the angle difference between the upper left corner and the upper right corner of the quadrilateral, and the second angle difference is the angle difference between the lower left corner and the lower right corner of the quadrilateral;

[0210] The seventh determining submodule is configured to determine the sum of the first angle difference and the second angle difference as the projector twist angle parameter value.

[0211] In an optional embodiment, the device further includes:

[0212] a first direction determining module, configured to determine that the deflection direction of the projector is rightward deflection when both the first angle difference and the second angle difference are less than zero;

[0213] The second direction determining module is configured to determine that the deflection direction of the projector is leftward deflection when both the first angle difference and the second angle difference are greater than zero.

[0214] In an optional embodiment, the device includes a function determination module for determining the torsion angle calculation function, and the function determination module includes:

[0215] a data acquisition module, configured to acquire a first set of parameter values ​​representing the torsion angle parameter value, and to acquire a second set of parameter values ​​representing the torsion angle, wherein the first set of parameter values ​​corresponds to the second set of parameter values ​​in a one-to-one manner;

[0216] A data fitting module is used to fit the first set of parameter values ​​and the second set of parameter values ​​to obtain the torsion angle calculation function.

[0217] In an optional embodiment, the data acquisition module includes:

[0218] a first data acquisition submodule, configured to twist the projector by N degrees, using N degrees as one parameter value in the second set of parameter values, and to calculate a twist angle parameter value when the projector is twisted by N degrees, using the calculated twist angle parameter value as one parameter value in the first set of parameter values;

[0219] The second data acquisition submodule is used to twist the projector every M degrees in the direction of twisting to -N degrees until the projector is twisted to -N degrees, use the twisting angle after each twisting as a parameter value in the second set of parameter values, calculate the twisting angle parameter value after each twisting, and use the calculated twisting angle parameter value as a parameter value in the first set of parameter values.

[0220] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0221] An embodiment of the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the projection image preprocessing method described in the embodiment of the present disclosure, or the steps of the trapezoidal correction method described in the embodiment of the present disclosure are implemented.

[0222] The embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the projection image preprocessing method described in the embodiment of the present disclosure or the steps of the trapezoidal correction method described in the embodiment of the present disclosure are implemented.

[0223] The embodiments of the present disclosure further provide a computer program product, including a computer program, which, when executed by a processor, implements the steps of the projection image preprocessing method described in the embodiments of the present disclosure, or the steps of the trapezoidal correction method described in the embodiments of the present disclosure.

[0224] References herein to "one embodiment," "an embodiment," or "one or more embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present disclosure. Furthermore, please note that instances of the phrase "in one embodiment" do not necessarily all refer to the same embodiment.

[0225] In the description provided herein, numerous specific details are described. However, it is understood that embodiments of the present disclosure may be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this description.

[0226] In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in the claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present disclosure may be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.

[0227] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present disclosure.

Claims

1. A projection picture preprocessing method, characterized in that: The method comprises: Projecting a preset image, wherein the preset image is an image including an identification code; Acquire a projection image captured from a projection screen of the preset image; Determine the coordinates of the target corner points according to the projection image; Determining optical-mechanical adjustment information according to the target corner point coordinates, wherein the optical-mechanical adjustment information is used to adjust the corner point coordinates of the projection picture in the projection image to the target corner point coordinates; A final projection image is generated according to the optical-mechanical adjustment information.

2. The method according to claim 1, characterized in that Determining the target corner point coordinates according to the projection image includes: According to the projection image, a binary image is obtained; Erasing the identification code in the binary image to obtain a simulated blank image; Performing imaging medium detection on the simulated blank image to obtain an imaging medium detection result; When the imaging medium detection result indicates that there is imaging medium, the target corner point coordinates are determined according to the simulated blank image.

3. The method according to claim 1, characterized in that Determining the target corner point coordinates according to the projection image includes: According to the projection image, a binary image is obtained; Erasing the identification code in the binary image to obtain a simulated blank image; Performing imaging medium detection on the simulated blank image to obtain an imaging medium detection result; When the imaging medium detection result is that there is no imaging medium, the target corner point coordinates are determined according to the projection image.

4. The method according to claim 2, characterized in that: When the imaging medium detection result indicates that there is an imaging medium, determining the target corner point coordinates according to the simulated blank image includes: detecting an imaging medium contour from the simulated blank image; Determining the coordinates of the imaging medium corners according to the imaging medium contour; In the case where no obstacle avoidance indication is detected, the imaging medium corner point coordinates are determined as the target corner point coordinates.

5. The method according to claim 2, characterized in that: When the imaging medium detection result indicates that there is an imaging medium, determining the target corner point coordinates according to the simulated blank image includes: detecting an imaging medium contour from the simulated blank image; Determining the coordinates of the imaging medium corners according to the imaging medium contour; When the obstacle avoidance indication is detected, obtaining an image area in the imaging medium according to the coordinates of the corner points of the simulated blank image and the coordinates of the corner points of the imaging medium; Performing obstacle avoidance calculation on the image area in the imaging medium to obtain the corner point coordinates of a first target rectangle that avoids obstacles in the image area in the imaging medium; The corner point coordinates of the first target rectangle are determined as the target corner point coordinates.

6. The method according to claim 3, characterized in that When the imaging medium detection result is that there is no imaging medium, determining the target corner point coordinates according to the projection image includes: Correcting the projected image using a trapezoidal correction algorithm to obtain the coordinates of the corner points of the second target rectangle; When no obstacle avoidance indication is detected, the corner point coordinates of the second target rectangle are determined as the target corner point coordinates.

7. The method according to claim 3, characterized in that When the imaging medium detection result is that there is no imaging medium, determining the target corner point coordinates according to the projection image includes: Correcting the projected image using a trapezoidal correction algorithm to obtain the coordinates of the corner points of the second target rectangle; When the obstacle avoidance indication is detected, obtaining an image area within the second target rectangle according to the coordinates of the corner points of the simulated blank image and the coordinates of the corner points of the second target rectangle; Performing obstacle avoidance calculation on the image area within the second target rectangle to obtain the coordinates of corner points of a third target rectangle that avoids obstacles in the image area within the second target rectangle; The corner point coordinates of the third target rectangle are determined as the target corner point coordinates.

8. The method according to claim 5, characterized in that Obtaining an image area in the imaging medium according to the coordinates of the corner points of the simulated blank image and the coordinates of the corner points of the imaging medium, including: Obtaining the coordinates of the corner points of the simulated blank image; Determining a second perspective transformation matrix according to the coordinates of the corner points of the simulated blank image and the coordinates of the corner points of the imaging medium; According to the second perspective transformation matrix, the simulated blank image is perspective transformed to obtain the image area in the imaging medium.

9. The method according to claim 7, characterized in that: Obtaining the image area in the second target rectangle according to the corner point coordinates of the simulated blank image and the corner point coordinates of the second target rectangle includes: Obtaining the coordinates of the corner points of the simulated blank image; According to the coordinates of the corner points of the simulated blank image and the coordinates of the corner points of the second target rectangle, the simulated blank image is perspective transformed to obtain the image area within the second target rectangle.

10. The method according to any one of claims 1 to 9, characterized in that: The step of obtaining a binary image according to the projection image comprises: According to the projection image, obtaining an image area where the projection image is located; The image region where the projection image is located is binarized to obtain a binarized image.

11. The method according to claim 10, characterized in that According to the projection image, obtaining an image area where the projection image is located includes: Detecting the projection corner coordinates of the identification code in the projection image; Obtaining the source corner point coordinates of the identification code in the preset image; Determine a first perspective transformation matrix according to the projection corner point coordinates and the source corner point coordinates; The projection image is perspective transformed according to the first perspective transformation matrix to obtain an image region where the projection image is located.

12. A trapezoidal correction method, characterized in that: include: Detecting the corner coordinates of the identification code in the projected image; Determine the projector torsion angle parameter value according to the corner point coordinates of the identification code in the projection image; Inputting the projector torsion angle parameter value into a torsion angle calculation function to obtain the projector torsion angle; According to the projector twist angle, the coordinates of the corner points of a second target rectangle in the image area where the projection picture is located are determined, and the second target rectangle represents the area where the projection picture is located after trapezoidal correction.

13. The method according to claim 12, characterized in that The number of the identification codes is four; determining the projector twist angle parameter value according to the corner point coordinates of the identification codes in the projection image, including: Determine a quadrilateral according to the coordinates of the corner points of the identification code in the projection image; Determine angle values ​​of four corners of the quadrilateral, the four corners comprising an upper left corner, an upper right corner, a lower left corner, and a lower right corner; According to the angle values ​​of the four corners of the quadrilateral, the first angle difference and the second angle difference are determined. The first angle difference is the angle difference between the upper left corner and the upper right corner of the quadrilateral, and the second angle difference is the angle difference between the lower left corner and the lower right corner of the quadrilateral; The angle difference and value between the first angle difference and the second angle difference are determined as the projector twist angle parameter value.

14. The method according to claim 13, characterized in that The method further comprises: When the first angle difference and the second angle difference are both less than zero, determining that the deflection direction of the projector is rightward deflection; When both the first angle difference and the second angle difference are greater than zero, it is determined that the deflection direction of the projector is deflected to the left.

15. The method according to claim 12, characterized in that The torsion angle calculation function is determined according to the following steps: Acquire a first group of parameter values ​​representing the torsion angle parameter value, and acquire a second group of parameter values ​​representing the torsion angle, wherein the first group of parameter values ​​corresponds to the second group of parameter values ​​in a one-to-one manner; The first group of parameter values ​​and the second group of parameter values ​​are fitted to obtain the torsion angle calculation function.

16. The method according to claim 15, characterized in that Obtaining a first set of parameter values ​​representing the torsion angle parameter value, and obtaining a second set of parameter values ​​representing the torsion angle, including: Twisting the projector by N degrees, taking N degrees as one of the parameter values ​​in the second group of parameter values, and calculating a twist angle parameter value when the projector is twisted by N degrees, taking the calculated twist angle parameter value as one of the parameter values ​​in the first group of parameter values; In the direction of twisting to -N degrees, twist once every M degrees until the projector is twisted to -N degrees, use the twisting angle after each twisting as the parameter value in the second set of parameter values, calculate the twisting angle parameter value after each twisting, and use the calculated twisting angle parameter value as a parameter value in the first set of parameter values.

17. A projection picture preprocessing device, characterized in that: The device comprises: A projection module, used for projecting a preset image, wherein the preset image is an image including an identification code; An acquisition module, used to acquire a projection image captured from a projection screen of the preset image; A first determination module, used to determine the coordinates of the target corner point according to the projection image; The second determination module is used to determine the optical-mechanical adjustment information according to the target corner point coordinates, and the optical-mechanical adjustment information is used to adjust the corner point coordinates of the projection picture in the projection image to the Target corner coordinates; A generation module is used to generate a final projection picture according to the optical-mechanical adjustment information.

18. A trapezoidal correction device, characterized in that: The device comprises: A detection module, used to detect the coordinates of corner points of the identification code in the projection image; A third determination module is used to determine the projector torsion angle parameter value according to the corner point coordinates of the identification code in the projection image; A calculation module, used for inputting the projector torsion angle parameter value into a torsion angle calculation function to obtain the projector torsion angle; The fourth determination module is used to determine the corner point coordinates of a second target rectangle in the image area where the projection picture is located according to the projector twist angle, and the second target rectangle represents the area where the projection picture is located after trapezoidal correction.

19. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the projection image preprocessing method described in any one of claims 1-11, or the steps of the trapezoidal correction method described in any one of claims 12-16 are implemented.

20. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the projection picture preprocessing method described in any one of claims 1-11, or the steps of the trapezoidal correction method described in any one of claims 12-16 are implemented.

21. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the projection picture preprocessing method according to any one of claims 1 to 11 are implemented, or the steps of the trapezoidal correction method according to any one of claims 12 to 16 are implemented.

Citation Information

Patent Citations

  • Keystone correction method and device

    CN106954053A

  • Trapezoidal correction projection device and method based on reflective device and lens

    CN108957918A

  • Trapezoid correction method and device, electronic equipment and readable storage medium

    CN110996083A

  • Projection correction method, device, storage medium and projection equipment

    CN113489961A

  • Method and device for automatically matching projection image with curtain area, and projector

    CN114143519A