Matrix type light control system and method based on directed distance field algorithm
Through a matrix lighting control system based on directed distance field algorithm, user-defined animations and real-time photomorphic changes are realized, which solves the problems of poor user experience and large development burden in the existing technology, and improves user experience and system efficiency.
Patent Information
- Application Number
- CN202510798543.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-16
- Publication Date
- 2025-08-12
AI Technical Summary
The existing technology cannot support user-defined matrix lighting animations, the development burden is high, and real-time light changes cannot be achieved, resulting in poor user experience and reduced product profit margins.
A matrix lighting control system based on directed distance field algorithm is adopted, including a light acquisition module, an SDF matrix conversion module and a light driving module. The projected light data is converted into an SDF target matrix through the raster scanning EDT algorithm, and the light control signal is updated through the difference calculation method to achieve natural and smooth changes in the light.
Supports user-defined animations, reduces development complexity, improves user experience, and is suitable for scenes such as ADB headlights to achieve real-time smooth obstacle avoidance and optimizes system development efficiency.
Smart Images

Figure CN120475581A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent lighting control, and in particular to a matrix lighting control system and method based on a directed distance field algorithm. Background Art
[0002] In existing technologies, matrix lighting display control is typically achieved by directly transmitting data representing the on / off / brightness / etc. definitions of the lamp beads to the lighting control program, which then uses the data to achieve real-time display of the lights. After defining the frame rate of the lights' motion, the data is updated with each frame transmission at the corresponding frame rate, ultimately forming the matrix lighting's light shape changes, presenting patterns and continuous frame animation effects. With the development of the automotive industry, consumers have higher demands for the performance of automotive matrix lighting. Although existing technologies can achieve continuous frame animation of matrix lighting patterns, the animation effects rely on manually generating a corresponding number of patterns during the development process, storing them in a specific storage medium, and then calling and continuously playing the data in the lighting control program. This leads to the following problems:
[0003] (1) It cannot support user-defined light shape animation, making the user usage process very complicated.
[0004] (2) The development burden increases. Developers must perform animation editing and generate corresponding signal data for all complex patterns that require light-shape animation, and add a large amount of animation playback program logic. In other words, users are required to manually edit all animation frames, making the light-shape animation conversion editing between complex patterns somewhat difficult.
[0005] (3) For products such as matrix ADB headlights that need to generate light display patterns in real time (ADB headlights need to avoid interfering with other traffic participants in real time), it will be impossible to make the light shape show continuous and natural shape changes, and some advanced experience will be lacking in user perception, which will ultimately reduce the end user's willingness to pay and lead to a decrease in product profit margins.
[0006] The above problems are in urgent need of resolution. Summary of the Invention
[0007] The present invention aims to overcome at least one technical problem existing in the prior art and provides a matrix lighting control system and method based on a directed distance field algorithm.
[0008] On the one hand, an embodiment of the present invention provides a matrix lighting control system based on a directed distance field algorithm, the control system comprising: a light shape acquisition module, an SDF matrix conversion module, an SDF matrix update module and a light driving module; the light shape acquisition module is used to acquire target projection light shape data; the SDF matrix conversion module is used to convert the target projection light shape data into a corresponding SDF target matrix based on a raster scanning EDT algorithm; the SDF matrix update module is used to update the SDF target matrix corresponding to the projection light shape at the next moment through a preset difference calculation method for the SDF target matrix of the target projection light shape; the light driving module is used to map the SDF target matrix corresponding to the projection light shape at the next moment into a light control signal to drive the light based on a preset light control rule.
[0009] Furthermore, the light shape acquisition module is also used to convert the target projection light shape data into a corresponding binary bitmap; wherein 1 represents an inner point of the projection light shape, and 0 represents an outer point of the projection light shape; or 1 represents an outer point of the projection light shape, and 0 represents an inner point of the projection light shape.
[0010] Furthermore, the SDF matrix conversion module integrates an initialization unit, a raster scanning EDT algorithm unit and an SDF matrix generation unit; the initialization unit is used to set corresponding initial values for the inner points and outer points of the projection light shape based on the binary bitmap corresponding to the target projection light shape data to obtain a first SDF initial matrix; the binary bitmap corresponding to the target projection light shape data is flipped to obtain a flipped binary bitmap, and based on the flipped binary bitmap, the inner points and outer points of the projection light shape are set with corresponding initial values to obtain a second SDF initial matrix; the raster scanning EDT algorithm unit is used to scan the first SDF initial matrix and the second SDF initial matrix respectively based on the raster scanning EDT algorithm, traverse the outer points of the projection light shape and obtain the second SDF matrix and the fifth SDF matrix according to preset rules; the SDF matrix generation unit is used to merge the second SDF matrix and the fifth SDF matrix to obtain the SDF target matrix corresponding to the target projection light shape.
[0011] Furthermore, the initialization unit is used to set the inner point of the projection light shape to 0, and set the outer point of the projection light shape to a maximum value.
[0012] Furthermore, a forward scanning unit is integrated in the raster scanning EDT algorithm unit; the forward scanning unit is used to: perform a first scan on the first SDF initial matrix, and obtain the distance values of the left neighbor point, upper neighbor point, upper left neighbor point and upper right neighbor point located outside the current shape respectively; take the minimum distance therein, and if the distance of the current point is greater than the minimum distance, update the value of the point to the distance value of the neighbor point with the minimum distance plus a preset weight value to obtain the first SDF matrix; perform a second scan on the first SDF matrix, and obtain the distance values of the right neighbor point, lower neighbor point, lower right neighbor point and lower left neighbor point located outside the current shape respectively; take the minimum distance therein, and if the distance of the current point is greater than the minimum distance, update the value of the point to the distance value of the neighbor point with the minimum distance plus a preset weight value to obtain the second SDF matrix.
[0013] Furthermore, the raster scanning EDT algorithm unit also integrates a reverse scanning unit, which is used to: perform a first scan on the second SDF initial matrix to obtain the distance values of the left neighbor point, upper neighbor point, upper left neighbor point and upper right neighbor point located outside the current shape respectively; take the minimum distance therein, and if the distance of the current point is greater than the minimum distance, update the value of the point to the distance value of the neighbor point with the minimum distance plus a preset weight value to obtain a third SDF matrix; perform a second scan on the third SDF matrix to obtain the distance values of the right neighbor point, lower neighbor point, lower right neighbor point and lower left neighbor point located outside the current shape respectively; take the minimum distance therein, and if the distance of the current point is greater than the minimum distance, update the value of the point to the distance value of the neighbor point with the minimum distance plus a preset weight value to obtain a fourth SDF matrix; and invert the values corresponding to the inner points of the projected light shape in the fourth SDF matrix to generate a fifth SDF matrix.
[0014] Furthermore, the first scan is based on the SDF initial matrix, and is scanned from left to right and from top to bottom. During the scanning process, if an inner point of the projected light shape is encountered, it is skipped and not processed; the second scan is based on the SDF matrix obtained by the first scan, and is scanned from right to left and from bottom to top. During the scanning process, if an inner point of the projected light shape is encountered, it is skipped and not processed.
[0015] Furthermore, the preset difference calculation method includes:
[0016]
[0017] Where, SDF n is the SDF target matrix corresponding to the projection light shape at time n, SDF1 is the SDF target matrix corresponding to the projection light shape at the current moment, SDF2 is the SDF target matrix of the target projection light shape, t nis the current moment, t n is the initial moment, and t2 is the target moment corresponding to the target projection light shape.
[0018] Furthermore, the lighting control rules include: when the value in the SDF target matrix corresponding to the projection light shape at the next moment is less than or equal to 0, the lamp bead of the pixel point is controlled to light up, and the brightness is proportional to the absolute value of the value; when the value in the SDF target matrix corresponding to the projection light shape at the next moment is greater than 0, the lamp bead of the pixel point is controlled to turn off.
[0019] In a second aspect, an embodiment of the present invention provides a matrix lighting control method based on a signed distance field algorithm, which is applied to the above-mentioned matrix lighting control system based on the signed distance field algorithm. The control method includes: obtaining target projection light shape data; converting the target projection light shape data into a corresponding SDF target matrix based on a raster scanning EDT algorithm; updating the SDF target matrix corresponding to the projection light shape at the next moment through a preset difference calculation method for the SDF target matrix of the target projection light shape; and mapping the SDF target matrix corresponding to the projection light shape at the next moment into a lighting control signal to drive the light based on a preset lighting control rule.
[0020] In another aspect, the present invention further provides a computer-readable storage medium storing one or more instructions, wherein the computer instructions are used to enable the computer to execute the above-mentioned matrix lighting control method based on the signed distance field algorithm.
[0021] On the other hand, the present invention provides an electronic device comprising: a memory and a processor; the memory stores at least one program instruction; the processor implements the above-mentioned matrix lighting control method based on the signed distance field algorithm by loading and executing the at least one program instruction.
[0022] The beneficial effects of the present invention are:
[0023] (1) Improved user experience: supports custom animations with a small number of keyframes, and the projection light shape changes naturally and smoothly.
[0024] (2) Optimized the system development efficiency: During use, users do not need to manually edit all animation frames, but only need to configure key frames and time parameters.
[0025] (3) Enhanced real-time performance: Applicable to scenarios such as ADB headlights, generating smooth obstacle avoidance light shapes in real time. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The present invention will be further described below with reference to the accompanying drawings and examples.
[0027] Figure 1 This is a schematic structural diagram of a matrix lighting control system based on a directed distance field algorithm provided in Example 1 of the present invention.
[0028] Figure 2 This is a schematic diagram of a method for describing light shape using a signed distance field provided in Example 1 of the present invention.
[0029] Figure 3 Schematic diagram of a method for generating signed distance field data (8SSEDT algorithm) provided in Example 1 of the present invention.
[0030] Figure 4a This is a schematic diagram of a current projection light pattern provided by Example 1 of the present invention.
[0031] Figure 4b This is a schematic diagram of a projection light pattern corresponding to 2350ms provided in Example 1 of the present invention.
[0032] Figure 4c This is a schematic diagram of a projection light pattern corresponding to 4651ms provided in Example 1 of the present invention.
[0033] Figure 4d This is a schematic diagram of a target projection light pattern provided by Example 1 of the present invention.
[0034] Figure 4e This is a schematic diagram of an operating interface of a matrix lighting control system based on a directed distance field algorithm provided in Example 1 of the present invention.
[0035] Figure 5 This is a flow chart of a matrix lighting control method based on a signed distance field algorithm provided in Example 2 of the present invention.
[0036] Figure 6 This is a partial block diagram of an electronic device provided in Example 4 of the present invention. DETAILED DESCRIPTION
[0037] Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the various operations as sequential processes, many of the operations therein can be implemented in parallel, concurrently, or simultaneously. In addition, the order of the various operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0038] It should be understood that although the terms "first," "second," and the like may be used herein to describe various elements, these elements should not be limited by these terms. These terms are used solely to distinguish one element from another. For example, a first element may be referred to as a second element, and similarly, a second element may be referred to as a first element, without departing from the scope of the exemplary embodiments. The term "and / or" as used herein includes any and all combinations of one or more of the listed associated items.
[0039] The present invention will now be described in detail with reference to the accompanying drawings. This figure is a simplified schematic diagram, which only illustrates the basic structure of the present invention in a schematic manner, and therefore only shows the components related to the present invention.
[0040] For ease of understanding, the following professional terms are explained here:
[0041] SDF (Signed Distance Field) is a technology commonly used in computer graphics to describe image contours. It is commonly used in text rendering and shadow processing in software development. The core idea of recording information can be summarized as follows: record the distance from the current point to the nearest shape edge, record the inside of the shape as a negative (or positive) value, and record the outside of the shape as a positive (or negative) value, thereby obtaining a Euclidean distance field (expressed as a two-dimensional matrix in a two-dimensional state), forming a mathematical description of the shape, such as Figure 2 shown.
[0042] Example 1
[0043] For ease of understanding, the invention concept is generally described before describing the embodiments of the present invention in detail: The present invention provides a matrix lighting control system based on a signed distance field algorithm, which realizes smooth animation control of matrix lighting through a signed distance field (SDF) algorithm. The core principle is to use mathematical interpolation to describe light shape changes, reduce development burden and improve user experience. The following are the specific working principles and steps: SDF technical basis: Use a two-dimensional matrix to record the distance from each point to the edge of the light shape, with negative values (or positive values) inside the shape and positive values (or negative values) outside the shape to form a mathematical description of the light shape. By interpolating the SDF matrices of different light shapes, an intermediate transition state is generated to achieve a smooth gradient of the light shape contour, rather than the traditional brightness gradient. The 8SSEDT algorithm converts light shape data: using raster scanning dynamic programming, the minimum distance from each point to the edge of the shape is calculated in two scans (adjacent edge weight 1, hypotenuse weight ), generate an SDF matrix. The algorithm complexity is (O(n)), which is suitable for real-time processing of on-board chips. The core steps include: 1. SDF conversion of light shape data, input: the external system (such as user settings or sensor signals) provides target light shape data (such as key frame light shape). Processing: The target light shape is converted into a target SDF matrix (a two-dimensional array storing single-precision floating-point numbers) through the 8SSEDT algorithm, and the distance field information of the light shape profile is recorded. 2. SDF matrix interpolation calculation (core logic): Compare the current and target matrices: When the program loops, extract the current SDF matrix (initially the result of the previous frame) and the target SDF matrix. Interpolation method: Perform a weighted average of the values of each corresponding position in the two matrices to update the current SDF matrix. Through continuous interpolation, the current light shape gradually approaches the target light shape, forming a shape gradient animation (such as a smooth transition from an arrow light shape to a red flag light shape). 3. Convert the SDF matrix to lighting control data (output execution): Map the current SDF matrix values to the on / off state or brightness of the lamp beads (e.g., negative areas light up, positive areas turn off or dim). Drive the lighting module to display the current light shape in real time, completing the conversion from mathematical description to physical lighting. 4. Iterate and generate continuous animation: The program runs continuously, repeating the above steps: If the target light shape is updated (e.g., the user sets a new keyframe), the interpolation calculation is re-performed; if there is no update, the animation is progressed at a fixed frame rate to maintain smoothness.
[0044] The specific implementation is as follows:
[0045] like Figure 1 , which is a schematic structural diagram of a matrix lighting control system based on a directed distance field algorithm provided by the present invention.
[0046] As an example, the control system includes: a light shape acquisition module 1, an SDF matrix conversion module 2, an SDF matrix update module 3 and a light driving module 4; the light shape acquisition module 1 is used to acquire target projection light shape data; the SDF matrix conversion module 2 is used to convert the target projection light shape data into the corresponding SDF target matrix based on the raster scanning EDT algorithm; the SDF matrix update module 3 is used to update the SDF target matrix corresponding to the projection light shape at the next moment through a preset difference calculation method for the SDF target matrix of the target projection light shape; the light driving module 4 is used to map the SDF target matrix corresponding to the projection light shape at the next moment into a light control signal to drive the light based on a preset light control rule.
[0047] In some feasible implementations, the light shape acquisition module 1 is also used to convert the target projection light shape data into a corresponding binary bitmap; wherein, 1 represents the inner point of the projection light shape, and 0 represents the outer point of the projection light shape; or 1 represents the outer point of the projection light shape, and 0 represents the inner point of the projection light shape. Specifically, the user can draw the animation keyframes to be output through the vehicle-mounted touch screen. Input method: Through an external input module (such as a touch screen), use your finger to draw or select a preset graphic (such as an arrow) on the touch screen, and the system automatically generates a binary bitmap (1 represents a lit area, and 0 represents an unlit area). Set the total animation duration and frame rate.
[0048] In some feasible embodiments, the SDF matrix conversion module 2 integrates an initialization unit 20, a raster scanning EDT algorithm unit 21 and an SDF matrix generation unit 22; the initialization unit 20 is used to set corresponding initial values for the inner points and outer points of the projection light shape based on the binary bitmap corresponding to the target projection light shape data to obtain a first SDF initial matrix; the binary bitmap corresponding to the target projection light shape data is flipped to obtain a flipped binary bitmap, and based on the flipped binary bitmap, the inner points and outer points of the projection light shape are set with corresponding initial values to obtain a second SDF initial matrix; the raster scanning EDT algorithm unit 21 is used to scan the first SDF initial matrix and the second SDF initial matrix respectively based on the raster scanning EDT algorithm, traverse the outer points of the projection light shape and obtain the second SDF matrix and the fifth SDF matrix according to preset rules; the SDF matrix generation unit 22 is used to merge the second SDF matrix and the fifth SDF matrix to obtain the SDF target matrix corresponding to the target projection light shape.
[0049] Preferably, the initialization unit 20 is used to set the inner point of the projection light shape to 0, and set the outer point of the projection light shape to a maximum value.
[0050] Specifically, if the binary bitmap of the target projection light shape is:
[0051] The binary bitmap after flipping is:
[0052] Then the first SDF initial matrix is:
[0053]
[0054] Then the second SDF initial matrix is:
[0055]
[0056] In some feasible implementations, the forward scanning unit 210 is integrated into the raster scanning EDT algorithm unit 21; the forward scanning unit 210 is used to: perform a first scan on the first SDF initial matrix, and obtain the distance values of the left neighbor point, upper neighbor point, upper left neighbor point, and upper right neighbor point located outside the current shape respectively; take the minimum distance therein, and if the distance of the current point is greater than the minimum distance, then update the value of the point to the distance value of the neighbor point with the minimum distance plus a preset weight value, and obtain the first SDF matrix; perform a second scan on the first SDF matrix, and obtain the distance values of the right neighbor point, lower neighbor point, lower right neighbor point, and lower left neighbor point located outside the current shape respectively; take the minimum distance therein, and if the distance of the current point is greater than the minimum distance, then update the value of the point to the distance value of the neighbor point with the minimum distance plus a preset weight value, and obtain the second SDF matrix. Specifically, in combination with Figure 3 As shown, the first scan is based on the SDF initial matrix, scanning from left to right and from top to bottom. During the scanning process, if an inner point of the projected light shape is encountered, it is skipped and not processed; the second scan is based on the SDF matrix obtained by the first scan, scanning from right to left and from bottom to top. During the scanning process, if an inner point of the projected light shape is encountered, it is skipped and not processed. Here, the first and second SDF initial matrices are still used as examples for explanation. The horizontal and vertical weights are set to 1, and the oblique weight is set to Then the first SDF matrix is:
[0057]
[0058] The calculation starts from the first row and first column of the first SDF initial matrix, "∞". There are no left neighbor points, upper neighbor points, upper left neighbor points, and upper right neighbor points. Therefore, the first row and first column of the first SDF matrix is still "∞". Similarly, for the "∞" in the first row, second column, and third column of the first SDF initial matrix, the corresponding positions in the first SDF matrix are still "∞". For the "0" in the first row and fourth column of the first SDF initial matrix, since it is an internal point of the projected light shape, it is directly skipped and not processed. For the "∞" in the first row and fifth column of the first SDF initial matrix, its left neighbor point is "0" and there are no upper neighbor points, upper left neighbor points, and upper right neighbor points. Therefore, its minimum value is 0, and the corresponding weight is 1. The calculated value of the first row and fifth column of the first SDF initial matrix is 0+1=1. Then scan rows 2-5 in sequence. Since the calculation method is the same, it is not repeated here.
[0059] Similarly, the second SDF matrix is obtained by scanning the first matrix from right to left and from bottom to top:
[0060]
[0061] In some feasible embodiments, the raster scanning EDT algorithm unit 21 further integrates a reverse scanning unit 211, which is used to: perform a first scan on the second SDF initial matrix to obtain the distance values of the left neighbor point, upper neighbor point, upper left neighbor point and upper right neighbor point located outside the current shape respectively; take the minimum distance therein, and if the distance of the current point is greater than the minimum distance, update the value of the point to the distance value of the neighbor point with the minimum distance plus a preset weight value to obtain a third SDF matrix; perform a second scan on the third SDF matrix to obtain the distance values of the right neighbor point, lower neighbor point, lower right neighbor point and lower left neighbor point located outside the current shape respectively; take the minimum distance therein, and if the distance of the current point is greater than the minimum distance, update the value of the point to the distance value of the neighbor point with the minimum distance plus a preset weight value to obtain a fourth SDF matrix; and invert the values corresponding to the inner points of the projected light shape in the fourth SDF matrix to generate a fifth SDF matrix.
[0062] Preferably, the second SDF initial matrix obtained by the above calculation is:
[0063] To illustrate, the third matrix is:
[0064] Then the fourth matrix is:
[0065] Then the fifth matrix is:
[0066]
[0067] Preferably, the SDF matrix generation unit 22 is configured to merge the second SDF matrix and the fifth SDF matrix to obtain an SDF target matrix corresponding to the target projection light shape, including: when the same position in the second SDF matrix and the fifth SDF matrix is 0, the value of the merged SDF target matrix at that position is also 0; if one of the same position in the second SDF matrix and the fifth SDF matrix is not 0, the value of the merged SDF target matrix at that position is the one that is not 0. Specifically, based on the second SDF matrix and the fifth SDF matrix obtained by the above calculation, the SDF target matrix obtained after merging is:
[0068]
[0069] Preferably, part of the program code corresponding to the above method is as follows:
[0070]
[0071]
[0072]
[0073] The advantages of using this method to implement the signed distance field (SDF) are as follows: (1) Clear and efficient logic: By scanning twice (upper left → lower right, lower right → upper left), the 8-neighborhood is covered and the minimum distance is gradually updated. The computational complexity is low (O(W×H)), which is suitable for real-time scenarios. (2) Strict boundary processing: Conditional judgment is used to avoid array out-of-bounds, ensuring that the neighbor distance can be correctly calculated for pixels at different positions. (3) Strong flexibility: By adjusting the GRID_W, GRID_H, and DIAGONAL parameters, the chessboard distance (Chebyshev) or the approximate Euclidean distance can be adapted to meet different accuracy requirements. (4) Low space complexity: Only an SDF matrix of the same size as the input image is required, without the need for additional complex data structures, which is suitable for memory-constrained environments.
[0074] In some feasible implementations, the preset difference calculation method includes:
[0075]
[0076] Where, SDF n is the SDF target matrix corresponding to the projection light shape at time n, SDF1 is the SDF target matrix corresponding to the projection light shape at the current moment, SDF2 is the SDF target matrix of the target projection light shape, t n is the current moment, t n is the initial moment, and t2 is the target moment corresponding to the target projection light shape.
[0077] Specifically, SDF1 is the SDF target matrix corresponding to the projection light shape at the current moment. If the current moment is the initial moment, the SDF target matrix corresponding to the projection light shape at the current moment is the pre-stored SDF target matrix. If the current moment is not the initial moment, the SDF target matrix corresponding to the projection light shape at the current moment is the SDF matrix of the projection calculated in the previous frame.
[0078] In some feasible implementations, the lighting control rules include: when the value in the SDF target matrix corresponding to the projected light shape at the next moment is less than or equal to 0, the light bead at the pixel point is controlled to light up, and the brightness is proportional to the absolute value of the value; when the value in the SDF target matrix corresponding to the projected light shape at the next moment is greater than 0, the light bead at the pixel point is controlled to turn off. It should be noted that the control rules for lighting control based on the SDF target matrix are not limited here. That is, the specific control method can be modified by relevant technicians based on actual needs.
[0079] In some possible implementations, reference Figures 4a-4e As shown, Figure 4e Schematic diagram of the operation interface of the matrix lighting control system based on the directed distance field algorithm. The initial projection light shape obtained by the above method of this embodiment is shown in 4a. The purpose is to convert the "arrow" projection light shape into the following Figure 4d The projection light shape of the "red flag" shown in the figure is set to 5000ms. In actual operation, the corresponding projection light shape at 2350ms is as follows: Figure 4b As shown, the corresponding projection light shape at 4651ms is as follows Figure 4c As shown, the projection light shape at 5000ms is as follows Figure 4d shown.
[0080] In some feasible implementations, if the application scenario is ADB headlight obstacle avoidance, the specific process is as follows: Sensor input: The camera detects the vehicle in front and generates a binary mask of the obstacle position (the obstacle area is 1, and the rest are 0). Dynamic generation of SDF matrix: Execute the 8SSEDT algorithm on the obstacle mask to generate the SDF matrix of the "shading area" (negative values inside the obstacle and positive values outside). Interpolation obstacle avoidance logic: The current light shape is the normal lighting mode (SDF matrix A), and the target light shape is the obstacle avoidance shading mode (SDF matrix B). The controller completes the interpolation from A to B within 100ms, and the light contour avoids the obstacle area in real time to avoid glare interference.
[0081] Specifically, in order to demonstrate the advantages of this embodiment, the traditional solution is compared with the solution described in this embodiment, and the results are shown in Table 1 below:
[0082] Table 1:
[0083] Traditional solutions Solution of the present invention All obstacle avoidance shape frames need to be pre-stored and cannot respond in real time Only obstacle mask is needed to automatically generate smooth shading contours The shading is switched to "hard cut", and the edges are abrupt Based on SDF interpolation, the shading edge transitions naturally to reduce visual impact Development needs to adapt to various obstacle shapes The general algorithm is adaptable to any shape and has strong scalability
[0084] In some feasible implementations, automated processing of projected light shapes is achieved by combining SDF technology with the 8SSEDT algorithm. Due to SDF's concise mathematical representation, distance fields with the same shape but different values can be easily interpolated to obtain "intermediate transition states" of the distance field. These transition states can still be expressed as shapes with the same shape but different values. This allows SDF to easily describe shape changes, creating animations of changing patterns. For continuously changing dynamic processes, we simply need to continuously update the interpolation target value, using the current value as the starting point and performing new interpolation processes to achieve animated transitions under dynamic shape changes. Furthermore, SDF data naturally exhibits smooth transitions when representing shapes, making it particularly useful for edge processing. For ADB lighting systems, this also facilitates the creation of additional dark zone protection safety zones. By treating the matrix light shape as the shape we need to process, SDF technology can be used to control the light system and achieve a smooth transition visual effect. This visual effect eliminates the need for complex transition logic and relies solely on the inherent mathematical representation of distance fields.
[0085] It is worth noting that all modules involved in this embodiment are logical units. In actual applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. Furthermore, to highlight the innovations of this invention, this embodiment does not include units that are not closely related to solving the technical problems proposed by this invention. However, this does not mean that other units do not exist in this embodiment.
[0086] Example 2
[0087] See also Figure 5 , this embodiment provides a flow chart of a matrix lighting control method based on a signed distance field algorithm.
[0088] As an example, the method is applied to the matrix lighting control system based on the directed distance field algorithm described in Example 1. The control method includes:
[0089] Step S1: Obtain target projection light shape data.
[0090] Step S2: converting the target projection light shape data into a corresponding SDF target matrix based on a raster scanning EDT algorithm.
[0091] Step S3: updating the SDF target matrix corresponding to the projection light shape at the next moment by using a preset difference calculation method for the SDF target matrix of the target projection light shape.
[0092] Step S4: Mapping the SDF target matrix corresponding to the projection light shape at the next moment into a light control signal to drive the light based on the preset light control rule.
[0093] It is not difficult to find that this embodiment is a method example corresponding to the first embodiment, and this embodiment can be implemented in conjunction with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in this embodiment, and to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied to the first embodiment.
[0094] Example 3
[0095] An embodiment of the present invention further provides a storage medium storing a matrix light control method based on a signed distance field algorithm. When executed by a processor, this matrix light control program based on a signed distance field algorithm implements the steps of the matrix light control method based on a signed distance field algorithm as described above. Because this storage medium incorporates all the technical solutions of all the aforementioned embodiments, it possesses at least all the beneficial effects brought about by the technical solutions of these embodiments, and therefore will not be further elaborated upon here.
[0096] Example 4
[0097] See also Figure 6 An embodiment of the present invention further provides an electronic device, comprising: a memory and a processor; the memory stores at least one program instruction; the processor implements the matrix lighting control method based on the directed distance field algorithm provided in Example 2 by loading and executing the at least one program instruction.
[0098] The memory 702 and processor 701 are connected using a bus. The bus can include any number of interconnected buses and bridges, connecting various circuits of one or more processors 701 and memory 702. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits. These are all well known in the art and, therefore, are not described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single component or multiple components, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by the processor 701 is transmitted over a wireless medium via an antenna. Furthermore, the antenna receives data and transmits it to the processor 701.
[0099] The processor 701 is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. The memory 702 can be used to store data used by the processor 701 when performing operations.
[0100] The above is only an embodiment of the present invention. Common knowledge such as the known specific structures and characteristics in the scheme is not described in detail here. Ordinary technicians in the field are aware of all common technical knowledge in the technical field of the invention before the application date or priority date, can obtain all existing technologies in the field, and have the ability to apply conventional experimental means before that date. Ordinary technicians in the field can improve and implement this scheme in combination with their own abilities under the inspiration given by this application. Some typical known structures or known methods should not become obstacles for ordinary technicians in the field to implement this application. It should be pointed out that for those skilled in the art, without departing from the structure of the present invention, several variations and improvements can be made, which should also be regarded as the scope of protection of the present invention. These will not affect the effect of the implementation of the present invention and the practicality of the patent. The scope of protection required by this application shall be based on the content of its claims, and the specific implementation methods and other records in the specification can be used to interpret the content of the claims.
Claims
1. A matrix lighting control system based on a directed distance field algorithm, characterized in that: The control system includes: a light shape acquisition module, an SDF matrix conversion module, an SDF matrix update module and a light driving module; The light shape acquisition module is used to acquire target projection light shape data; The SDF matrix conversion module is used to convert the target projection light shape data into a corresponding SDF target matrix based on a raster scanning EDT algorithm; The SDF matrix updating module is used to update the SDF target matrix corresponding to the projection light shape at the next moment by using a preset difference calculation method for the SDF target matrix of the target projection light shape; The light driving module is used to map the SDF target matrix corresponding to the projection light shape at the next moment into a light control signal to drive the light based on a preset light control rule.
2. The matrix lighting control system based on the directed distance field algorithm according to claim 1, characterized in that: The light shape acquisition module is further used to convert the target projection light shape data into a corresponding binary bitmap; wherein 1 represents an inner point of the projection light shape, and 0 represents an outer point of the projection light shape; or 1 represents an outer point of the projection light shape, and 0 represents an inner point of the projection light shape.
3. The matrix lighting control system based on the directed distance field algorithm according to claim 2, characterized in that: The SDF matrix conversion module is integrated with an initialization unit, a raster scanning EDT algorithm unit and an SDF matrix generation unit; The initialization unit is used to set corresponding initial values for the inner points and the outer points of the projection light shape based on the binary bitmap corresponding to the target projection light shape data to obtain a first SDF initial matrix; Flipping the binary bitmap corresponding to the target projection light shape data to obtain a flipped binary bitmap, and setting corresponding initial values for the inner point and the outer point of the projection light shape based on the flipped binary bitmap to obtain a second SDF initial matrix; The raster scanning EDT algorithm unit is used to obtain the second SDF matrix and the fifth SDF matrix by scanning the first SDF initial matrix and the second SDF initial matrix respectively based on the raster scanning EDT algorithm, traversing the outer points of the projection light shape and using a preset rule; The SDF matrix generating unit is used to merge the second SDF matrix and the fifth SDF matrix to obtain an SDF target matrix corresponding to the target projection light shape.
4. The matrix lighting control system based on the directed distance field algorithm according to claim 3, characterized in that: The initialization unit is used to set the inner point of the projection light shape to 0 and the outer point of the projection light shape to a maximum value.
5. The matrix lighting control system based on the directed distance field algorithm according to claim 3, characterized in that: The raster scanning EDT algorithm unit is integrated with a forward scanning unit; the forward scanning unit is used to: Perform a first scan on the first SDF initial matrix to obtain the distance values of the left neighbor point, the upper neighbor point, the upper left neighbor point, and the upper right neighbor point located outside the current shape; Take the minimum distance. If the distance of the current point is greater than the minimum distance, update the value of the point to the distance value of the neighboring point with the minimum distance plus the preset weight value to obtain the first SDF matrix. Scan the first SDF matrix a second time to obtain distance values of the right neighbor point, the lower neighbor point, the lower right neighbor point, and the lower left neighbor point located outside the current shape; Take the minimum distance. If the distance of the current point is greater than the minimum distance, update the value of the point to the distance value of the neighboring point with the minimum distance plus the preset weight value to obtain the second SDF matrix.
6. The matrix lighting control system based on the directed distance field algorithm according to claim 5, characterized in that: The raster scanning EDT algorithm unit also integrates a reverse scanning unit for: Perform a first scan on the second SDF initial matrix to obtain distance values of the left neighbor point, the upper neighbor point, the upper left neighbor point, and the upper right neighbor point located outside the current shape; Take the minimum distance. If the distance of the current point is greater than the minimum distance, update the value of the point to the distance value of the neighboring point with the minimum distance plus the preset weight value to obtain the third SDF matrix. Scan the third SDF matrix a second time to obtain distance values of the right neighbor point, the lower neighbor point, the lower right neighbor point, and the lower left neighbor point located outside the current shape; Take the minimum distance. If the distance of the current point is greater than the minimum distance, update the value of the point to the distance value of the neighboring point with the minimum distance plus the preset weight value to obtain the fourth SDF matrix. The values corresponding to the inner points of the projected light shape in the fourth SDF matrix are inverted to generate a fifth SDF matrix.
7. The matrix lighting control system based on the directed distance field algorithm according to claim 5 or 6, characterized in that: The first scan is based on the SDF initial matrix and is performed from left to right and from top to bottom. During the scanning process, if any inner point of the projected light shape is encountered, it is skipped and not processed; The second scan is based on the SDF matrix obtained by the first scan, and is performed from right to left and from bottom to top. During the scanning process, if an inner point of the projected light shape is encountered, it is skipped and not processed.
8. The matrix lighting control system based on the directed distance field algorithm according to claim 1, characterized in that: The preset difference calculation method includes: Where, SDF n is the SDF target matrix corresponding to the projection light shape at time n, SDF1 is the SDF target matrix corresponding to the projection light shape at the current moment, SDF2 is the SDF target matrix of the target projection light shape, t n is the current moment, t n is the initial moment, and t2 is the target moment corresponding to the target projection light shape.
9. The matrix lighting control system based on the directed distance field algorithm according to claim 8, characterized in that: The lighting control rules include: When the value in the SDF target matrix corresponding to the next moment projection light shape is less than or equal to 0, the lamp bead of the pixel point is controlled to light up, and the brightness is proportional to the absolute value of the value; When the value in the SDF target matrix corresponding to the projection light shape at the next moment is greater than 0, the lamp bead of the pixel point is controlled to be turned off.
10. A matrix lighting control method based on a directed distance field algorithm, the method being applied to the matrix lighting control system based on a directed distance field algorithm according to any one of claims 1 to 9, characterized in that: The control method includes: Obtain target projection light shape data; Converting the target projection light shape data into a corresponding SDF target matrix based on a raster scanning EDT algorithm; The SDF target matrix of the target projection light shape is updated with the SDF target matrix corresponding to the projection light shape at the next moment by a preset difference calculation method; Based on the preset lighting control rules, the SDF target matrix corresponding to the projection light shape at the next moment is mapped into a lighting control signal to drive the light.