A projection trapezoid correction method and projection device

By employing a segmented pipeline algorithm of row-by-row iterative horizontal correction and column-by-column iterative vertical correction within the image processing chip, combined with a ping-pong row cache architecture, the problem of large storage space occupation in existing technologies is solved, achieving efficient and low-cost trapezoidal correction that adapts to various asymmetric trapezoidal distortions.

CN123123548APending Publication Date: 2026-11-17TENGPU DISPLAY TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611592740.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-15
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing digital keystone correction methods require caching complete image frames, which consumes a large amount of storage space, resulting in high hardware costs and high system resource consumption.

Method used

A segmented pipelined trapezoidal correction algorithm is adopted, which uses row-by-row iterative horizontal correction and column-by-column iterative vertical correction. The trapezoidal correction is completed within the image processing chip through a ping-pong segmented row cache architecture, avoiding the caching of complete frame image data and utilizing on-chip memory resources for adaptive storage and interpolation operations.

Benefits of technology

It significantly reduces the storage space requirements of image processing chips, lowers hardware selection costs, and simultaneously achieves high-precision keystone correction, adapting to any asymmetrical keystone image and expanding the correction range and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123123548A_ABST
    Figure CN123123548A_ABST
Patent Text Reader

Abstract

This invention discloses a projection trapezoidal correction method, comprising: calculating the number of vertical offset rows of the image corresponding to each vertex; configuring a multi-level distortion judgment threshold T according to a level coefficient; calculating the effective pixel length of a single row after horizontal extraction; calculating the overall horizontal compression scaling factor of the image; calculating the initial horizontal scaling factor and vertical scaling factor of a single frame; calculating the column address of the original image according to a set independent column iteration variable x; then obtaining the neighboring pixel data source required for horizontal linear interpolation; performing horizontal linear trapezoidal correction based on the neighboring pixel data source; calculating the row address of the original image according to a set row-by-row iteration variable y; reading the pixel data of the completed horizontal linear trapezoidal correction according to the original image row address; obtaining the neighboring pixel data source required for vertical linear interpolation; performing vertical trapezoidal distortion correction based on the vertical neighboring pixel source; and outputting the trapezoidally corrected image pixels. This invention also discloses a projection device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to projection technology, and more specifically to a method for correcting projection trapezoidal distortion. Background Technology

[0002] Projectors are primarily used for home viewing and indoor office projection. When using a projector, it should be directly facing a wall or screen to maintain a standard rectangular image for optimal display. When the projector is tilted vertically or horizontally, side-projected, or mounted too high or too low, the projected image will become trapezoidal in shape with non-parallel edges—this is trapezoidal distortion. Trapezoidal correction algorithms are image processing algorithms specifically designed to repair this distortion and restore the trapezoidal shape to a standard rectangle.

[0003] Keystone correction algorithms are divided into two types: digital keystone correction and optical keystone correction. Digital keystone correction is implemented through software algorithms, with the underlying principle being geometric perspective transformation. When a projector projects a trapezoidal image due to misalignment, as long as the magnitude of the projected trapezoidal distortion is known, image resampling can be performed through perspective transformation. After perspective transformation, the output rectangular image is transformed into a trapezoidal image complementary to the projected image. This trapezoidal image cancels out the trapezoidal image projected due to misalignment, making the projected image rectangular again. Optical keystone correction uses hardware and optical methods to correct keystone distortion. When the projector is misaligned, the projection angle of the optical components is adjusted synchronously to ensure that the projected image is rectangular. Optical keystone correction produces no image distortion but is costly. Digital keystone correction produces a slightly distorted image but does not increase additional costs, and with optimizations using bilinear interpolation and bicubic interpolation algorithms, image distortion is further reduced. Therefore, digital keystone correction is gradually becoming the mainstream.

[0004] The underlying mathematical principle of digital keystone correction is perspective transformation, which involves resampling the input image before outputting it. This resampling is random; that is, the position (j, k) of the pixel (x, y) in the output image O relative to the original image I is calculated based on the angle to be corrected. However, the next pixel (x+1, y) in the output image O is highly unlikely to be (j+1, k) in the original image I. Therefore, image data from different storage locations in the original image I needs to be randomly read and filled into the output image O.

[0005] In existing projection keystone correction processes, image data storage methods are mainly divided into two categories: The first type relies on the on-chip memory built into the image processing chip to store the complete frame of image data; The second type uses external memory as the image frame buffer medium, and reads the required pixel data from the external memory during the correction operation stage.

[0006] Existing digital keystone correction methods require random access to pixels at any position in the image during distortion interpolation and resampling. Therefore, when implementing correction using on-chip storage, at least two complete image frames must be cached. This method demands a huge amount of on-chip storage capacity, resulting in high hardware costs. As resolution increases, storage requirements grow dramatically, which conventional image processing chips cannot meet, necessitating the use of high-specification chips, further increasing hardware costs.

[0007] Another existing keystone correction implementation uses external memory to cache complete image frames to meet the interpolation random read requirements. The correction process requires frequent cross-chip reads and writes to external memory to obtain interpolated pixels, which causes keystone correction image delay and consumes a large amount of bus bandwidth, resulting in high overall system resource overhead.

[0008] Obviously, existing digital keystone correction methods require caching complete image frames, which consumes a large amount of storage space. Summary of the Invention

[0009] To address the technical problem that existing digital keystone correction methods require caching complete image frames, resulting in large storage space requirements, this invention provides a projection keystone correction method and projection device.

[0010] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is to design a projection trapezoid correction method, comprising: S1: Perform pixel format conversion on the original image. Combined with the chip's timing margin and static configuration, store the number of pixels K in a single address packet. After format conversion and pixel packetization, store the single-row original image in the intermediate cache storage unit of the chip's built-in on-chip memory. Obtain the coordinates of the four vertices of the trapezoid and calculate the vertical offset row number corresponding to each vertex. The coordinates of the four vertices of the trapezoid include the coordinates of the top left vertex (...). The coordinates of the top right vertex are ( The coordinates of the lower left vertex are ( The coordinates of the lower right vertex are ( ); S2: Configure a multi-level distortion judgment threshold T according to the gear coefficient, and compare the distortion judgment threshold T with the number of vertical offset rows of each vertex to match the corresponding gear, calculate the effective pixel length of a single row after horizontal extraction reduce_n, and calculate the overall horizontal compression scaling factor reduce_fac of the screen by combining the total number of horizontal pixel columns n of the original image. S3: Calculate the initial horizontal scaling factor h_scale and vertical scaling factor v_scale of a single frame based on the coordinates of the four vertices of the trapezoid, the total number of horizontal pixel columns n and the total number of vertical pixel rows m of the original image; S4: Calculate the original image column address ram_addr based on the set independent column iteration variable x, combined with the real-time horizontal scaling factor h_scale, the overall horizontal compression scaling factor reduce_fac, and the left boundary horizontal offset value hl_offset; S5: Read the uncompressed original pixels in the intermediate cache storage unit according to the original image column address, complete the boundary verification and filter the left and right adjacent pixels, and obtain the neighboring pixel data source required for horizontal linear interpolation; S6: Based on the neighboring pixel data source, complete the full-resolution horizontal linear trapezoidal correction within a single row, and write the corrected pixels into the on-chip ping-pong row buffer unit after horizontal extraction and compression. S7: Based on the set row-by-row iteration variable y, combined with the real-time vertical scaling factor v_scale and the upper boundary vertical offset value vt_offset, calculate the original image row address ram_choose; S8: Read the pixel data that has been horizontally linearly corrected and compressed by the overall horizontal compression scaling factor reduce_fac in the on-chip ping-pong row cache unit according to the original image row address, complete the boundary verification and filter the adjacent pixels above and below, and obtain the neighboring pixel data source required for vertical linear interpolation. S9: Based on the vertically adjacent pixel sources, complete the vertical trapezoidal distortion correction, simultaneously perform horizontal upsampling, compensate for the horizontal pixels that were extracted and discarded by the overall horizontal compression scaling factor reduce_fac in stage S2, restore the original image resolution, and output the final corrected pixels.

[0011] The distortion determination threshold T satisfies the following relationship: ; The base number of rows is the maximum total number of original image rows that the chip's built-in on-chip memory can cache, and the level coefficients are configured as 0.5, 0.75, 1, 1.25, 1.5, 1.75, and 2, respectively.

[0012] The overall horizontal compression scaling factor reduce_fac of the image satisfies the following relationship: ; The overall horizontal scaling factor of the image participates in the horizontal addressing and vertical boundary iteration calculations throughout the process, uniformly adapting to the size of the extracted and compressed image. Based on the overall horizontal compression scaling factor reduce_fac obtained by matching the multi-level distortion judgment threshold T, multiple adaptive storage modes are divided: when the number of vertical offset rows of all vertices matches the low-level distortion judgment threshold, the conventional storage mode is adopted, and all horizontal column pixels of the image are completely preserved. Horizontal pixel extraction is not performed, and a single physical storage row of the chip's built-in on-chip memory stores only one row of complete image pixels; when the number of vertical offset rows of any vertex matches the high-level distortion judgment threshold, horizontal pixel interval extraction and compression with the corresponding magnification is performed, reducing the storage amount of effective horizontal pixels in a single row.

[0013] The calculation of the initial horizontal scaling factor h_scale and vertical scaling factor v_scale of a single frame based on the coordinates of the four vertices of the trapezoid, the total number of horizontal pixel columns n and the total number of vertical pixel rows m of the original image includes: The upper horizontal boundary is defined by the upper left and upper right vertices, and the left vertical boundary is defined by the upper left and lower left vertices; the lower right vertex participates in the subsequent iterative calculation of row-level horizontal offset increment and column-level vertical offset increment. The horizontal scaling factor h_scale and the vertical scaling factor v_scale satisfy the following relationship:

[0014]

[0015] in, This represents the total number of columns of valid pixels at the top horizontal boundary of the image. denoted as the total number of rows of valid pixels on the left vertical boundary of the image, where n and m represent the total number of horizontal pixel columns and the total number of vertical pixel rows in the original image, respectively.

[0016] The original image column address ram_addr satisfies the following relationship:

[0017] During the horizontal correction addressing phase, when the read enable is valid, an independent column iteration variable x is used, and the value range of the original image column address is 1 to n; when the address overflows, the selected pixel value is set to 0; when the read enable is invalid, the column iteration variable x is reset to 1.

[0018] The step of performing full-resolution horizontal linear trapezoidal correction within a single row based on the neighboring pixel data source, and writing the corrected pixels into the on-chip ping-pong row buffer unit after horizontal extraction and compression, includes: The horizontal linear interpolation calculation is performed using the fractional part of the original image column address as the interpolation weight to generate horizontally corrected pixels; the matching level is selected according to the current storage mode to perform horizontal pixel extraction and compression, and the extracted pixels are written to the on-chip ping-pong row cache unit. The single-row pixel traversal adopts a packing step addressing rule. After completing K pixel interpolation processing, the column iteration variable x increments by K to adapt to the hardware multi-pixel packing addressing timing. This stepping operation is a pixel-level single iteration. Within the processing cycle of a single row of effective pixels, the row-level parameters remain constant and the left and right boundary offsets of the trapezoid are not updated. Only when switching the corresponding image blanking period of adjacent effective rows, the horizontal offset values ​​of the left and right boundaries are updated iteratively first, and then the horizontal effective span and horizontal scaling factor are calculated to prepare the row-level parameters for the next row correction. The left boundary row increment hl_offset_incr and the right boundary row increment hr_offset_incr are constant parameters for this frame and are only recalculated when updating the four vertex coordinates between frames. These are two completely independent sets of row-level offset increments. The horizontal offset step size for each row on the left and right diagonals is calculated separately and is independent of each other. This allows for independent adjustment of the horizontal tilt amplitude on one side of the image, unconstrained by changes in the other boundary. The calculation formulas for the left boundary row increment hl_offset_incr and the right boundary row increment hr_offset_incr are as follows:

[0019] Based on the coordinates of the four vertices of the trapezoidal correction, the left boundary horizontal offset value hl_offset_next and the right boundary horizontal offset value hr_offset_next are calculated for use in the next iteration. The iterative calculation is as follows:

[0020] In the formula, hl_offset and hr_offset are the left and right horizontal offset values ​​used in the current row iteration, respectively; hl_offset_next and hr_offset_next are the left and right horizontal offset values ​​calculated in this iteration for use in the next row iteration, respectively; the initial value of hl_offset is the horizontal coordinate of the top left corner vertex, and the initial value of hr_offset is the horizontal coordinate of the top right corner vertex, which serve as the starting reference for the row-by-row iteration calculation in this frame; Based on the left boundary horizontal offset value hl_offset_next and the right boundary horizontal offset value hr_offset_next obtained in this iteration, calculate the effective horizontal span of the next row. :

[0021] Based on the aforementioned effective horizontal span, calculate the horizontal scaling factor for the next row. :

[0022] Based on the horizontal scaling factor Calculate the original column address corresponding to the next row of pixels to achieve adaptive horizontal linear trapezoidal correction within a single row.

[0023] The step of calculating the original image row address ram_choose based on the set row-by-row iteration variable y, combined with the real-time vertical scaling factor v_scale and the upper boundary vertical offset value vt_offset, includes: The initial value of the upper boundary vertical offset value vt_offset is taken as the vertical coordinate of the top-left corner vertex, and the initial value of the lower boundary vertical offset value vb_offset is taken as the vertical coordinate of the bottom-left corner vertex. This initial value serves as the starting reference for the column-by-column iterative operation of this frame. During the row blanking period before the column-by-column correction of each row begins, the upper boundary vertical offset value vt_offset and the lower boundary vertical offset value vb_offset are restored to the initial reference value of this row. When the ping-pong row buffer unit read enable is valid, the calculation of the original image row address ram_choose is triggered. The calculation formula for the original image row address ram_choose is as follows:

[0024] The original image row address ram_choose has a value range of 1 to m; when the address overflows, the selected pixel value is set to 0.

[0025] The process involves correcting vertical trapezoidal distortion based on the vertically adjacent pixel sources, simultaneously performing horizontal upsampling to compensate for the horizontal pixels discarded by the overall horizontal compression scaling factor reduce_fac in stage S2, restoring the original image resolution, and outputting the final corrected pixels, including: The upper boundary column increment vt_offset_incr and the lower boundary column increment vb_offset_incr are calculated based on the coordinates of the four vertices of the trapezoid. The formulas for calculating the upper boundary column increment vt_offset_incr and the lower boundary column increment vb_offset_incr are as follows:

[0026]

[0027] The upper boundary column increment vt_offset_incr and the lower boundary column increment vb_offset_incr are constant parameters for this frame and are only recalculated when updating the four vertices between frames. They are two completely independent sets of column-level offset increments. The vertical offset step of each column on the upper and lower diagonal sides is calculated separately and is not linked to each other. The vertical tilt of one side of the screen can be adjusted independently without being constrained by the change of the other side boundary. For each column of pixels output, the pre-calculated overall horizontal compression scaling factor reduce_fac is substituted into the data to iteratively calculate and update the upper boundary vertical offset value vt_offset_next and the lower boundary vertical offset value vb_offset_next. The calculation formula for iteratively calculating and updating the upper boundary vertical offset value vt_offset_next and the lower boundary vertical offset value vb_offset_next is as follows:

[0028] In the formula, vt_offset and vb_offset are the upper boundary vertical offset values ​​and lower boundary vertical offset values ​​used in the current column iteration, respectively; vt_offset_next and vb_offset_next are the upper boundary vertical offset values ​​and lower boundary vertical offset values ​​calculated in this iteration for use in the next column iteration, respectively. Based on the calculated upper boundary vertical offset value, lower boundary vertical offset value vt_offset_next, and vb_offset_next for use in the next column iteration, calculate the corresponding vertical effective span of the next column. The vertical effective span The calculation formula is:

[0029] Based on the aforementioned effective vertical span The vertical scaling factor v_scale of the next column is dynamically refreshed to achieve adaptive vertical trapezoidal correction column by column within a single row; the calculation formula for the vertical scaling factor v_scale is: ; Vertical linear interpolation is performed using the decimal places of the original pixel row address as interpolation weights; horizontal upsampling is performed synchronously in the pipeline to restore the original image resolution and output the final corrected pixels.

[0030] The projection trapezoid correction method further includes: The image processing chip logically divides the storage resources available for image caching in the chip's built-in on-chip memory into two independent rows of storage units, building a ping-pong segmented row cache architecture, without using external memory to store images throughout the process; The read / write timing is controlled by counting the number of cached rows, following the normal working logic of ping-pong cache. When one group of storage units is full, pixel read operations of that group of storage units are performed in parallel, and new pixel writes are performed in another group of storage units. The two groups of storage units switch alternately, and free storage areas can be overwritten. When a group of storage units is in the pixel writing state, and interpolation operations require multiple rows of adjacent pixels, backtracking reads can be performed on the historical rows that have been written in the group of storage units that are currently being written. A single group of storage units can simultaneously realize the reading of the tail of historical rows and the writing of the head of new rows. Half of the maximum total number of cached rows is used as the read / write isolation interval to isolate the row being written from the historical rows being read backtracking.

[0031] The present invention also provides a projection device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described projection keystone correction method.

[0032] This invention first performs pixel format conversion on the original image, and then statically configures the number of pixels K to be stored in single-address packing based on the chip's timing margin. After format conversion and pixel packing, the original image of a single row is first stored in the intermediate cache storage unit of the chip's built-in on-chip memory. The coordinates of the four vertices of the trapezoid are obtained, and the vertical offset row number of the image corresponding to each vertex is calculated. Then, a multi-level distortion judgment threshold T is configured according to the level coefficient, and the distortion judgment threshold T is compared with the vertical offset row number of the image at each vertex to match the corresponding level. The effective pixel length of the single row after horizontal extraction is calculated as reduce_n, and the overall horizontal compression scaling factor reduce_fac is calculated based on the total number of horizontal pixel columns n of the original image. Then, the initial horizontal scaling factor h_scale and vertical scaling factor v_scale of a single frame are calculated based on the coordinates of the four vertices of the trapezoid, the total number of horizontal pixel columns n and the total number of vertical pixel rows m of the original image. Then, the column address ram_addr of the original image is calculated based on the set independent column iteration variable x, combined with the real-time horizontal scaling factor h_scale, the overall horizontal compression scaling factor reduce_fac, and the horizontal offset value hl_offset of the left boundary. Finally, the column address ram_addr of the original image is calculated based on the column address of the original image. The process involves reading uncompressed raw pixels from the intermediate cache storage unit, performing boundary checks and filtering adjacent pixels to obtain the neighboring pixel data source required for horizontal linear interpolation. Then, based on the neighboring pixel data source, it performs full-resolution horizontal linear keystone correction within a single row. According to the currently determined storage mode, it selects the matching level to perform horizontal pixel extraction and compression, writing the extracted pixels into the on-chip ping-pong row cache unit. Next, based on the set row-by-row iteration variable y, combined with the real-time vertical scaling factor v_scale and the upper boundary vertical offset value vt_offset, it calculates the original image row address ram_choose. Then, based on the original image row address, it reads the pixel data from the on-chip ping-pong row cache unit that has undergone horizontal linear keystone correction and compression by the overall horizontal compression scaling factor reduce_fac. It performs boundary checks and filters adjacent pixels to obtain the neighboring pixel data source required for vertical linear interpolation. Finally, based on the vertical neighboring pixel source, it performs vertical keystone distortion correction, simultaneously performs horizontal upsampling to compensate for the horizontal pixels discarded by the overall horizontal compression scaling factor reduce_fac in stage S2, restores the original image resolution, and outputs the final corrected pixels. Because it adopts a segmented pipeline trapezoidal correction algorithm that performs iterative horizontal correction row by row and iterative vertical correction column by column, it does not require caching complete frame image data. It can adapt to the trapezoidal correction pipeline image processing using only a segmented row cache architecture, which greatly saves on-chip memory resources of the image processing chip. It occupies little storage space and can use a medium- or small-capacity image processing chip to implement all correction functions, effectively reducing hardware selection costs.

[0033] Furthermore, it adopts an iterative correction mode with completely independent four boundaries. The distortion correction operations of the four oblique sides are uncoupled and independent of each other. There are no mandatory constraints of centerline symmetry and global uniform scaling. The tilt amplitude of any single oblique side can be adjusted independently. It can correct severely skewed single-sided and arbitrarily asymmetrical trapezoidal projection images with high precision. The geometric correction adaptation range is wider and the correction accuracy is higher. Attached Figure Description

[0034] The present invention will now be described in detail with reference to the embodiments and accompanying drawings, wherein: Figure 1 This is a flowchart of the projection trapezoid correction method of the present invention. Detailed Implementation

[0035] The specific embodiments of the present invention are further described below with reference to the accompanying drawings: The core purpose of digital keystone correction is to output a pre-distortion image that complements the projected trapezoidal distortion, thereby offsetting the image distortion caused by the projector's tilt and resulting in a standard rectangular image. Determining the coordinates of the four vertices of the distorted trapezoid to be compensated determines the trapezoidal shape of the generated pre-distortion image. There are two ways to obtain the coordinates of the four vertices: the first is automatic acquisition, which uses a TOF sensor to collect the projected image distortion information and outputs the four vertex coordinates to the image processing chip, enabling automatic keystone correction; the second is manual configuration, where the user outputs the four vertex coordinates to the image processing chip via a remote control, enabling manual keystone correction. The only difference between automatic and manual keystone correction is the method of acquiring the distortion vertex information; the image correction algorithm within the image processing chip is completely identical. Only the coordinates of the four vertices of the distorted trapezoid are needed to generate a complementary pre-distortion image to compensate for the projected distortion.

[0036] Please see Figure 1 The projection trapezoid correction method of the present invention includes: S1: Perform pixel format conversion on the original image, supporting two statically fixed formats: RGB666 and RGB888, which cannot be changed during the calibration process; combine the chip timing margin with the static configuration of the number of pixels K stored per address, where a single storage address can store 1, 2, 4, or 8 pixels. After format conversion and pixel packing, the single row of the original image is first stored in the intermediate cache storage unit of the chip's built-in on-chip memory; obtain the coordinates of the four vertices of the trapezoid, and calculate the vertical offset row number of the image corresponding to each vertex. The coordinates of the four vertices of the trapezoid include the coordinates of the top left vertex (...). The coordinates of the top right vertex are ( The coordinates of the lower left vertex are ( The coordinates of the lower right vertex are ( ).

[0037] After the image processing chip acquires the coordinates of the four vertices of the trapezoid and the input original image, it first calculates the number of vertical adjustment offset rows for each vertex by combining the storage capacity of the chip's built-in on-chip memory, the resolution of the input image, and the coordinate parameters of the four vertices of the trapezoid.

[0038] A multi-level distortion judgment threshold T is configured, with the reference number of rows being the maximum total number of original image rows that the chip's built-in on-chip memory can cache. The distortion judgment threshold, the reference number of rows, and the level coefficient satisfy the following relationship:

[0039] The gear ratios are configured as follows: 0.5, 0.75, 1, 1.25, 1.5, 1.75, and 2.

[0040] S2: Configure a multi-level distortion judgment threshold T according to the gear coefficient, and compare the distortion judgment threshold T with the number of vertical offset rows of each vertex to match the corresponding gear, calculate the effective pixel length of a single row after horizontal extraction reduce_n, and calculate the overall horizontal compression scaling factor reduce_fac of the image by combining the total number of horizontal pixel columns n of the original image.

[0041] The calculated number of vertical offset rows of the vertices is compared with the distortion judgment thresholds T at each level. The corresponding level is matched and the effective pixel length of a single row after horizontal extraction is output as reduce_n. Combined with the total number of horizontal pixel columns n of the original image, the overall horizontal compression scaling factor reduce_fac of the image is calculated. The calculation formula is as follows:

[0042] The overall horizontal scaling factor of the image participates in horizontal addressing and vertical boundary iteration calculations throughout the entire process, uniformly adapting to the size of the extracted and compressed image. Based on the overall horizontal compression scaling factor obtained from multi-level threshold matching, multiple adaptive storage modes are divided: when the number of vertical offset rows of all vertices matches the low-level threshold, the conventional storage mode is adopted, fully preserving all horizontal column pixels of the image, without performing horizontal pixel extraction, and a single physical storage row of the chip's built-in on-chip memory stores only one complete image pixel; when the number of vertical offset rows of any vertex matches the high-level threshold, horizontal pixel interval extraction and compression are performed at the corresponding multiplier, reducing the effective horizontal pixel storage amount per row. Under the premise that the physical storage depth remains unchanged, multiple rows of image pixels can be stored in the same physical storage row space, finely balancing the storage load of the on-chip memory and the output image quality.

[0043] S3: Calculate the initial horizontal scaling factor h_scale and vertical scaling factor v_scale of a single frame based on the coordinates of the four vertices of the trapezoid, the total number of horizontal pixel columns n and the total number of vertical pixel rows m of the original image.

[0044] The top-left and top-right vertices define the upper horizontal boundary, and the top-left and bottom-left vertices define the left vertical boundary. The bottom-right vertex participates in the subsequent iterative calculations of row-level horizontal offset increments and column-level vertical offset increments. An independent iterative correction model with completely decoupled left, right, top, and bottom hypotenuses is adopted, with dedicated offset increments configured for each of the four sides. The deformation update logic of the left and right horizontal boundaries and the top and bottom vertical boundaries are not bound to each other. There are no mandatory constraints such as centerline symmetry or global uniform scaling, and the tilt rate of any single hypotenuse can be independently adjusted to adapt to various omnidirectional asymmetric trapezoidal distortions.

[0045] Simultaneously, the initial horizontal scaling factor h_scale and the initial vertical scaling factor v_scale are calculated to adapt to the segmented caching architecture. This initial scaling factor is only used as the correction benchmark for the first row and the first column, and the scaling factor will be refreshed in the subsequent row and column calculation process.

[0046] The horizontal scaling factor h_scale and the vertical scaling factor v_scale satisfy the following relationship:

[0047] in, - +1 represents the total number of columns of valid pixels at the top horizontal boundary of the image; - +1 represents the total number of rows of valid pixels on the left vertical boundary of the image, and n and m represent the total number of horizontal pixel columns and the total number of vertical pixel rows of the original image, respectively.

[0048] S4: Based on the set independent column iteration variable x, which is distinct from the x-coordinates of the four vertices; combine the real-time horizontal scaling factor h_scale, the overall horizontal compression scaling factor reduce_fac, and the left boundary horizontal offset value hl_offset to calculate the original image column address ram_addr.

[0049] The original image column address ram_addr satisfies the following relationship:

[0050] During the horizontal correction addressing phase, when the read enable is valid, an independent column iteration variable x is used, and the value range of the original image column address is 1 to n; when the address overflows, the selected pixel value is set to 0; when the read enable is invalid, the column iteration variable x is reset to 1.

[0051] S5: Read the uncompressed original pixels in the intermediate cache storage unit according to the column address of the original image, complete the boundary verification and filter the left and right adjacent pixels, and obtain the neighboring pixel data source required for horizontal linear interpolation.

[0052] S6: Based on the neighboring pixel data source, complete the full-resolution horizontal linear trapezoidal correction within a single row, and write the corrected pixels into the on-chip ping-pong row cache unit after horizontal extraction and compression.

[0053] The horizontal linear interpolation calculation is performed using the fractional part of the original image column address as the interpolation weight to generate horizontally corrected pixels. The matching level is selected according to the current storage mode to perform horizontal pixel extraction and compression, and the extracted pixels are written to the on-chip ping-pong row cache unit.

[0054] The single-row pixel traversal adopts a packing step addressing rule. After completing K pixel interpolation processing, the column iteration variable x increments by K to adapt to the hardware multi-pixel packing addressing timing. This stepping operation is a pixel-level single iteration. Within the processing cycle of a single row of effective pixels, the row-level parameters remain constant and the left and right boundary offsets of the trapezoid are not updated. Only when switching the corresponding image blanking period of adjacent effective rows, the horizontal offset values ​​of the left and right boundaries are updated iteratively first, and then the horizontal effective span and horizontal scaling factor are calculated to prepare the row-level parameters for the next row correction. The left boundary row increment hl_offset_incr and the right boundary row increment hr_offset_incr are constant parameters for this frame and are only recalculated when updating the four vertex coordinates between frames. These are two completely independent sets of row-level offset increments. The horizontal offset step size for each row on the left and right diagonals is calculated separately and is independent of each other. This allows for independent adjustment of the horizontal tilt amplitude on one side of the image, unconstrained by changes in the other boundary. The calculation formulas for the left boundary row increment hl_offset_incr and the right boundary row increment hr_offset_incr are as follows:

[0055] Based on the coordinates of the four vertices of the trapezoidal correction, the left boundary horizontal offset value hl_offset_next and the right boundary horizontal offset value hr_offset_next are calculated for use in the next iteration. The iterative calculation is as follows:

[0056] In the formula, hl_offset and hr_offset are the left and right horizontal offset values ​​used in the current row iteration, respectively; hl_offset_next and hr_offset_next are the left and right horizontal offset values ​​calculated in this iteration for use in the next row iteration, respectively; the initial value of hl_offset is the horizontal coordinate of the top left corner vertex, and the initial value of hr_offset is the horizontal coordinate of the top right corner vertex, which serve as the starting reference for the row-by-row iteration operation in this frame.

[0057] Based on the left boundary horizontal offset value hl_offset_next and the right boundary horizontal offset value hr_offset_next obtained in this iteration, calculate the effective horizontal span of the next row. :

[0058] Based on the aforementioned effective horizontal span, calculate the horizontal scaling factor for the next row. :

[0059] Based on the horizontal scaling factor Calculate the original column address corresponding to the next row of pixels to achieve adaptive horizontal linear trapezoidal correction within a single row.

[0060] The image processing chip logically divides the storage resources in the chip's built-in on-chip memory that can be used for image caching into two independent rows of storage units, building a ping-pong segmented row cache architecture, without using external memory to store images throughout the process.

[0061] The system relies on the number of cached rows to control the read / write timing, following the conventional working logic of ping-pong caching. When one group of storage units is full, pixel readout operations are performed in parallel for that group of storage units, while new pixel writing is performed for the other group of storage units. The two groups of storage units switch alternately, and free storage areas can be overwritten. When a group of storage units is in the pixel writing state and interpolation operations require multiple rows of adjacent pixels, backtracking reads can be performed on the historical rows that have already been written within the group of storage units that are currently being written. A single group of storage units can simultaneously perform the reading of the last historical row and the writing of the first new row. The system uses half of the maximum total number of cached rows as the read / write isolation interval to isolate the row being written from the historical rows being read backtracking, avoiding data corruption caused by simultaneous reading and writing of the same physical row, and ensuring stable storage of horizontally corrected images.

[0062] S7: Based on the set row-by-row iteration variable y, combined with the real-time vertical scaling factor v_scale and the upper boundary vertical offset value vt_offset, calculate the original image row address ram_choose.

[0063] The initial value of the upper boundary vertical offset value vt_offset is taken as the vertical coordinate of the top-left corner vertex, and the initial value of the lower boundary vertical offset value vb_offset is taken as the vertical coordinate of the bottom-left corner vertex. This initial value serves as the starting reference for the column-by-column iterative operation of this frame. During the row blanking period before the column-by-column correction of each row begins, the upper boundary vertical offset value vt_offset and the lower boundary vertical offset value vb_offset are restored to the initial reference value of this row. When the ping-pong row buffer unit read enable is valid, the calculation of the original image row address ram_choose is triggered. The calculation formula for the original image row address ram_choose is as follows:

[0064] The original image row address ram_choose has a value range of 1 to m; when the address overflows, the selected pixel value is set to 0.

[0065] S8: Read the pixel data that has been horizontally linearly corrected and compressed by the overall horizontal compression scaling factor reduce_fac in the on-chip ping-pong row cache unit according to the original image row address, complete the boundary verification and filter the adjacent pixels above and below, and obtain the neighboring pixel data source required for vertical linear interpolation.

[0066] The system reads horizontally corrected and horizontally extracted and compressed pixels from the cache based on the calculated original image row address, and filters adjacent pixels by combining boundary conditions and historical row backtracking rules, and extracts the neighboring pixels required for vertical linear interpolation.

[0067] S9: Based on the vertically adjacent pixel sources, complete the vertical trapezoidal distortion correction, simultaneously perform horizontal upsampling, compensate for the horizontal pixels that were extracted and discarded by the overall horizontal compression scaling factor reduce_fac in stage S2, restore the original image resolution, and output the final corrected pixels.

[0068] The system uses extracted vertically neighboring pixels as the data source and combines the decimal places of the original image row address as interpolation weights to complete vertical linear interpolation, outputting the final corrected pixels. This interpolation operation simultaneously performs two functions: first, it corrects vertical trapezoidal distortion in the image; second, it performs horizontal upsampling on the previously discarded horizontally extracted column pixels to restore the original complete horizontal resolution of the image before outputting it. Within a single row output cycle, the iteration variable y remains constant. The image is output column by column from left to right. Each time a column of pixels is output, the upper and lower boundary vertical offset values ​​are iteratively updated to adapt to the differences in vertical trapezoidal distortion between different columns within a single row. During the blanking period of each row, the vertical iteration parameters are restored to the initial vertical offset value of the current row, and the column-by-column iterative operation for the next row begins. The upper boundary column increment vt_offset_incr and the lower boundary column increment vb_offset_incr are constant parameters for this frame and are only recalculated when updating vertices between frames. Because the image is horizontally extracted and compressed, the overall horizontal compression scaling factor reduce_fac needs to be introduced for size matching when iterating the vertical boundary offset. Similarly, the two are two completely independent sets of column-level offset increments. The vertical offset step size of each column on the upper and lower diagonal sides is calculated separately and is not linked to each other. The vertical tilt amplitude on one side of the image can be adjusted independently without being constrained by the change of the other side boundary.

[0069] The formulas for calculating the upper boundary column increment vt_offset_incr and the lower boundary column increment vb_offset_incr are as follows:

[0070] When an image frame is output, the initial offset is loaded based on the coordinates of the four vertices of the trapezoidal correction: the initial value of the upper boundary vertical offset value vt_offset is the vertical coordinate of the upper left vertex, and the initial value of vb_offset is the vertical coordinate of the lower left vertex, which serves as the starting reference for the column-by-column iterative calculation of this frame.

[0071] For each column of pixels output, the pre-calculated overall horizontal compression scaling factor reduce_fac is substituted into the data to iteratively calculate and update the upper boundary vertical offset value vt_offset_next and the lower boundary vertical offset value vb_offset_next. The calculation formula for iteratively calculating and updating the upper boundary vertical offset value vt_offset_next and the lower boundary vertical offset value vb_offset_next is as follows:

[0072] In the formula, vt_offset and vb_offset are the upper and lower boundary vertical offset values ​​used in the current column iteration, respectively; vt_offset_next and vb_offset_next are the upper and lower boundary vertical offset values ​​calculated in this iteration for use in the next column iteration, respectively. reduce_fac is the pre-calculated overall horizontal compression scaling factor of the image.

[0073] Based on the upper boundary vertical offset value vt_offset_next and the lower boundary vertical offset value vb_offset_next obtained in this iteration, calculate the corresponding vertical effective span of the next column. ;

[0074] Based on this effective vertical span The vertical scaling factor v_scale of the next column is dynamically refreshed, and the original row address corresponding to the next column of pixels is calculated to achieve column-by-column adaptive vertical correction within a single row. The formula for calculating the vertical scaling factor v_scale is as follows: ; Vertical linear interpolation is performed using the decimal places of the original pixel row address as interpolation weights; horizontal upsampling is performed synchronously in the pipeline to restore the original image resolution and output the final corrected pixels.

[0075] After all pixels in a row have been output, the row iteration variable y is incremented by 1, and the next row correction process begins. Once a complete frame of image has been output, the system stops all parameter iteration calculations and resets the vertical scaling factor. Simultaneously, the ping-pong row buffer unit's buffer row count is reset to 1, and the row and column iteration variables x and y are reset to 1, eliminating inter-frame parameter crosstalk and ensuring accurate initial correction parameters for the next frame. When processing the next frame, the initial offset references in the horizontal and vertical directions are loaded uniformly based on the coordinates of the four vertices of the trapezoidal correction.

[0076] The entire correction process uses four completely independent offset increments for time-division iterative updates (left / right, top / bottom). The deformation parameters of the four hypotenuses are decoupled throughout the process, eliminating the boundary linkage constraints caused by global uniform scaling and centerline symmetry. This allows for pixel-by-pixel high-precision coordinate mapping correction of any omnidirectional asymmetrical trapezoidal or severely distorted image on one side. Simultaneously, the iterative calculation of the four sides natively couples the overall horizontal compression scaling factor reduce_fac of the image, which is deeply integrated with the hardware architecture of adaptive on-chip memory extraction and compression, ping-pong segmented caching, and multi-pixel parallel packaging. This balances correction accuracy with optimization of the chip's built-in on-chip memory resource overhead.

[0077] The projection device of the present invention includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described projection keystone correction method.

[0078] This invention has the following characteristics: 1. This invention addresses the iterative computation characteristics of segmented pipelined trapezoidal correction algorithms by fully reusing the image processing chip's native on-chip memory resources for image data caching, eliminating the need for configuring or accessing external memory throughout the process. Combining row-by-row and column-by-column iterative correction logic, it abandons the traditional full-frame caching mechanism and adopts segmented row caching to adapt to the trapezoidal correction pipeline. A ping-pong caching architecture is constructed using two independent row storage units, adapting to the parallel read / write requirements of trapezoidal correction interpolation, achieving uninterrupted pipelined processing, and the number of rows read / written in a single operation does not need to strictly match a fixed specification. Furthermore, after completing two levels of trapezoidal correction interpolation, this invention eliminates the need for a dedicated output buffer; the corrected image can be directly output via cross-clock domain data synchronization, significantly reducing the output latency of trapezoidal correction and improving image real-time performance.

[0079] 2. To address the issues of high pixel throughput and tight hardware timing in high-resolution images, this invention combines the maximum operating clock speed and timing margin of different image processing chips, and statically configures a multi-pixel packing scheme. A single memory address can store 1, 2, 4, or 8 pixels, supporting parallel read / write and parallel interpolation operations. Under the same pixel throughput requirements, it reduces the pipeline operating clock frequency, widens the system timing margin, and significantly improves the timing convergence capability under high-resolution images.

[0080] 3. This invention can statically select RGB666 and RGB888 pixel storage formats based on the output image resolution and the total on-chip storage capacity of the image processing chip, flexibly adjusting the basic storage overhead per row. This invention introduces a multi-level distortion judgment threshold T, which satisfies: T = maximum total number of rows of the original image that the on-chip memory can hold * level coefficient, with level coefficients configured sequentially as 0.5, 0.75, 1, 1.25, 1.5, 1.75, and 2. By matching the corresponding threshold level with the vertical offset of the four vertices, the single-row pixel length reduce_n after horizontal extraction and the overall horizontal compression scaling factor reduce_fac are calculated, adaptively switching between multiple levels of horizontal extraction compression modes. 3.1 Low distortion level: When the number of vertical offset rows of all vertices matches the low level threshold, it enters the normal storage mode, fully retains all horizontal pixels of each row, does not perform horizontal pixel extraction and compression, and stores only one complete image pixel in a single physical storage row of the on-chip memory.

[0081] 3.2 High Distortion Level: When the number of vertical offset rows of any vertex matches the high-level threshold, perform horizontal pixel interval extraction and compression at the corresponding multiplier to reduce the storage length of effective pixels in a single row; under the hardware constraint of fixed physical storage depth, the same physical storage space can carry multiple rows of image pixels, finely balancing the peak load of on-chip storage and output image quality.

[0082] During the vertical interpolation output stage, horizontal upsampling interpolation is performed simultaneously to compensate for the pixel data discarded in the previous horizontal extraction, thus fully restoring the original horizontal resolution of the image.

[0083] 4. This invention constructs a completely decoupled independent iterative correction model based on the coordinates of the four vertices of the projected image, generating four completely independent offset step sizes: left boundary row increment hl_offset_incr, right boundary row increment hr_offset_incr, upper boundary column increment vt_offset_incr, and lower boundary column increment vb_offset_incr. These four increments are calculated and updated only between frames, remaining constant during single-frame image correction. The left and right boundary and upper and lower boundary offsets are iteratively updated during row switching and column output. The deformation calculation logic for the four hypotenuses is completely decoupled, eliminating the mandatory constraints of centerline symmetry and globally uniform scaling. This allows for individual adjustment of the tilt amplitude on any single side of the image, adapting to various single-sided tilts and omnidirectional asymmetric trapezoidal distortions, achieving pixel-by-pixel precise geometric mapping correction.

[0084] The present invention has the following advantages: 1. This invention adopts a segmented pipeline trapezoidal correction algorithm with row-by-row iterative horizontal correction and column-by-column iterative vertical correction. All corrected image data is stored using the on-chip memory built into the image processing chip, completely eliminating the need for external memory (such as DRAM, SRAM, etc.) for real-time image caching during trapezoidal correction. On the one hand, this directly reduces the overall material cost, and on the other hand, it significantly reduces cross-chip image data interaction, completely eliminating the defects of image latency and excessive bus bandwidth overhead caused by external storage read and write.

[0085] 2. The trapezoidal correction method of the present invention does not require caching of complete frame image data. It only adopts a segmented line cache architecture to adapt to the trapezoidal correction pipeline image processing, which greatly saves the on-chip memory resources of the image processing chip. Small and medium capacity image processing chips can be selected to implement all correction functions, effectively reducing hardware selection costs. At the same time, it eliminates the waiting time of whole frame caching and significantly improves the utilization rate of on-chip storage resources.

[0086] 3. This invention uses the number of vertical offset rows corresponding to trapezoidal distortion to determine a threshold, and adaptively performs horizontal pixel extraction and compression on the image. With a fixed on-chip memory physical storage space, it can cache more image row data, eliminating the need for a large-capacity image processing chip or additional external storage hardware. The caching requirements for large vertically tilted images can be met using only small-to-medium capacity on-chip memory resources. During the correction output stage, the original horizontal resolution of the image is restored through horizontal upsampling without modifying existing hardware and firmware, thus expanding the trapezoidal distortion correction range that the device can handle at a lower hardware cost.

[0087] 4. This invention adopts a four-boundary completely independent iterative correction mode. The distortion correction operations of the four hypotenuses are uncoupled and independent of each other. There are no mandatory constraints of centerline symmetry and global uniform scaling. The tilt amplitude of any single hypotenuse can be adjusted independently. It can correct severely skewed images on one side and any asymmetrical trapezoidal projection images with high precision. The geometric correction has a wider range of adaptability and higher correction accuracy.

[0088] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for correcting projection trapezoidal distortion, characterized in that... include: S1: Perform pixel format conversion on the original image, combine the chip timing margin with static configuration of the number of pixels K stored in single address packing, and after completing the format conversion and pixel packing, store the single row of original image into the intermediate cache storage unit of the chip's built-in on-chip memory. Obtain the coordinates of the four vertices of the trapezoid and calculate the vertical offset row number of the image corresponding to each vertex; the coordinates of the four vertices of the trapezoid include the coordinates of the top left vertex (...). The coordinates of the top right vertex are ( The coordinates of the lower left vertex are ( The coordinates of the lower right vertex are ( ); S2: Configure a multi-level distortion judgment threshold T according to the gear coefficient, and compare the distortion judgment threshold T with the number of vertical offset rows of each vertex to match the corresponding gear, calculate the effective pixel length of a single row after horizontal extraction reduce_n, and calculate the overall horizontal compression scaling factor reduce_fac of the screen by combining the total number of horizontal pixel columns n of the original image. S3: Calculate the initial horizontal scaling factor h_scale and vertical scaling factor v_scale of a single frame based on the coordinates of the four vertices of the trapezoid, the total number of horizontal pixel columns n and the total number of vertical pixel rows m of the original image; S4: Calculate the original image column address ram_addr based on the set independent column iteration variable x, combined with the real-time horizontal scaling factor h_scale, the overall horizontal compression scaling factor reduce_fac, and the left boundary horizontal offset value hl_offset; S5: Read the uncompressed original pixels in the intermediate cache storage unit according to the original image column address, complete the boundary verification and filter the left and right adjacent pixels, and obtain the neighboring pixel data source required for horizontal linear interpolation; S6: Based on the neighboring pixel data source, complete the full-resolution horizontal linear trapezoidal correction within a single row, and write the corrected pixels into the on-chip ping-pong row buffer unit after horizontal extraction and compression. S7: Based on the set row-by-row iteration variable y, combined with the real-time vertical scaling factor v_scale and the upper boundary vertical offset value vt_offset, calculate the original image row address ram_choose; S8: Read the pixel data that has been horizontally linearly corrected and compressed by the overall horizontal compression scaling factor reduce_fac in the on-chip ping-pong row cache unit according to the original image row address, complete the boundary verification and filter the adjacent pixels above and below, and obtain the neighboring pixel data source required for vertical linear interpolation. S9: Based on the vertically adjacent pixel sources, complete the vertical trapezoidal distortion correction, simultaneously perform horizontal upsampling, compensate for the horizontal pixels that were extracted and discarded by the overall horizontal compression scaling factor reduce_fac in stage S2, restore the original image resolution, and output the final corrected pixels.

2. The projection trapezoid correction method according to claim 1, characterized in that: The distortion determination threshold T satisfies the following relationship: ; The base number of rows is the maximum total number of original image rows that the chip's built-in on-chip memory can cache, and the level coefficients are configured as 0.5, 0.75, 1, 1.25, 1.5, 1.75, and 2, respectively.

3. The projection trapezoid correction method according to claim 2, characterized in that: The overall horizontal compression scaling factor reduce_fac of the image satisfies the following relationship: ; The overall horizontal scaling factor of the image participates in the horizontal addressing and vertical boundary iteration calculations throughout the process, uniformly adapting to the size of the extracted and compressed image. Based on the overall horizontal compression scaling factor reduce_fac obtained by matching the multi-level distortion judgment threshold T, multiple adaptive storage modes are divided: when the number of vertical offset rows of all vertices matches the low-level distortion judgment threshold, the conventional storage mode is adopted, and all horizontal column pixels of the image are completely preserved. Horizontal pixel extraction is not performed, and a single physical storage row of the chip's built-in on-chip memory stores only one row of complete image pixels; when the number of vertical offset rows of any vertex matches the high-level distortion judgment threshold, horizontal pixel interval extraction and compression with the corresponding magnification is performed, reducing the storage amount of effective horizontal pixels in a single row.

4. The projection trapezoid correction method according to claim 3, characterized in that: The calculation of the initial horizontal scaling factor h_scale and vertical scaling factor v_scale of a single frame based on the coordinates of the four vertices of the trapezoid, the total number of horizontal pixel columns n and the total number of vertical pixel rows m of the original image includes: The upper horizontal boundary is defined by the upper left and upper right vertices, and the left vertical boundary is defined by the upper left and lower left vertices; the lower right vertex participates in the subsequent iterative calculation of row-level horizontal offset increment and column-level vertical offset increment. The horizontal scaling factor h_scale and the vertical scaling factor v_scale satisfy the following relationship: in, This represents the total number of columns of valid pixels at the top horizontal boundary of the image. denoted as the total number of rows of valid pixels on the left vertical boundary of the image, where n and m represent the total number of horizontal pixel columns and the total number of vertical pixel rows in the original image, respectively.

5. The projection trapezoid correction method according to claim 4, characterized in that: The original image column address ram_addr satisfies the following relationship: During the horizontal correction addressing phase, when the read enable is valid, an independent column iteration variable x is used, and the value range of the original image column address is 1 to n; when the address overflows, the selected pixel value is set to 0; when the read enable is invalid, the column iteration variable x is reset to 1.

6. The projection trapezoid correction method according to claim 5, characterized in that: The step of performing full-resolution horizontal linear trapezoidal correction within a single row based on the neighboring pixel data source, and writing the corrected pixels into the on-chip ping-pong row buffer unit after horizontal extraction and compression, includes: The horizontal linear interpolation calculation is performed using the fractional part of the original image column address as the interpolation weight to generate horizontally corrected pixels; the matching level is selected according to the current storage mode to perform horizontal pixel extraction and compression, and the extracted pixels are written to the on-chip ping-pong row cache unit. The single-row pixel traversal adopts a packing step addressing rule. After completing K pixel interpolation processing, the column iteration variable x increments by K to adapt to the hardware multi-pixel packing addressing timing. This stepping operation is a pixel-level single iteration. Within the processing cycle of a single row of effective pixels, the row-level parameters remain constant and the left and right boundary offsets of the trapezoid are not updated. Only when switching the corresponding image blanking period of adjacent effective rows, the horizontal offset values ​​of the left and right boundaries are updated iteratively first, and then the horizontal effective span and horizontal scaling factor are calculated to prepare the row-level parameters for the next row correction. The left boundary row increment hl_offset_incr and the right boundary row increment hr_offset_incr are constant parameters for this frame and are only recalculated when updating the four vertex coordinates between frames. These are two completely independent sets of row-level offset increments. The horizontal offset step size for each row on the left and right diagonals is calculated separately and is independent of each other. This allows for independent adjustment of the horizontal tilt amplitude on one side of the image, unconstrained by changes in the other boundary. The calculation formulas for the left boundary row increment hl_offset_incr and the right boundary row increment hr_offset_incr are as follows: Based on the coordinates of the four vertices of the trapezoidal correction, the left boundary horizontal offset value hl_offset_next and the right boundary horizontal offset value hr_offset_next are calculated for use in the next iteration. The iterative calculation is as follows: In the formula, hl_offset and hr_offset are the left and right horizontal offset values ​​used in the current row iteration, respectively; hl_offset_next and hr_offset_next are the left and right horizontal offset values ​​calculated in this iteration for use in the next row iteration, respectively; the initial value of hl_offset is the horizontal coordinate of the top left corner vertex, and the initial value of hr_offset is the horizontal coordinate of the top right corner vertex, which serve as the starting reference for the row-by-row iteration calculation in this frame; Based on the left boundary horizontal offset value hl_offset_next and the right boundary horizontal offset value hr_offset_next obtained in this iteration, calculate the effective horizontal span of the next row. : Based on the aforementioned effective horizontal span, calculate the horizontal scaling factor for the next row. : Based on the horizontal scaling factor Calculate the original column address corresponding to the next row of pixels to achieve adaptive horizontal linear trapezoidal correction within a single row.

7. The projection trapezoid correction method according to claim 1, characterized in that: The step of calculating the original image row address ram_choose based on the set row-by-row iteration variable y, combined with the real-time vertical scaling factor v_scale and the upper boundary vertical offset value vt_offset, includes: The initial value of the upper boundary vertical offset value vt_offset is the vertical coordinate of the top-left corner vertex, and the initial value of the lower boundary vertical offset value vb_offset is the vertical coordinate of the bottom-left corner vertex. This initial value serves as the starting reference for the column-by-column iterative calculation of this frame. During the row blanking period before the start of column-by-column correction for each row, the vertical boundary offset values ​​vt_offset and vb_offset are restored to the initial reference values ​​for this row. When the ping-pong row buffer unit read enable is valid, the calculation of the original image row address ram_choose is triggered. The formula for calculating the original image row address ram_choose is as follows: The original image row address ram_choose has a value range of 1 to m; when the address overflows, the selected pixel value is set to 0.

8. The projection trapezoid correction method according to claim 7, characterized in that: The process involves correcting vertical trapezoidal distortion based on the vertically adjacent pixel sources, simultaneously performing horizontal upsampling to compensate for the horizontal pixels discarded by the overall horizontal compression scaling factor reduce_fac in stage S2, restoring the original image resolution, and outputting the final corrected pixels, including: The upper boundary column increment vt_offset_incr and the lower boundary column increment vb_offset_incr are calculated based on the coordinates of the four vertices of the trapezoid. The formulas for calculating the upper boundary column increment vt_offset_incr and the lower boundary column increment vb_offset_incr are as follows: The upper boundary column increment vt_offset_incr and the lower boundary column increment vb_offset_incr are constant parameters for this frame and are only recalculated when updating the four vertices between frames. They are two completely independent sets of column-level offset increments. The vertical offset step of each column on the upper and lower diagonal sides is calculated separately and is not linked to each other. The vertical tilt of one side of the screen can be adjusted independently without being constrained by the change of the other side boundary. For each column of pixels output, the pre-calculated overall horizontal compression scaling factor reduce_fac is substituted into the data to iteratively calculate and update the upper boundary vertical offset value vt_offset_next and the lower boundary vertical offset value vb_offset_next. The calculation formula for iteratively calculating and updating the upper boundary vertical offset value vt_offset_next and the lower boundary vertical offset value vb_offset_next is as follows: In the formula, vt_offset and vb_offset are the upper boundary vertical offset values ​​and lower boundary vertical offset values ​​used in the current column iteration, respectively; vt_offset_next and vb_offset_next are the upper boundary vertical offset values ​​and lower boundary vertical offset values ​​calculated in this iteration for use in the next column iteration, respectively. Based on the calculated upper boundary vertical offset value, lower boundary vertical offset value vt_offset_next, and vb_offset_next for use in the next column iteration, calculate the corresponding vertical effective span of the next column. The vertical effective span The calculation formula is: Based on the aforementioned effective vertical span The vertical scaling factor v_scale of the next column is dynamically refreshed to achieve adaptive vertical trapezoidal correction column by column within a single row; the calculation formula for the vertical scaling factor v_scale is: ; Vertical linear interpolation is performed using the decimal places of the original pixel row address as interpolation weights; horizontal upsampling is performed synchronously in the pipeline to restore the original image resolution and output the final corrected pixels.

9. The projection trapezoid correction method according to claim 1, characterized in that: The projection trapezoid correction method further includes: The image processing chip logically divides the storage resources available for image caching in the chip's built-in on-chip memory into two independent rows of storage units, building a ping-pong segmented row cache architecture, without using external memory to store images throughout the process; The read / write timing is controlled by counting the number of cached rows, following the normal working logic of ping-pong cache. When one group of storage units is full, pixel read operations of that group of storage units are performed in parallel, and new pixel writes are performed in another group of storage units. The two groups of storage units switch alternately, and free storage areas can be overwritten. When a group of storage units is in the pixel writing state, and interpolation operations require multiple rows of adjacent pixels, backtracking reads can be performed on the historical rows that have been written in the group of storage units that are currently being written. A single group of storage units can simultaneously realize the reading of the tail of historical rows and the writing of the head of new rows. Half of the maximum total number of cached rows is used as the read / write isolation interval to isolate the row being written from the historical rows being read backtracking.

10. A projection device, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the projection trapezoid correction method according to any one of claims 1-9.