Automatic obstacle-avoidance projection method and apparatus, and projector and computer-readable storage medium

The prefabricated images are projected through a single camera projection device and processed the actual projected images, the maximum full zero submatrix is ​​calculated, and the target projection area is determined, which solves the problem of high hardware and training costs in existing projection technologies, and achieves fast obstacle avoidance at low cost.

WO2025140312A1PCT designated stage expired Publication Date: 2025-07-03SHENZHEN XIAOPAI TECHNOLOGY CO LTD

Patent Information

Application Number
PCT/CN2024/142308
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-29
Filing Date
2024-12-25
Publication Date
2025-07-03

AI Technical Summary

Technical Problem

The existing projection technology requires the use of accessories such as binocular cameras, 3D cameras, ToF sensors, etc. when avoiding obstacles. The hardware cost is high, or the identification of obstacles is determined through deep learning training. The training cost is high and time-consuming, making it difficult to achieve low-cost and fast automatic obstacle avoidance.

Method used

A single camera projection device is used to project prefabricated images, acquire the actual projected images, perform standardized processing and edge detection, calculate the maximum all-zero submatrix on the edge profile image, determine the target projection area, and avoid obstacle projection.

Benefits of technology

It realizes low-cost and rapid projection of obstacle avoidance, reduces hardware and training costs, and improves the obstacle avoidance speed and accuracy of projection equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024142308_03072025_PF_FP_ABST
    Figure CN2024142308_03072025_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the present application are an automatic obstacle-avoidance projection method and apparatus, and a projector and a computer-readable storage medium. The method is applied to a projection device comprising a single camera; and the method comprises: projecting a pre-made image, and acquiring an actual projection image of the pre-made image; processing the actual projection image to obtain an edge contour image of the processed actual projection image, wherein the processing comprises standardization processing and edge detection, and the edge contour image comprises the contour of an obstacle; and performing calculation to obtain the maximum all-zero sub-matrix on the edge contour image, and projecting projection content onto a target projection area corresponding to the maximum all-zero sub-matrix. An actual projection image of a pre-made image is acquired by means of a camera, the actual projection image is then processed to acquire the maximum all-zero sub-matrix corresponding to the actual projection image, and projection is then performed in a target projection area corresponding to the maximum all-zero sub-matrix, thereby improving, at a low cost, the speed at which a projection device avoids an obstacle to perform projection.
Need to check novelty before this filing date? Find Prior Art

Description

Automatic obstacle avoidance projection method, device, projector and computer-readable storage medium

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on December 29, 2023, with application number 202311864487.3, and invention name “Automatic obstacle avoidance projection method, device, projector and computer-readable storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of projection technology, and in particular to an automatic obstacle avoidance projection method, device, projector, and computer-readable storage medium. Background Art

[0003] During projection, if the image is blocked by obstacles in the area, it will greatly affect the visual effect of the projected image.

[0004] Conventional technology usually requires the use of binocular cameras, 3D cameras, ToF sensors and other accessories on the projection equipment to achieve automatic obstacle avoidance during projection; or, multiple images of the same scene are captured, and then obstacles are detected through deep learning to achieve automatic obstacle avoidance during projection.

[0005] Obviously, the method of using binocular cameras, 3D cameras, ToF sensors and other accessories to achieve automatic obstacle avoidance has high hardware costs; while the method of detecting obstacles through deep learning has high training costs and takes a long time to detect obstacles.

[0006] The above content is only used to assist in understanding the technical solution of this application and does not constitute an admission that the above content is prior art. Summary of the Invention

[0007] The main purpose of this application is to provide an automatic obstacle avoidance projection method, device, projector and computer-readable storage medium, aiming to increase the speed of projection equipment to avoid obstacles and project at a low cost.

[0008] To achieve the above-mentioned purpose, the present application provides an automatic obstacle avoidance projection method, which is applied to a projection device including a single camera, and the method includes: projecting a prefabricated image and obtaining an actual projection image of the prefabricated image through the single camera; processing the actual projection image to obtain an edge contour image of the processed actual projection image, wherein the processing includes standardization and edge detection, and the edge contour image includes the contour of the obstacle; calculating the maximum all-zero submatrix on the edge contour image, and projecting the projection content to the target projection area corresponding to the maximum all-zero submatrix, wherein the maximum all-zero submatrix is ​​the largest rectangular area in the edge contour image, and the contour of the obstacle is not included in the maximum rectangular area.

[0009] In addition, the present application also provides an automatic obstacle avoidance projection device, which is applied to a projection device including a single camera, and the device includes: a prefabricated module for projecting a prefabricated image and obtaining an actual projection image of the prefabricated image through the single camera; a processing module for processing the actual projection image to obtain an edge contour image of the processed actual projection image, wherein the processing includes standardization and edge detection, and the edge contour image includes the contour of the obstacle; a projection module for calculating the maximum all-zero submatrix on the edge contour image and projecting the projection content to the target projection area corresponding to the maximum all-zero submatrix, wherein the maximum all-zero submatrix is ​​the largest rectangular area in the edge contour image, and the contour of the obstacle is not included in the maximum rectangular area.

[0010] In addition, the present application also provides a projector, comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the computer program is configured to implement the steps of the automatic obstacle avoidance projection method as described in any one of the above items. In addition, the present application also provides a computer-readable storage medium, wherein the computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the computer program implements the steps of the automatic obstacle avoidance projection method as described in any one of the above items.

[0011] The present application provides an automatic obstacle avoidance projection method, device, projector and computer-readable storage medium. The method is applied to a projection device including a single camera, projects a prefabricated image, and obtains an actual projection image of the prefabricated image through the single camera; processes the actual projection image to obtain an edge contour image of the processed actual projection image, wherein the processing includes standardization and edge detection, and the edge contour image includes the contour of the obstacle; calculates the maximum all-zero submatrix on the edge contour image, and projects the projection content to the target projection area corresponding to the maximum all-zero submatrix, wherein the maximum all-zero submatrix is ​​the largest rectangular area in the edge contour image, and the contour of the obstacle is not included in the maximum rectangular area.

[0012] Conventional technology has two solutions for achieving automatic obstacle avoidance during projection. One is to use binocular cameras, 3D cameras, ToF sensors and other accessories on the projection equipment to achieve automatic obstacle avoidance during projection. The hardware cost is high and it is difficult to meet user needs. Alternatively, multiple images of the same scene are captured, and then obstacles in the scene are detected through deep learning to achieve automatic obstacle avoidance during projection. This solution requires deep learning training of the projection equipment to intelligently identify objects in the scene. The training cost is high and it is difficult to cover all obstacles. When using this solution for projection, it takes a long time to detect obstacles and the accuracy of obstacle avoidance cannot be guaranteed. Compared with conventional technologies, the present application provides an automatic obstacle avoidance projection method, device, projector and computer-readable storage medium, which projects a prefabricated image and then obtains the actual projection image of the prefabricated image. In addition to the projection of the prefabricated image, the actual projection image also includes the projection of obstacles in the scene that affect the projection effect. After processing the actual projection image, an edge contour image of the actual projection image is obtained, and the edge contour image includes the edge contour of the obstacle. Then, the maximum all-zero submatrix on the edge contour image is obtained, and the projection is performed on the target projection area corresponding to the maximum all-zero submatrix. Unlike conventional means, the present application does not require the addition of binocular cameras, 3D cameras, ToF sensors and other accessories to the projection equipment. Only a single camera is required, and no pre-trained model is required to identify obstacles in the scene. By extracting the rectangular area with the largest pixel value of all 0 in the processed actual projection image, the target projection area available for projection can be quickly determined, thereby achieving a low-cost improvement in the speed of the projection equipment to avoid obstacle projection.

[0013] The details of one or more embodiments of the disclosure are set forth in the accompanying drawings and the description below, and other features and advantages of the disclosure will be apparent from the description, the drawings, and the claims. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] FIG1 is a schematic diagram of the structure of a projector in a hardware operating environment according to an embodiment of the present application;

[0015] FIG2 is a schematic diagram of a flow chart of the first embodiment of the present application;

[0016] FIG3 is a schematic diagram of a prefabricated image according to an embodiment of the present application;

[0017] FIG4 is a schematic diagram of an actual projection image involved in an embodiment of the present application;

[0018] FIG5 is a schematic diagram of a standard projection image according to an embodiment of the present application;

[0019] FIG6 is a schematic diagram of an edge image involved in an embodiment of the present application;

[0020] FIG7 is a schematic diagram of an edge contour image without corner points involved in an embodiment of the present application;

[0021] FIG8 is a schematic diagram of an edge contour image of an obstacle involved in an embodiment of the present application;

[0022] FIG9 is a schematic diagram of a pixel value matrix involved in an embodiment of the present application;

[0023] FIG10 is a schematic diagram of a target height matrix obtained according to an embodiment of the present application;

[0024] FIG11 is a schematic diagram of pseudo code for obtaining a maximum all-zero submatrix according to an embodiment of the present application;

[0025] FIG12 is a schematic diagram of pseudo code for obtaining a maximum all-zero submatrix that meets a set aspect ratio according to an embodiment of the present application;

[0026] FIG13 is a schematic diagram of a target projection area involved in an embodiment of the present application;

[0027] FIG14 is a schematic diagram of the functional modules of the automatic obstacle avoidance projection device according to an embodiment of the present application. DETAILED DESCRIPTION

[0028] It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application.

[0029] Refer to Figure 1, which is a schematic diagram of the projector structure of the hardware operating environment involved in the embodiment of the present application.

[0030] As shown in Figure 1, the projector may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 10045 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0031] Those skilled in the art will appreciate that the structure shown in FIG. 1 does not limit the projector and may include more or fewer components than shown, or a combination of certain components, or a different arrangement of components.

[0032] As shown in FIG. 1 , the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a computer program.

[0033] In the projector shown in Figure 1, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the projector of the present application can be set in the projector, and the projector calls the computer program stored in the memory 1005 through the processor 1001, and executes the automatic obstacle avoidance projection method provided by the embodiment of the present application: projects a prefabricated image, and obtains the actual projection image of the prefabricated image through the single camera; processes the actual projection image to obtain the edge contour image of the processed actual projection image, and the processing includes standardization processing and edge detection, and the edge contour image includes the contour of the obstacle; calculates the maximum all-zero submatrix on the edge contour image, and projects the projection content to the target projection area corresponding to the maximum all-zero submatrix, and the maximum all-zero submatrix is ​​the largest rectangular area in the edge contour image, and the contour of the obstacle is not included in the largest rectangular area.

[0034] In one embodiment, the processor 1001 may call a computer program stored in the memory 1005 and further perform the following operations:

[0035] The prefabricated image includes custom corner points, and the projections of the custom corner points are the corner points to be measured; before the step of processing the actual projection image, it also includes: according to the coordinate correspondence between the custom corner points and the corner points to be measured, the coordinate system of the actual projection image is transformed to the coordinate system where the prefabricated image is located, and the standard actual projection image is obtained by intercepting; the step of processing the actual projection image includes: processing the standard actual projection image.

[0036] In one embodiment, the processor 1001 can call a computer program stored in the memory 1005 and further perform the following operations: the edge contour image is a pixel value matrix, and the pixel value is 0 or 255; the step of calculating the maximum all-zero submatrix on the edge contour image includes: traversing the pixel value matrix to determine the target height matrix of the pixel value matrix; traversing the target height matrix to determine the maximum all-zero submatrix of the pixel value matrix.

[0037] In one embodiment, the processor 1001 can call a computer program stored in the memory 1005 and perform the following operations: the step of traversing the pixel value matrix to determine the target height matrix of the pixel value matrix includes: creating a height matrix with one more column than the pixel value matrix, and the last column of the height matrix is ​​0; traversing each row of the pixel value matrix from top to bottom and from left to right; when the pixel value of the pixel point in the pixel value matrix is ​​255, the pixel point at the same position on the height matrix is ​​assigned a value of 0; when traversing to the first row of the pixel value matrix, if the pixel value of the pixel point in the pixel value matrix is ​​0, the pixel point at the same position on the height matrix is ​​assigned a value of 1; when traversing to other rows of the pixel value matrix, if the pixel value of the pixel point in the pixel value matrix is ​​0, the target pixel value of the same column and row in the same position of the height matrix is ​​taken, and the target pixel value is added by 1 and assigned to the pixel point at the same position of the height matrix.

[0038] In one embodiment, the processor 1001 can call the computer program stored in the memory 1005 and perform the following operations: the step of traversing the target height matrix and determining the maximum all-zero submatrix of the pixel value matrix includes: initializing the value stack, and the contents of the elements pushed into the stack in the process of traversing the target height matrix include the pixel value of a certain pixel point on the height matrix, and the column coordinates of the left extended position of the certain pixel point, and the left extended position of the certain pixel point is the farthest position that the certain pixel point can extend to the left; traversing the target height matrix from left to right and from top to bottom, and in the process of traversing the target height matrix, setting the initial value of the column coordinate of the left extended position of the current pixel point on the target height matrix to the column coordinate value of the current pixel point; if the pixel value of the top element in the value stack is greater than the The pixel value of the current pixel point in the target height matrix is ​​determined, and the elements in the value stack that are greater than the pixel value of the current pixel point are popped out in sequence. In each popping process, the column coordinate value of the left extended position of the current popped element is assigned to the column coordinate of the left extended position of the current pixel point, and the maximum all-zero submatrix of the pixel value matrix is ​​updated according to the content of the current popped element and the position of the current pixel point; if the aspect ratio of the maximum all-zero submatrix has been set, the maximum all-zero submatrix is ​​updated to a maximum all-zero submatrix that meets the aspect ratio according to the content of the current popped element, the position of the current pixel point and the set submatrix aspect ratio; if the pixel value of the top element in the value stack is less than the pixel value of the current pixel point, the pixel value of the current pixel point and the column coordinate of the left extended position of the current pixel point are stored in the stack.

[0039] In one embodiment, the processor 1001 can call the computer program stored in the memory 1005 and perform the following operations: the step of updating the maximum all-zero submatrix of the pixel value matrix according to the content of the current popped element and the position of the current pixel point includes: taking the pixel value of the current popped element as the height of the all-zero submatrix, and subtracting the column coordinates of the left extended position of the current popped element from the column coordinates of the current pixel point as the width of the all-zero submatrix, and the area value of the all-zero submatrix corresponding to the current popped element is equal to the product of the height of the all-zero submatrix and the width of the all-zero submatrix; initializing a first area value variable, the first area value variable being used to store the area value of the current maximum all-zero submatrix obtained during the traversal process; if the area value of the all-zero submatrix corresponding to the current popped element is greater than the first area value, The area value stored in the product value variable is updated to the area value of the all-zero submatrix corresponding to the current popped element until the traversal is completed; each time the area value in the first area value variable is updated, the coordinate data of the maximum all-zero submatrix is ​​updated at the same time, and the coordinate data includes the lower left corner coordinates, height, and width of the maximum all-zero submatrix, wherein the height and width of the maximum all-zero submatrix are the height and width of the all-zero submatrix corresponding to the current maximum all-zero submatrix area value, the row coordinates of the lower left corner coordinates are the row coordinates of the current pixel point, and the column coordinates of the lower left corner coordinates are the column coordinates of the left extended position of the current popped element; after the traversal is completed, the coordinates of the target projection area corresponding to the maximum all-zero submatrix are determined according to the coordinate data of the maximum all-zero submatrix.

[0040] In one embodiment, the processor 1001 may call a computer program stored in the memory 1005 and further perform the following operations: the step of updating the maximum all-zero submatrix to a maximum all-zero submatrix that meets the aspect ratio based on the content of the current popped element, the position of the current pixel point and the set submatrix aspect ratio, comprising: taking the pixel value of the current popped element as the actual height of the current all-zero submatrix corresponding to the current popped element and subtracting the column coordinates of the left extended position of the current popped element from the column coordinates of the current pixel point as the actual width of the current all-zero submatrix; determining the set width of the current all-zero submatrix corresponding to the current popped element based on the actual height of the current all-zero submatrix and the set submatrix aspect ratio; if the actual width of the current all-zero submatrix is ​​less than the set width, skipping the step of replacing and updating the maximum all-zero submatrix and determining the next element in the value stack; if the actual width of the current all-zero submatrix is ​​greater than or equal to the set width, taking the product of the actual height of the current all-zero submatrix and the set width as the area value of the current all-zero submatrix; initializing the second plane The product value variable, the second area value variable is used to store the area value of the current maximum all-zero submatrix obtained during the traversal process; if the area value of the all-zero submatrix corresponding to the current popped element is greater than the area value stored in the second area value variable, the area value stored in the second area value variable is updated to the area value of the all-zero submatrix corresponding to the current popped element until the traversal is completed; each time the area value stored in the second area value variable is updated, the coordinate data of the maximum all-zero submatrix is ​​also updated, and the coordinate data includes the lower left corner of the maximum all-zero submatrix. Corner coordinates, height, and width, wherein the height of the maximum all-zero submatrix is ​​the actual height of the all-zero submatrix corresponding to the area value stored in the second area value variable, the width of the maximum all-zero submatrix is ​​the set width of the all-zero submatrix corresponding to the area value stored in the second area value variable, the row coordinates of the lower-left corner coordinates are the row coordinates of the current pixel point, and the column coordinates are the column coordinates of the left extended position of the current popped element; after the traversal is completed, the coordinates of the target projection area corresponding to the maximum all-zero submatrix are determined according to the coordinate data of the maximum all-zero submatrix.

[0041] The present application provides an automatic obstacle avoidance projection method. Referring to FIG2 , FIG2 is a flow chart of a first embodiment of the automatic obstacle avoidance projection method of the present application. In this embodiment, the automatic obstacle avoidance projection method is applied to a projection device including a single camera, and the method includes:

[0042] Step S10: Projecting a prefabricated image, and acquiring an actual projection image of the prefabricated image through the single camera;

[0043] In this embodiment, the automatic obstacle avoidance projection method involved in this application is applied to a projection device including a single camera. During projection, a prefabricated image is first projected, and an actual projection image of the prefabricated image is obtained, wherein the prefabricated image is an image pre-made by a technician and stored in the projection device to help determine the position of obstacles in the projection screen. It can be a solid color image. In addition, the subsequent obstacle avoidance steps by projecting the prefabricated image can be automatically detected before projection, or the obstacle avoidance steps can be executed based on the user's obstacle avoidance instructions during the projection process. When there is an obstacle in the projection area, the actual projection image also contains an image of the obstacle and a projection image that is not blocked after the prefabricated image is projected. Obstacles are defined as all objects that significantly change the flatness or color of the projection area and affect the display effect of the projection screen, such as curtains, home appliances, and wall corners.

[0044] Step S20: Processing the actual projection image to obtain an edge contour image of the processed actual projection image, wherein the processing includes normalization and edge detection, and the edge contour image includes the contour of the obstacle;

[0045] In this embodiment, the actual projection image is processed to obtain an edge contour image of the actual projection image, which includes the outline of the obstacle. The processing steps include normalization and edge detection. In addition, after normalization, denoising can be selectively performed based on the type of image noise. After the actual projection image is processed as described above, the actual projection image becomes a binary image consisting only of pixels with a pixel value of 0 and a pixel value of 255. This binary image is the edge contour image corresponding to the actual projection image, where a pixel value of 255 represents the edge contour of the obstacle, and a pixel value of 0 represents the background area without the edge contour of the obstacle.

[0046] Step S30: Calculate the maximum all-zero submatrix on the edge contour image, and project the projection content to the target projection area corresponding to the maximum all-zero submatrix. The maximum all-zero submatrix is ​​the largest rectangular area in the edge contour image, and the outline of the obstacle is not included in the maximum rectangular area.

[0047] In this embodiment, the maximum all-zero submatrix on the edge contour image is calculated and obtained, and the projection content is projected onto the target projection area corresponding to the maximum all-zero submatrix. The edge contour image is a binary matrix with pixel values ​​of 0 or 255. The maximum all-zero submatrix in the binary matrix is ​​obtained. The maximum all-zero submatrix is ​​the largest rectangular area in the edge contour image that does not include the outline of an obstacle. Furthermore, a projection aspect ratio can also be set. The maximum all-zero submatrix that meets the set aspect ratio is calculated in the binary matrix. The maximum all-zero submatrix is ​​the largest rectangular area in the edge contour image that does not include the outline of an obstacle that meets the set aspect ratio. The target projection area refers to the largest unobstructed projectable area in the actual projection image corresponding to the maximum all-zero submatrix. It should be noted that due to different angles or ratios during projection, the projection image may be distorted. Therefore, the projection content can also be subjected to trapezoidal correction before or after obstacle avoidance before being projected onto the target projection area to ensure the projection effect.

[0048] The present application provides an automatic obstacle avoidance projection method, device, projector and computer-readable storage medium. The method is applied to a projection device including a single camera, projects a prefabricated image, and obtains an actual projection image of the prefabricated image through the single camera; processes the actual projection image to obtain an edge contour image of the processed actual projection image, wherein the processing includes standardization and edge detection, and the edge contour image includes the contour of the obstacle; calculates the maximum all-zero submatrix on the edge contour image, and projects the projection content to the target projection area corresponding to the maximum all-zero submatrix, wherein the maximum all-zero submatrix is ​​the largest rectangular area in the edge contour image, and the contour of the obstacle is not included in the maximum rectangular area. Conventional technology has two solutions for achieving automatic obstacle avoidance during projection. One is to use binocular cameras, 3D cameras, ToF sensors and other accessories on the projection equipment to achieve automatic obstacle avoidance during projection. The hardware cost is high and it is difficult to meet user needs. Alternatively, multiple images of the same scene are captured, and then obstacles in the scene are detected through deep learning to achieve automatic obstacle avoidance during projection. This solution requires deep learning training of the projection equipment to intelligently identify objects in the scene. The training cost is high and it is difficult to cover all obstacles. When using this solution for projection, it takes a long time to detect obstacles and the accuracy of obstacle avoidance cannot be guaranteed. Compared with conventional technologies, the present application provides an automatic obstacle avoidance projection method, device, projector and computer-readable storage medium, which projects a prefabricated image and then obtains the actual projection image of the prefabricated image. In addition to the projection of the prefabricated image, the actual projection image also includes the projection of obstacles in the scene that affect the projection effect. After processing the actual projection image, an edge contour image of the actual projection image is obtained, and the edge contour image includes the edge contour of the obstacle. Then, the maximum all-zero submatrix on the edge contour image is obtained, and the projection is performed on the target projection area corresponding to the maximum all-zero submatrix. Unlike conventional means, the present application does not require the addition of binocular cameras, 3D cameras, ToF sensors and other accessories to the projection equipment. Only a single camera is required, and no pre-trained model is required to identify obstacles in the scene. By extracting the rectangular area with the largest pixel value of all 0 in the processed actual projection image, the target projection area available for projection can be quickly determined, thereby achieving a low-cost improvement in the speed of the projection equipment to avoid obstacle projection.

[0049] In addition, in another embodiment, based on the above-mentioned first embodiment, the step of processing the actual projection image to obtain an edge contour image of the processed actual projection image includes: standardizing the actual projection image; performing edge detection on the actual projection image after standardization to obtain an edge image; performing a closing operation on the edge image; extracting the outer contour of all 255-pixel areas in the edge image; obtaining the area value of the circumscribed rectangle of the outer contour, if the area value of the circumscribed rectangle of the outer contour is greater than the area value threshold, retaining the 255-pixel area enclosed by the outer contour, otherwise eliminating the 255-pixel area enclosed by the outer contour, assigning the pixel value in the pixel area to 0, and obtaining the edge contour image.

[0050] In one embodiment, the actual projection image is standardized and edge detected to obtain an edge image of the actual projection image after edge detection. After a closing operation is performed on the edge image, the outer contours of all 255-pixel areas in the edge image are extracted, and the area value of the circumscribed rectangle of the outer contour is obtained. If the area value of the circumscribed rectangle of the outer contour is greater than the area value threshold, the 255-pixel area enclosed by the outer contour is retained; otherwise, the 255-pixel area enclosed by the outer contour is eliminated, and the pixel values ​​in the pixel area are assigned to 0 to obtain an edge contour image. First, the actual projected image is normalized. After normalization, the image can be denoised using methods such as gamma transform, median filtering, Gaussian filtering, and non-local means filtering. The denoised image quality is higher, resulting in more accurate obstacle detection. Next, edge detection is performed on the image to obtain the edges of obstacles. A closing operation is then performed on the edge image with an iteration count of two. The closing operation steps can include dilation, dilation, erosion, and erosion. The closing operation connects the edges of obstacles not detected in the edge image and eliminates small holes in the center of the obstacles. The edge image after the closing operation is then contour-extracted. The area of ​​the bounding rectangle of the outer contour is calculated. Based on the area of ​​the bounding rectangle, small objects smaller than a set area threshold are filtered out and eliminated to obtain an edge contour image of the obstacle. This simple image processing method allows for the rapid and accurate extraction of obstacles that significantly impact the projection quality. The edge detection intensity and the small object area threshold can be adjusted according to application needs.

[0051] In a second embodiment, based on the above-mentioned first embodiment, the prefabricated image includes custom corner points, and the projections of the custom corner points are the corner points to be measured; before the step of processing the actual projection image, it also includes: according to the coordinate correspondence between the custom corner points and the corner points to be measured, the coordinate system of the actual projection image is transformed to the coordinate system where the prefabricated image is located, and the standard actual projection image is obtained by intercepting; the step of processing the actual projection image includes: processing the standard actual projection image.

[0052] In one embodiment, the prefabricated image includes custom corner points, and the projections of the custom corner points are the corner points to be measured in the actual projection image. The corner points refer to local areas in the image with obvious changes. The prefabricated image including custom corner points refers to Figure 3, which includes a white background and checkerboard corner points. According to the correspondence between the custom corner points and the corner points to be measured, the actual projection image is adjusted, the coordinate system of the actual projection image is transformed to the coordinate system where the prefabricated image is located, and the standard actual projection image is intercepted, and then the standard actual projection image is processed.

[0053] In addition, in most cases, the actual projection image captured by the camera is a projection of the pre-produced image and is flipped with respect to the pre-produced image. Therefore, it is also necessary to adjust the actual projection image according to the correspondence between the pixels in the pre-produced image and the actual projection image, so as to ensure the accuracy of the target projection area obtained by the actual projection image captured by a single camera.

[0054] The processing steps are set as standardization, edge detection, corner removal, closing operation, and small object removal. The prefabricated image refers to Figure 3, and the actual projection image refers to Figure 4. Before obtaining the correspondence between the custom corner points and the corner points to be measured, since the actual projection image and the prefabricated image are in a mirror image relationship, the actual projection image can be horizontally flipped first, and then the corner points to be measured in the actual projection image are detected. Then, the custom corner points are matched one by one with the corner points to be measured in the flipped actual projection image. According to the correspondence between the custom corner points and the corner points to be measured, the transformation matrix from the coordinate system of the actual projection image to the coordinate system of the prefabricated image is obtained. The transformation matrix is ​​applied to transform the actual projection image to the coordinate system of the prefabricated image, and the part of the actual projection image after the coordinate system is transformed that is consistent with the size of the prefabricated image is intercepted, thereby obtaining a standard projection image. The standard projection image refers to Figure 5. After obtaining the standard projection image, the standard projection image is first standardized. After the standard projection image is standardized, the image can also be denoised. The denoising methods can be: Gamma transform, median filtering, Gaussian filtering, non-local mean filtering, etc. The denoised image quality is higher and the obstacle detection accuracy is also higher; then, the image is edge detected to obtain an edge image including obstacle edges and corner edges. The edge image including obstacle edges and corner edges is shown in Figure 6.

[0055] The coordinates of the corner points in the standard projection image are consistent with the coordinates of the corner points in the prefabricated image. According to the coordinates of the corner points, the edges of the corner points on the edge image are eliminated for subsequent steps. The edge image after the corner points are eliminated is shown in FIG7 .

[0056] Next, the edge image is closed for two iterations. The closing steps can be dilation, dilation, erosion, and erosion. The closing operation connects the edges of the obstacle not detected in the edge image and eliminates small holes in the center of the obstacle. The edge image after the closing operation is then used for contour extraction. The area of ​​the circumscribed rectangle of the outer contour is calculated. Based on the area of ​​the circumscribed rectangle of the outer contour, small objects with an area threshold smaller than a set value are filtered out and eliminated. The edge contour image of the obstacle obtained after the closing operation and small object elimination is shown in Figure 8. This simple image processing method can quickly and accurately extract obstacles that significantly affect the projection effect. The edge detection strength and the small object area threshold can be adjusted according to the application requirements. In addition, the size of the standard projection image can be reduced to 1 / k (k>1) before performing the subsequent steps. Setting an appropriate reduction threshold can speed up the calculation of the subsequent steps without affecting the obstacle avoidance results.

[0057] In a third embodiment, based on the above-mentioned first embodiment, the edge contour image is a pixel value matrix, and the pixel values ​​are 0 or 255; the step of calculating the maximum all-zero submatrix on the edge contour image includes: traversing the pixel value matrix to determine the target height matrix of the pixel value matrix; traversing the target height matrix to determine the maximum all-zero submatrix of the pixel value matrix.

[0058] In one embodiment, the edge contour image is a pixel value matrix, where the pixel values ​​are 0 or 255. The pixel value matrix is ​​traversed to determine a target height matrix of the pixel value matrix; the target height matrix is ​​traversed to determine a maximum all-zero submatrix of the pixel value matrix. Referring to FIG9 for the pixel value matrix, the maximum all-zero submatrix in FIG9 includes the dashed box ACDH and the dashed box ABFG having the same area value. It should be noted that the maximum all-zero submatrix can be selected according to the set projection ratio, and only the maximum all-zero submatrix that meets the projection ratio is selected. Furthermore, if multiple maximum all-zero submatrices that meet the projection ratio and have the same area value appear, the algorithm can determine the first maximum all-zero submatrix that appears as the selection result.

[0059] In a fourth embodiment, based on the above-mentioned third embodiment, the step of traversing the pixel value matrix and determining the target height matrix of the pixel value matrix includes: creating a height matrix with one more column than the pixel value matrix, and the last column of the height matrix is ​​0; traversing each row of the pixel value matrix from top to bottom and from left to right; when the pixel value of the pixel point in the pixel value matrix is ​​255, the pixel point at the same position on the height matrix is ​​assigned a value of 0; when traversing to the first row of the pixel value matrix, if the pixel value of the pixel point in the pixel value matrix is ​​0, the pixel point at the same position on the height matrix is ​​assigned a value of 1; when traversing to other rows of the pixel value matrix, if the pixel value of the pixel point in the pixel value matrix is ​​0, the target pixel value of the same column and the previous row at the same position of the height matrix is ​​taken, and the target pixel value is added by 1 and assigned to the pixel point at the same position of the height matrix.

[0060] In one embodiment, a height matrix is ​​created with one more column than the pixel value matrix, and the last column of the height matrix is ​​0; each row of the pixel value matrix is ​​traversed from top to bottom and from left to right; during the entire traversal process, when the pixel value of a pixel point in the pixel value matrix is ​​255, the pixel point at the same position on the height matrix is ​​assigned a value of 0; when traversing to the first row of the pixel value matrix, if the pixel value of the pixel point in the pixel value matrix is ​​0, the pixel point at the same position on the height matrix is ​​assigned a value of 1; when traversing to other rows of the pixel value matrix, if the pixel value of the pixel point in the pixel value matrix is ​​0, the target pixel value of the same column and row in the same position of the height matrix is ​​taken, and the target pixel value is added by 1 and assigned to the pixel point at the same position of the height matrix. After the traversal is completed, the target height matrix of the pixel value matrix is ​​obtained. The schematic diagram of the pixel value matrix and the target height matrix is ​​shown in Figure 10. In Figure 10, the pixel value matrix is ​​simplified as an r-row c-column matrix. First, create an r-row c+1-column height matrix, and the last column of the height matrix is ​​assigned to 0, and r and c are positive integers; traverse the first row of the pixel value matrix in sequence, and when the pixel value of the pixel point in the pixel value matrix is ​​0, the pixel point at the same position on the height matrix is ​​assigned to 1; traverse the other rows of the pixel value matrix in sequence, and when the pixel value of the pixel point in the pixel value matrix is ​​0, take the pixel value of the second pixel point directly above the first pixel point at the same position on the height matrix, add 1 to the pixel value of the second pixel point, and assign it to the first pixel point; during the entire traversal process, when the pixel value of the pixel point in the pixel value matrix is ​​255, the pixel point at the same position on the height matrix is ​​assigned to 0; after the traversal is completed, the target height matrix is ​​obtained, and the pixel value of the pixel point in the target height matrix represents the height value of the corresponding pixel point in the pixel value matrix. Refer to the following formula, where hG(i,j) represents the target height matrix, G(i,j) represents the pixel value matrix, (i,j) represents the position of any pixel in row i and column j, c represents the number of columns in the matrix, and r represents the number of rows in the matrix:

[0061] In a fifth embodiment, based on the above-mentioned fourth embodiment, the step of traversing the target height matrix and determining the maximum all-zero submatrix of the pixel value matrix includes: initializing a numerical stack, and the contents of the elements pushed into the stack in the process of traversing the target height matrix include the pixel value of a certain pixel point on the height matrix, and the column coordinates of the left extended position of the certain pixel point, and the left extended position of the certain pixel point is the farthest position that the certain pixel point can extend to the left; traversing the target height matrix from left to right and from top to bottom, and in the process of traversing the target height matrix, setting the initial value of the column coordinate of the left extended position of the current pixel point on the target height matrix to the column coordinate value of the current pixel point; if the pixel value of the top element in the numerical stack is greater than the current pixel point in the target height matrix, If the pixel value of the current pixel point is determined, the elements in the value stack that are greater than the pixel value of the current pixel point are popped out in sequence. In each popping process, the column coordinate value of the left extended position of the current popped element is assigned to the column coordinate of the left extended position of the current pixel point, and the maximum all-zero submatrix of the pixel value matrix is ​​updated according to the content of the current popped element and the position of the current pixel point; if the aspect ratio of the maximum all-zero submatrix has been set, the maximum all-zero submatrix is ​​updated to the maximum all-zero submatrix that meets the aspect ratio according to the content of the current popped element, the position of the current pixel point and the set submatrix aspect ratio; if the pixel value of the top element in the value stack is less than the pixel value of the current pixel point, the pixel value of the current pixel point and the column coordinate of the left extended position of the current pixel point are stored in the stack.

[0062] In one embodiment, a value stack is initialized. Before traversing the target height matrix, an initial element (0, -1) is first pushed into the value stack. During the process of traversing the target height matrix, the contents of the elements pushed into the stack include the pixel value of a certain pixel point on the height matrix and the column coordinates of the left extended position of the certain pixel point. The left extended position of a certain pixel point is the farthest position to the left that the certain pixel point can extend to. The target height matrix is ​​traversed from left to right and from top to bottom, and during the process of traversing the target height matrix, the initial value of the column coordinates of the left extended position of the current pixel point on the target height matrix is ​​set to the column coordinate value of the current pixel point. On the target height matrix, if the pixel value of a certain position is n, then when the position and the n-1 pixels above it are extended to the left and right at the same time, if any pixel encounters a pixel value of 0, it cannot continue to extend; the pixel values ​​of the elements in the numerical stack are set to an increasing relationship; if the pixel value of the top element in the numerical stack is greater than the pixel value of the current pixel in the target height matrix, the elements in the numerical stack that are greater than the pixel value of the current pixel are popped out of the stack in sequence. Since the pixel value of the popped element is higher than the pixel value of the current pixel when popping the stack, it means that the current pixel can be extended to the left, so the distance that the current pixel can be extended to the left is updated. Assign the column coordinate value of the left extended position of the current popped element to the column coordinate of the left extended position of the current pixel point, and update the maximum all-zero submatrix of the pixel value matrix according to the content of the current popped element and the position of the current pixel point; if the aspect ratio of the maximum all-zero submatrix has been set, update the maximum all-zero submatrix to the maximum all-zero submatrix that meets the aspect ratio according to the content of the current popped element, the position of the current pixel point and the set submatrix aspect ratio; if the pixel value of the top element in the value stack is less than the pixel value of the current pixel point, store the pixel value of the current pixel point and the column coordinate of the left extended position of the current pixel point into the stack.

[0063] 11 and 12 , FIG11 is a pseudo code of an algorithm for determining a maximum all-zero submatrix, and FIG12 is a schematic diagram of a pseudo code for obtaining a maximum all-zero submatrix that meets a set aspect ratio according to an embodiment of the present application; as shown in lines 1 and 2 of the pseudo code in FIG11 , a numerical stack is first initialized and an initial element (0, -1) is pushed onto the stack; then, as shown in lines 3 and 4 in FIG11 , the target height matrix is ​​traversed from left to right and from top to bottom; as shown in line 5 in FIG11 , each time a pixel is traversed, the initial value of the column coordinate (left) of the left extended position of the pixel is first set to the column coordinate (j) of the pixel; during the traversal process, as shown in lines 6 to 18 in FIG11 , it is first determined that if the pixel value of the top element of the stack is greater than the pixel value of the current pixel, then, through a while loop, the elements in the numerical stack that are greater than the pixel value of the current pixel are popped out of the stack in sequence. Each time a pop operation is performed, as shown in row 9 of FIG11 , the column coordinates of the left extended position of the current pixel are updated. At the same time, as shown in rows 11 to 16 of FIG11 , the area value of the all-zero submatrix is ​​calculated based on the content of the popped elements and the position of the current pixel. If the area value of the all-zero submatrix is ​​greater than the area value of the current maximum all-zero submatrix, then as shown in row 12 of FIG11 , the area value of the current maximum all-zero submatrix is ​​updated to the area value of the all-zero submatrix. When the area value of the maximum all-zero submatrix is ​​updated, as shown in rows 13 to 15 of FIG11 , the coordinates of the maximum all-zero submatrix are updated at the same time. According to the coordinate data of the maximum all-zero submatrix, the coordinates of the lower left corner, height, and width of the maximum all-zero submatrix are included; after completing the previous judgment, as shown in rows 19 to 21 in Figure 11, it is then judged that if the pixel value of the current top element in the numerical stack is less than the pixel value of the current pixel point, the pixel value of the current pixel point and the column coordinates of the left extended position of the current pixel point are stored in the numerical stack; after completing the above two judgments in sequence, the next pixel point of the current pixel point is traversed; after the height matrix traversal is completed, the maximum all-zero submatrix on the edge contour map can be obtained, and the maximum all-zero submatrix is ​​the maximum projectable area after obstacle avoidance.

[0064] The intuitive method to obtain the all-zero submatrix in the edge contour image is the enumeration method. The enumeration method can obtain all the all-zero submatrix areas and screen out the largest all-zero submatrix that meets the requirements. However, the enumeration method is usually not used in conventional technology to process images for automatic obstacle avoidance projection because the time complexity of the enumeration method is too large and cannot meet the instant requirements of automatic obstacle avoidance. Assuming that the number of pixels in the image is n 2 The time complexity of directly enumerating the largest all-zero submatrix is ​​O(n 4 ), if n=1080, then n 4 =1.36×10 12, the amount of calculation is too large to be applied in practice. Therefore, the automatic obstacle avoidance projection method involved in this application improves the enumeration method, which not only retains the advantages of the enumeration method and has a good obstacle avoidance effect, but also reduces the time complexity of the enumeration method. When the number of pixels in the image is n 2 hour:

[0065] The time complexity of traversing the pixel value matrix and determining the target height matrix of the pixel value matrix is ​​O(n 2 ); The complexity of traversing the target height matrix and determining the maximum all-zero submatrix of the pixel value matrix is ​​O(n 2 ); Therefore, the time complexity of traversing the pixel value matrix to obtain the maximum all-zero submatrix by the automatic obstacle avoidance projection method involved in this application is O(2n 2 )=O(n 2 ). If n = 1080, then n 2 =1.17×10 6 The computational complexity is reduced by 6 orders of magnitude compared with the enumeration method, and the speed of the projection device automatically avoiding obstacles can be improved at low cost through a simple algorithm.

[0066] In addition, in another embodiment, based on the above-mentioned fourth embodiment, the method further includes: in response to a setting instruction, setting the aspect ratio of the maximum all-zero submatrix; when traversing the target height matrix, determining the maximum all-zero submatrix that meets the aspect ratio based on the content of the current popped element, the position of the current pixel point and the set submatrix aspect ratio.

[0067] In one embodiment, the projection device, in response to a setting instruction, sets the aspect ratio of the largest all-zero submatrix. When traversing the target height matrix, the largest all-zero submatrix that meets the aspect ratio is retained. The setting instruction can be an aspect ratio automatically set by the projection device based on the content to be projected, a user-selected aspect ratio, or a fixed aspect ratio required by the projection device's hardware. It is understood that after the aspect ratio is determined, during projection, if the proportions of the projected content differ from the current aspect ratio, the proportions of the projected content can be adjusted based on user selection or adaptively, such as by filling, stretching, or maintaining the original proportions of the projected content. This improves the speed of the projection device's automatic obstacle avoidance projection while ensuring a beautiful projection image that meets user needs.

[0068] Referring to Figure 12, Figure 12 is a pseudo code of the algorithm for determining the maximum all-zero submatrix that meets the set aspect ratio. The difference from Figure 11 lies in the 10th and 11th lines in Figure 12. The 10th line in the figure uses the set submatrix aspect ratio to obtain the set width (L), and the 11th line in the figure makes a judgment. If the actual width (j-hLeft) is greater than the set width (L), the subsequent replacement and update operation of the maximum all-zero submatrix is ​​performed, otherwise the replacement and update step is skipped to perform subsequent operations.

[0069] In a sixth embodiment, based on the fifth embodiment, the step of updating the maximum all-zero submatrix of the pixel value matrix according to the content of the current popped element and the position of the current pixel point includes: taking the pixel value of the current popped element as the height of the all-zero submatrix, subtracting the column coordinates of the left extended position of the current popped element from the column coordinates of the current pixel point as the width of the all-zero submatrix, and the area value of the all-zero submatrix corresponding to the current popped element is equal to the product of the height of the all-zero submatrix and the width of the all-zero submatrix; initializing a first area value variable, the first area value variable is used to store the area value of the current maximum all-zero submatrix obtained during the traversal process; if the area value of the all-zero submatrix corresponding to the current popped element is greater than the area value stored in the first area value variable, then The area value stored in the first area value variable is updated to the area value of the all-zero submatrix corresponding to the current popped element until the traversal is completed; each time the area value in the first area value variable is updated, the coordinate data of the maximum all-zero submatrix is ​​also updated, and the coordinate data includes the lower left corner coordinates, height, and width of the maximum all-zero submatrix, wherein the height and width of the maximum all-zero submatrix are the height and width of the all-zero submatrix corresponding to the current maximum all-zero submatrix area value, the row coordinates of the lower left corner coordinates are the row coordinates of the current pixel point, and the column coordinates of the lower left corner coordinates are the column coordinates of the left extended position of the current popped element; after the traversal is completed, the coordinates of the target projection area corresponding to the maximum all-zero submatrix are determined according to the coordinate data of the maximum all-zero submatrix.

[0070] In one embodiment, the pixel value of the current popped element is used as the height of the all-zero submatrix, the value obtained by subtracting the column coordinates of the left extended position of the current popped element from the column coordinates of the current pixel point is used as the width of the all-zero submatrix, and the area value of the all-zero submatrix corresponding to the current popped element is equal to the product of the height of the all-zero submatrix and the width of the all-zero submatrix; as shown in rows 7 to 15 of Figure 11, the pixel value of the popped element is the height (H) of the matrix, the column coordinates of the left extended position of the popped element (hLeft) are subtracted from the column coordinates of the left extended position of the popped element, which is equal to the width (L) of the matrix, the row coordinates of the current pixel point (i) are the row coordinates of the lower left corner position of the all-zero submatrix, and the column coordinates of the left extended position (hLeft) are the column coordinates of the lower left corner position of the all-zero submatrix. Therefore, the height (H), width (L) and lower left corner coordinates (i, hLeft) of the all-zero submatrix corresponding to the popped element are obtained, and the product of the height and width is the area value (H×L) of the current all-zero submatrix.

[0071] Initialize the first area value variable, which is used to store the area value of the current maximum all-zero submatrix obtained during the traversal process; if the area value of the all-zero submatrix corresponding to the current popped element is greater than the area value stored in the first area value variable, then the area value stored in the first area value variable is updated to the area value of the all-zero submatrix corresponding to the current popped element, until the traversal ends; referring to Figure 11, before the traversal begins, initialize a variable (maxArea) to store the area value of the current maximum all-zero submatrix obtained during the traversal. Compare the area value of the current all-zero submatrix with the area value of the current maximum all-zero submatrix. If the area value of the current all-zero submatrix is ​​greater than the area value of the current maximum all-zero submatrix, then update the area value of the current maximum all-zero submatrix to the area value of the current all-zero submatrix, until the traversal ends. After the traversal ends, the area value of the current maximum all-zero submatrix is ​​the area value of the maximum all-zero submatrix of the pixel value matrix.

[0072] Each time the area value in the first area value variable is updated, the coordinate data of the largest all-zero submatrix is ​​also updated, the coordinate data including the lower left corner coordinates, height, and width of the largest all-zero submatrix, wherein the height and width of the largest all-zero submatrix are the height and width of the all-zero submatrix corresponding to the current largest all-zero submatrix area value, the row coordinates of the lower left corner coordinates are the row coordinates of the current pixel point, and the column coordinates of the lower left corner coordinates are the column coordinates of the left extended position of the current popped element; after the traversal is completed, the coordinates of the target projection area corresponding to the largest all-zero submatrix are determined based on the coordinate data of the largest all-zero submatrix.

[0073] By updating the area value corresponding to the largest all-zero submatrix and the coordinate data of the largest all-zero submatrix during the traversal process, the speed of the projection device in avoiding obstacles can be improved at a low cost while ensuring that the projection area is maximized during projection.

[0074] 13 , which is an example of the maximum all-zero submatrix obtained through the above steps on the edge contour image and the canonical projection image. The area framed by the thick white solid line in FIG13 is the area of ​​the obtained maximum all-zero submatrix.

[0075] In a seventh embodiment, based on the fifth embodiment, the step of updating the maximum all-zero submatrix to a maximum all-zero submatrix that meets the aspect ratio according to the content of the current popped element, the position of the current pixel point and the set submatrix aspect ratio includes: taking the pixel value of the current popped element as the actual height of the current all-zero submatrix corresponding to the current popped element, and subtracting the column coordinates of the left extended position of the current popped element from the column coordinates of the current pixel point as the actual width of the current all-zero submatrix; determining the set width of the current all-zero submatrix corresponding to the current popped element according to the actual height of the current all-zero submatrix and the set submatrix aspect ratio; if the actual width of the current all-zero submatrix is ​​less than the set width, skipping the replacement and updating step of the maximum all-zero submatrix and determining the next element in the value stack; if the actual width of the current all-zero submatrix is ​​greater than or equal to the set width, taking the product of the actual height of the current all-zero submatrix and the set width as the area value of the current all-zero submatrix; initializing a second area value variable, the second area value The variable is used to store the area value of the current maximum all-zero submatrix obtained during the traversal process; if the area value of the all-zero submatrix corresponding to the current popped element is greater than the area value stored in the second area value variable, the area value stored in the second area value variable is updated to the area value of the all-zero submatrix corresponding to the current popped element until the traversal is completed; each time the area value stored in the second area value variable is updated, the coordinate data of the maximum all-zero submatrix is ​​also updated, the coordinate data including the lower left corner coordinate, height, and width of the maximum all-zero submatrix, wherein the height of the maximum all-zero submatrix is ​​the actual height of the all-zero submatrix corresponding to the area value stored in the second area value variable, the width of the maximum all-zero submatrix is ​​the set width of the all-zero submatrix corresponding to the area value stored in the second area value variable, the row coordinate of the lower left corner coordinate is the row coordinate of the current pixel point, and the column coordinate is the column coordinate of the left extended position of the current popped element; after the traversal is completed, the coordinates of the target projection area corresponding to the maximum all-zero submatrix are determined according to the coordinate data of the maximum all-zero submatrix.

[0076] In one embodiment, the pixel value of the current popped element is used as the actual height of the current all-zero submatrix corresponding to the current popped element, and the value obtained by subtracting the column coordinates of the left extension position of the current popped element from the column coordinates of the current pixel point is used as the actual width of the current all-zero submatrix; the set width of the current all-zero submatrix corresponding to the current popped element is determined based on the actual height of the current all-zero submatrix and the set submatrix aspect ratio; if the actual width of the current all-zero submatrix is ​​less than the set width, the replacement and update step of the largest all-zero submatrix is ​​skipped, and the next element in the value stack is determined; if the actual width of the current all-zero submatrix is ​​greater than or equal to the set width, the product of the actual height of the current all-zero submatrix and the set width is used as the area value of the current all-zero submatrix; and a second area value variable is initialized, and the second area value variable is used to store the area value of the current largest all-zero submatrix obtained during the traversal process. ; If the area value of the all-zero submatrix corresponding to the current popped element is greater than the area value stored in the second area value variable, the area value stored in the second area value variable is updated to the area value of the all-zero submatrix corresponding to the current popped element, until the traversal is completed; each time the area value stored in the second area value variable is updated, the coordinate data of the largest all-zero submatrix is ​​also updated, and the coordinate data includes the lower left corner coordinates, height, and width of the largest all-zero submatrix, wherein the height of the largest all-zero submatrix is ​​the actual height of the all-zero submatrix corresponding to the area value stored in the second area value variable, the width of the largest all-zero submatrix is ​​the set width of the all-zero submatrix corresponding to the area value stored in the second area value variable, the row coordinates of the lower left corner coordinates are the row coordinates of the current pixel point, and the column coordinates are the column coordinates of the left extended position of the current popped element; after the traversal is completed, the coordinates of the target projection area corresponding to the largest all-zero submatrix are determined according to the coordinate data of the largest all-zero submatrix.

[0077] Referring to Figure 12, as shown in rows 7 to 16 in Figure 12, the pixel value of the popped element is the actual height (H) of the matrix, the column coordinates (j) of the current pixel point minus the column coordinates of the left extended position of the popped element (hLeft) is equal to the actual width (j-hLeft) of the matrix, the row coordinates (i) of the current pixel point are the row coordinates of the lower left corner position of the all-zero submatrix, and the column coordinates (hLeft) of the left extended position are the column coordinates of the lower left corner position of the all-zero submatrix, thereby obtaining the actual height (H), actual width (j-hLeft) and lower left corner coordinates (i, hLeft) of the all-zero submatrix corresponding to the popped element;

[0078] As shown in line 10 of the figure, the actual height of the all-zero submatrix is ​​multiplied by the set aspect ratio to obtain the set width (L) of the all-zero submatrix. If the actual width of the current all-zero submatrix is ​​greater than or equal to the set width, it means that the projection area that meets the aspect ratio can be obtained in the current all-zero submatrix, and then the subsequent replacement update of the maximum all-zero submatrix is ​​performed. Otherwise, it means that the projection area that meets the aspect ratio cannot be obtained in the current all-zero submatrix, and then there is no need to replace and update the maximum all-zero submatrix. The replacement and update steps of lines 12 to 17 in the figure are skipped and the program continues to execute.

[0079] The product of the actual height and the set width is the area value of the current all-zero submatrix (H×L). Before the traversal begins, a variable (maxArea) is initialized to store the area value of the current maximum all-zero submatrix obtained during the traversal. The area value of the current all-zero submatrix is ​​compared with the area value of the current maximum all-zero submatrix. If the area value of the current all-zero submatrix is ​​greater than the area value of the current maximum all-zero submatrix, the area value of the current maximum all-zero submatrix is ​​updated to the area value of the current all-zero submatrix until the traversal ends. After the traversal ends, the area value of the current maximum all-zero submatrix is ​​the area value of the maximum all-zero submatrix of the pixel value matrix. Each time the area value of the current maximum all-zero submatrix is ​​updated, the coordinate data of the maximum all-zero submatrix is ​​simultaneously replaced and updated, the coordinate data including the lower left corner coordinate, height, and width of the maximum all-zero submatrix; wherein the height is the actual height, the width is the set width, the row coordinates of the lower left corner coordinates are the row coordinates of the current pixel point, and the column coordinates are the column coordinates of the left extended position of the current popped element; after the traversal is completed, the coordinates of the target projection area corresponding to the maximum all-zero submatrix are determined based on the coordinate data of the maximum all-zero submatrix. In addition, after obtaining the maximum all-zero submatrix, a projection threshold can be set according to the hardware parameters of the projection device to which the automatic obstacle avoidance projection method involved in this application is applied to determine whether the maximum all-zero 5-submatrix meets the projection resolution requirements; first obtain the area value of the maximum all-zero submatrix, and if the area value of the maximum all-zero submatrix exceeds the projection threshold, proceed to the subsequent steps; if the area value of the maximum all-zero submatrix does not exceed the projection threshold, output a prompt message, and the prompt message can be output in the form of voice, text, animated images, etc. The content of the prompt message can be "The projectable area is too small, please move", so that the projection device can automatically avoid obstacles while ensuring the beauty and clarity of the projection picture at a low cost. In addition, after obtaining the maximum all-zero submatrix, the four-point coordinates of the corresponding target projection area are determined according to the coordinate data of the final maximum all-zero submatrix: the upper left corner coordinate, the lower left corner coordinate, the upper right corner coordinate, and the lower right corner coordinate. After determining the four-point coordinates of the target projection area, combined with the trapezoidal correction algorithm, the content to be projected can be accurately projected to the corresponding target projection area. The coordinates of the target projection area are determined by the coordinate data of the determined maximum all-zero submatrix. The method is simple and fast.

[0080] Referring to Figure 14, the present application also provides an automatic obstacle avoidance projection device, which is applied to a projection device including a single camera, and the device includes: a prefabricated module M1, used to project a prefabricated image and obtain the actual projection image of the prefabricated image through the single camera; a processing module M2, used to process the actual projection image to obtain an edge contour image of the processed actual projection image, wherein the processing includes standardization and edge detection, and the edge contour image includes the contour of the obstacle; a projection module M3, used to calculate the maximum all-zero submatrix on the edge contour image, and project the projection content to the target projection area corresponding to the maximum all-zero submatrix, wherein the maximum all-zero submatrix is ​​the largest rectangular area in the edge contour image, and the contour of the obstacle is not included in the maximum rectangular area.

[0081] Optionally, the prefabricated image includes custom corner points, and the projections of the custom corner points are the corner points to be measured; the processing module is also used to: transform the coordinate system of the actual projection image to the coordinate system of the prefabricated image according to the coordinate correspondence between the custom corner points and the corner points to be measured, and intercept the standard actual projection image; the step of processing the actual projection image includes: processing the standard actual projection image.

[0082] Optionally, the edge contour image is a pixel value matrix, and the pixel value is 0 or 255; the projection module is also used to: traverse the pixel value matrix to determine the target height matrix of the pixel value matrix; traverse the target height matrix to determine the maximum all-zero submatrix of the pixel value matrix.

[0083] Optionally, the projection module is also used to: create a height matrix with one more column than the pixel value matrix, and the last column of the height matrix is ​​0; traverse each row of the pixel value matrix from top to bottom and from left to right; when the pixel value of the pixel point in the pixel value matrix is ​​255, the pixel point at the same position on the height matrix is ​​assigned a value of 0; when traversing to the first row of the pixel value matrix, if the pixel value of the pixel point in the pixel value matrix is ​​0, the pixel point at the same position on the height matrix is ​​assigned a value of 1; when traversing to other rows of the pixel value matrix, if the pixel value of the pixel point in the pixel value matrix is ​​0, take the target pixel value of the same column and row in the same position of the height matrix, add 1 to the target pixel value and assign it to the pixel point at the same position of the height matrix.

[0084] Optionally, the projection module is also used to: initialize the numerical stack, and the contents of the elements pushed into the stack during the process of traversing the target height matrix include the pixel value of a certain pixel point on the height matrix, and the column coordinates of the left extended position of the certain pixel point, where the left extended position of the certain pixel point is the farthest position that the certain pixel point can extend to the left; traverse the target height matrix from left to right and from top to bottom, and in the process of traversing the target height matrix, set the initial value of the column coordinates of the left extended position of the current pixel point on the target height matrix to the column coordinate value of the current pixel point; if the pixel value of the top element in the numerical stack is greater than the pixel value of the current pixel point in the target height matrix, then set the pixel value of the top element in the numerical stack that is greater than the pixel value of the current pixel point Elements of the pixel value of the current pixel point are popped out in sequence. In each popping process, the column coordinate value of the left-extended position of the current popped element is assigned to the column coordinate of the left-extended position of the current pixel point, and the maximum all-zero submatrix of the pixel value matrix is ​​updated according to the content of the current popped element and the position of the current pixel point; if the aspect ratio of the maximum all-zero submatrix has been set, the maximum all-zero submatrix is ​​updated to a maximum all-zero submatrix that meets the aspect ratio according to the content of the current popped element, the position of the current pixel point and the set submatrix aspect ratio; if the pixel value of the top element in the value stack is less than the pixel value of the current pixel point, the pixel value of the current pixel point and the column coordinate of the left-extended position of the current pixel point are stored in the stack.

[0085] Optionally, the projection module is also used to: use the pixel value of the current popped element as the height of the all-zero submatrix, and the value obtained by subtracting the column coordinates of the left extended position of the current popped element from the column coordinates of the current pixel point as the width of the all-zero submatrix, and the area value of the all-zero submatrix corresponding to the current popped element is equal to the product of the height of the all-zero submatrix and the width of the all-zero submatrix; initialize a first area value variable, and the first area value variable is used to store the area value of the current maximum all-zero submatrix obtained during the traversal process; if the area value of the all-zero submatrix corresponding to the current popped element is greater than the area value stored in the first area value variable, then update the area value stored in the first area value variable to the area value of the current popped element. The area value of the all-zero submatrix corresponding to the element is determined until the traversal is completed; each time the area value in the first area value variable is updated, the coordinate data of the maximum all-zero submatrix is ​​also updated, and the coordinate data includes the lower left corner coordinates, height, and width of the maximum all-zero submatrix, wherein the height and width of the maximum all-zero submatrix are the height and width of the all-zero submatrix corresponding to the current maximum all-zero submatrix area value, the row coordinates of the lower left corner coordinates are the row coordinates of the current pixel point, and the column coordinates of the lower left corner coordinates are the column coordinates of the left extended position of the current popped element; after the traversal is completed, the coordinates of the target projection area corresponding to the maximum all-zero submatrix are determined according to the coordinate data of the maximum all-zero submatrix.

[0086] Optionally, the projection module is further used to: use the pixel value of the current popped element as the actual height of the current all-zero submatrix corresponding to the current popped element, and the column coordinates of the current pixel point minus the column coordinates of the left extended position of the current popped element to obtain the value as the actual width of the current all-zero submatrix; determine the set width of the current all-zero submatrix corresponding to the current popped element according to the actual height of the current all-zero submatrix and the set submatrix aspect ratio; if the actual width of the current all-zero submatrix is ​​less than the set width, skip the replacement and update step of the maximum all-zero submatrix, and determine the next element in the value stack; if the actual width of the current all-zero submatrix is ​​greater than or equal to the set width, use the product of the actual height of the current all-zero submatrix and the set width as the area value of the current all-zero submatrix; initialize a second area value variable, the second area value variable is used to store the area value of the current maximum all-zero submatrix obtained during the traversal process; if the current popped element is If the area value of the corresponding all-zero submatrix is ​​greater than the area value stored in the second area value variable, the area value stored in the second area value variable is updated to the area value of the all-zero submatrix corresponding to the current popped element until the traversal is completed; each time the area value stored in the second area value variable is updated, the coordinate data of the maximum all-zero submatrix is ​​also updated, the coordinate data including the lower left corner coordinate, height, and width of the maximum all-zero submatrix, wherein the height of the maximum all-zero submatrix is ​​the actual height of the all-zero submatrix corresponding to the area value stored in the second area value variable, the width of the maximum all-zero submatrix is ​​the set width of the all-zero submatrix corresponding to the area value stored in the second area value variable, the row coordinate of the lower left corner coordinate is the row coordinate of the current pixel point, and the column coordinate is the column coordinate of the left extended position of the current popped element; after the traversal is completed, the coordinates of the target projection area corresponding to the maximum all-zero submatrix are determined according to the coordinate data of the maximum all-zero submatrix.

[0087] The automatic obstacle avoidance projection device provided in this application utilizes the automatic obstacle avoidance projection method described in the aforementioned embodiments, aiming to cost-effectively increase the speed at which a projection device avoids obstacles. Compared to conventional technologies, the beneficial effects of the automatic obstacle avoidance projection device provided in the embodiments of this application are the same as those of the automatic obstacle avoidance projection method described in the aforementioned embodiments. Other technical features of the automatic obstacle avoidance projection device are the same as those disclosed in the aforementioned embodiments and are not further described here.

[0088] The present application also provides a projector, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the automatic obstacle avoidance projection method as described in any one of the above items.

[0089] The present application also 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 automatic obstacle avoidance projection method as described in any one of the above items are implemented.

[0090] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.

[0091] The above-mentioned serial numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments. Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, including several instructions to enable a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the method described in each embodiment of the present application. The above is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made by using the content of the description and drawings of this application, or directly or indirectly applied in other related technical fields, is similarly included in the patent protection scope of the present application.

Claims

1. An automatic obstacle avoidance projection method, wherein, The method is applied to a projection device including a single camera, and the method includes: Projecting a prefabricated image, and obtaining an actual projection image of the prefabricated image through the single camera; Processing the actual projection image to obtain an edge contour image of the processed actual projection image, where the processing includes normalization processing and edge detection, and the edge contour image includes the contour of the obstacle; Calculating the largest all-zero sub-matrix on the edge contour image, and projecting the projection content to the target projection area corresponding to the largest all-zero sub-matrix. The largest all-zero sub-matrix is the largest rectangular area in the edge contour image, and the contour of the obstacle is not included in the largest rectangular area.

2. The automatic obstacle avoidance projection method according to claim 1, wherein, The prefabricated image includes custom corner points, and the projection of the custom corner points is the corner points to be measured; before the step of processing the actual projection image, it further includes: According to the coordinate correspondence between the custom corner points and the corner points to be measured, transforming the coordinate system of the actual projection image to the coordinate system where the prefabricated image is located, and intercepting to obtain a standardized actual projection image; The step of processing the actual projection image includes: Processing the standardized actual projection image.

3. The automatic obstacle avoidance projection method according to claim 1, wherein, The edge contour image is a pixel value matrix, and the pixel value takes 0 or 255; the step of calculating the largest all-zero sub-matrix on the edge contour image includes: Traversing the pixel value matrix to determine the target height matrix of the pixel value matrix; Traversing the target height matrix to determine the largest all-zero sub-matrix of the pixel value matrix.

4. The automatic obstacle avoidance projection method according to claim 3, wherein, The step of traversing the pixel value matrix to determine the target height matrix of the pixel value matrix includes: creating a height matrix with one more column than the pixel value matrix, and the last column of the height matrix is 0; Traversing each row of the pixel value matrix from top to bottom and from left to right; when the pixel value of a pixel point in the pixel value matrix is 255, assigning 0 to the pixel point at the same position on the height matrix; When traversing to the first row of the pixel value matrix, if the pixel value of a pixel point in the pixel value matrix is 0, assigning 1 to the pixel point at the same position on the height matrix; When traversing to other rows of the pixel value matrix, if the pixel value of a pixel point in the pixel value matrix is 0, taking the target pixel value of the same column in the previous row at the same position on the height matrix, and adding 1 to the target pixel value and assigning it to the pixel point at the same position on the height matrix.

5. The automatic obstacle avoidance projection method according to claim 4, wherein, The step of traversing the target height matrix to determine the largest all-zero sub-matrix of the pixel value matrix includes: Initialize the value stack. The content of the elements pushed onto the stack during the traversal of the target height matrix includes the pixel value of a certain pixel point on the height matrix and the column coordinate of the left extension position of the certain pixel point. The left extension position of the certain pixel point is the farthest position that the certain pixel point can extend to the left. Among them, on the target height matrix, if the pixel value of a certain pixel point is n, then the certain pixel point and the n - 1 pixel points in the same column above the certain pixel point extend to the left at the same time, and the farthest position where none of the n pixel points will encounter a pixel value of 0 is the left extension position of the certain pixel point; Traverse the target height matrix from left to right and from top to bottom; When traversing each pixel point on the height matrix, use the column coordinate value of the current pixel point as the initial value of the column coordinate value of the left extension position of the current pixel point; Then judge whether the pixel value of the top element in the value stack is greater than the pixel value of the current pixel point in the target height matrix; If the pixel value of the top element is greater than the pixel value of the current pixel point in the target height matrix, then pop the elements in the value stack that are greater than the pixel value of the current pixel point one by one. During each popping process, assign the column coordinate value of the left extension position of the currently popped element to the column coordinate of the left extension position of the current pixel point, and update the maximum all-zero sub-matrix of the pixel value matrix according to the content of the currently popped element and the position of the current pixel point; If the aspect ratio of the maximum all-zero sub-matrix has been set, then update the maximum all-zero sub-matrix to the maximum all-zero sub-matrix that meets the aspect ratio according to the content of the currently popped element, the position of the current pixel point, and the set aspect ratio of the sub-matrix; If the pixel value of the top element is less than the pixel value of the current pixel point in the target height matrix, then push the pixel value of the current pixel point and the column coordinate of the left extension position of the current pixel point onto the stack; If the pixel value of the top element is greater than or equal to the pixel value of the current pixel point in the target height matrix, then traverse the next pixel point in the target height matrix.

6. The automatic obstacle avoidance projection method according to claim 5, wherein, The step of updating the maximum all-zero sub-matrix of the pixel value matrix according to the content of the currently popped element and the position of the current pixel point includes: Use the pixel value of the currently popped element as the height of the all-zero sub-matrix, and use the value obtained by subtracting the column coordinate of the left extension position of the currently popped element from the column coordinate of the current pixel point as the width of the all-zero sub-matrix. The area value of the all-zero sub-matrix corresponding to the currently popped element is equal to the product of the height of the all-zero sub-matrix and the width of the all-zero sub-matrix; Initialize the first area value variable, which is used to store the area value of the current maximum all-zero sub-matrix obtained during the traversal; If the area value of the all-zero sub-matrix corresponding to the currently popped element is greater than the area value stored in the first area value variable, then update the area value stored in the first area value variable to the area value of the all-zero sub-matrix corresponding to the currently popped element until the traversal ends; Each time the area value in the first area value variable is updated, the coordinate data of the maximum all-zero sub-matrix is updated simultaneously. The coordinate data includes the lower left corner coordinates, height, and width of the maximum all-zero sub-matrix. Wherein, the height and width of the maximum all-zero sub-matrix are the height and width of the all-zero sub-matrix corresponding to the current maximum all-zero sub-matrix area value. The row coordinate of the lower left corner coordinates is the row coordinate of the current pixel point, and the column coordinate of the lower left corner coordinates is the column coordinate of the left extension position of the current popped element; After the traversal ends, according to the coordinate data of the maximum all-zero sub-matrix, determine the coordinates of the target projection area corresponding to the maximum all-zero sub-matrix.

7. The automatic obstacle avoidance projection method according to claim 5, wherein The step of updating the maximum all-zero sub-matrix to the maximum all-zero sub-matrix that conforms to the aspect ratio according to the content of the current popped element, the position of the current pixel point, and the set aspect ratio of the sub-matrix includes: Use the pixel value of the current popped element as the actual height of the current all-zero sub-matrix corresponding to the current popped element, and use the value obtained by subtracting the column coordinate of the left extension position of the current popped element from the column coordinate of the current pixel point as the actual width of the current all-zero sub-matrix; According to the actual height of the current all-zero sub-matrix and the set aspect ratio of the sub-matrix, determine the set width of the current all-zero sub-matrix corresponding to the current popped element; If the actual width of the current all-zero sub-matrix is less than the set width, skip the replacement and update step of the maximum all-zero sub-matrix, and judge the next element in the value stack; If the actual width of the current all-zero sub-matrix is greater than or equal to the set width, use the product of the actual height of the current all-zero sub-matrix and the set width as the area value of the current all-zero sub-matrix; Initialize a second area value variable, which is used to store the area value of the current maximum all-zero sub-matrix obtained during the traversal; If the area value of the all-zero sub-matrix corresponding to the current popped element is greater than the area value stored in the second area value variable, update the area value stored in the second area value variable to the area value of the all-zero sub-matrix corresponding to the current popped element until the traversal ends; Each time the area value stored in the second area value variable is updated, the coordinate data of the maximum all-zero sub-matrix is updated simultaneously. The coordinate data includes the lower left corner coordinates, height, and width of the maximum all-zero sub-matrix. Wherein, the height of the maximum all-zero sub-matrix is the actual height of the all-zero sub-matrix corresponding to the area value stored in the second area value variable, the width of the maximum all-zero sub-matrix is the set width of the all-zero sub-matrix corresponding to the area value stored in the second area value variable, the row coordinate of the lower left corner coordinates is the row coordinate of the current pixel point, and the column coordinate is the column coordinate of the left extension position of the current popped element; After the traversal ends, according to the coordinate data of the maximum all-zero sub-matrix, determine the coordinates of the target projection area corresponding to the maximum all-zero sub-matrix.

8. An automatic obstacle avoidance projection device, wherein, The device is applied to a projection device including a single camera. The device includes: A prefabricated module for projecting a prefabricated image and obtaining an actual projected image of the prefabricated image through the single camera; A processing module for processing the actual projected image to obtain an edge contour image of the processed actual projected image. The processing includes normalization processing and edge detection. The edge contour image includes the contour of the obstacle; A projection module for calculating the largest all-zero sub-matrix on the edge contour image and projecting the projection content onto the target projection area corresponding to the largest all-zero sub-matrix. The largest all-zero sub-matrix is the largest rectangular area in the edge contour image, and the contour of the obstacle is not included in the largest rectangular area.

9. The automatic obstacle avoidance projection device according to claim 8, wherein, The prefabricated image includes custom corner points, and the projection of the custom corner points is the corner points to be measured; the processing module is further configured to: According to the coordinate correspondence between the custom corner points and the corner points to be measured, transform the coordinate system of the actual projected image to the coordinate system where the prefabricated image is located, and intercept to obtain a standardized actual projected image; The step of processing the actual projected image includes: Processing the standardized actual projected image.

10. The automatic obstacle avoidance projection device according to claim 8, wherein, The edge contour image is a pixel value matrix, and the pixel values are 0 or 255; the projection module is further configured to: Traverse the pixel value matrix to determine the target height matrix of the pixel value matrix; Traverse the target height matrix to determine the largest all-zero sub-matrix of the pixel value matrix.

11. The automatic obstacle avoidance projection device according to claim 10, wherein, The projection module is further configured to: Create a height matrix with one more column than the pixel value matrix, and the last column of the height matrix is 0; Traverse each row of the pixel value matrix from top to bottom and from left to right; when the pixel value of a pixel point in the pixel value matrix is 255, assign the pixel point at the same position on the height matrix to 0; When traversing to the first row of the pixel value matrix, if the pixel value of a pixel point in the pixel value matrix is 0, assign the pixel point at the same position on the height matrix to 1; When traversing to other rows of the pixel value matrix, if the pixel value of a pixel point in the pixel value matrix is 0, take the target pixel value of the same column in the previous row at the same position of the height matrix, and assign the value obtained by adding 1 to the target pixel value to the pixel point at the same position of the height matrix.

12. The automatic obstacle avoidance projection device according to claim 11, wherein, The projection module is further configured to: Initialize a numerical stack. During the process of traversing the target height matrix, the content of the elements pushed onto the stack includes the pixel value of a certain pixel point on the height matrix and the column coordinate of the left extension position of the certain pixel point. The left extension position of the certain pixel point is the farthest position that the certain pixel point can extend to the left. Among them, on the target height matrix, if the pixel value of a certain pixel point is n, then the certain pixel point and the n - 1 pixel points in the same column above the certain pixel point extend to the left at the same time, and the farthest position where none of the n pixel points touch the 0 pixel value is the left extension position of the certain pixel point; Traverse the target height matrix from left to right and from top to bottom; When traversing each pixel point on the height matrix, use the column coordinate value of the current pixel point as the initial value of the column coordinate value of the left extension position of the current pixel point; Next, it is determined whether the pixel value of the top element in the numerical stack is greater than the pixel value of the current pixel point in the target height matrix; If the pixel value of the top element is greater than the pixel value of the current pixel point in the target height matrix, then the elements in the numerical stack that are greater than the pixel value of the current pixel point are popped out in sequence. During each popping process, the column coordinate value of the left extension position of the currently popped element is assigned to the column coordinate of the left extension position of the current pixel point, and according to the content of the currently popped element and the position of the current pixel point, the maximum all-zero sub-matrix of the pixel value matrix is updated; If the aspect ratio of the maximum all-zero sub-matrix has been set, then according to the content of the currently popped element, the position of the current pixel point, and the set aspect ratio of the sub-matrix, the maximum all-zero sub-matrix is updated to the maximum all-zero sub-matrix that conforms to the aspect ratio; If the pixel value of the top element is less than the pixel value of the current pixel point in the target height matrix, then the pixel value of the current pixel point and the column coordinate of the left extension position of the current pixel point are pushed onto the stack; If the pixel value of the top element is greater than or equal to the pixel value of the current pixel point in the target height matrix, then the next pixel point in the target height matrix is traversed.

13. The automatic obstacle avoidance projection device according to claim 12, wherein, The projection module is further configured to: Use the pixel value of the currently popped element as the height of the all-zero sub-matrix, use the value obtained by subtracting the column coordinate of the left extension position of the currently popped element from the column coordinate of the current pixel point as the width of the all-zero sub-matrix, and the area value of the all-zero sub-matrix corresponding to the currently popped element is equal to the product of the height of the all-zero sub-matrix and the width of the all-zero sub-matrix; Initialize a first area value variable, which is used to store the area value of the current maximum all-zero sub-matrix obtained during the traversal; If the area value of the all-zero sub-matrix corresponding to the currently popped element is greater than the area value stored in the first area value variable, then the area value stored in the first area value variable is updated to the area value of the all-zero sub-matrix corresponding to the currently popped element until the traversal ends; When updating the area value in the first area value variable each time, the coordinate data of the maximum all-zero sub-matrix is updated at the same time. The coordinate data includes the lower left corner coordinates, height, and width of the maximum all-zero sub-matrix. Among them, the height and width of the maximum all-zero sub-matrix are the height and width of the all-zero sub-matrix corresponding to the current maximum all-zero sub-matrix area value, the row coordinate of the lower left corner coordinate is the row coordinate of the current pixel point, and the column coordinate of the lower left corner coordinate is the column coordinate of the left extension position of the currently popped element; After the traversal ends, according to the coordinate data of the maximum all-zero sub-matrix, the coordinates of the target projection area corresponding to the maximum all-zero sub-matrix are determined.

14. The automatic obstacle avoidance projection device according to claim 12, wherein, The projection module is further configured to: Use the pixel value of the currently popped element as the actual height of the current all-zero sub-matrix corresponding to the currently popped element, and use the value obtained by subtracting the column coordinate of the left extension position of the currently popped element from the column coordinate of the current pixel point as the actual width of the current all-zero sub-matrix; Determine the set width of the current all-zero submatrix corresponding to the current popped element according to the actual height of the current all-zero submatrix and the set aspect ratio of the submatrix height to width. If the actual width of the current all-zero submatrix is less than the set width, skip the replacement and update step of the maximum all-zero submatrix, and judge the next element in the value stack. If the actual width of the current all-zero submatrix is greater than or equal to the set width, take the product of the actual height of the current all-zero submatrix and the set width as the area value of the current all-zero submatrix. Initialize a second area value variable, which is used to store the area value of the current maximum all-zero submatrix obtained during traversal. If the area value of the all-zero submatrix corresponding to the current popped element is greater than the area value stored in the second area value variable, update the area value stored in the second area value variable to the area value of the all-zero submatrix corresponding to the current popped element until the traversal ends. When updating the area value stored in the second area value variable each time, simultaneously update the coordinate data of the maximum all-zero submatrix. The coordinate data includes the lower left corner coordinates, height, and width of the maximum all-zero submatrix. Among them, the height of the maximum all-zero submatrix is the actual height of the all-zero submatrix corresponding to the area value stored in the second area value variable, the width of the maximum all-zero submatrix is the set width of the all-zero submatrix corresponding to the area value stored in the second area value variable, the row coordinate of the lower left corner coordinate is the row coordinate of the current pixel point, and the column coordinate is the column coordinate of the left extension position of the current popped element. After the traversal ends, determine the coordinates of the target projection area corresponding to the maximum all-zero submatrix according to the coordinate data of the maximum all-zero submatrix.

15. A projector, wherein, The projector includes: a memory, a processor, and a computer program stored on the memory and executable on the processor. The computer program is configured to implement the steps of the automatic obstacle avoidance projection method according to any one of claims 1 to 7.

16. A computer-readable storage medium, wherein, A computer program is stored on the computer-readable storage medium. When the computer program is executed by the processor, it implements the steps of the automatic obstacle avoidance projection method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Projection method, projector and computer readable storage medium

    CN115002430A

  • Projection equipment and obstacle avoidance projection method

    CN115002432A

  • Projection equipment and obstacle avoidance projection method

    CN115022606A

  • Automatic obstacle avoidance projection method and device, projector and computer readable storage medium

    CN117793316A

  • Projection image correction system, projection image correction method, projection image correction program, and computer-readable recording medium

    JP2015007866A

Cited By

  • Deep reinforcement learning path planning method based on local environment driving

    CN121977582A