Search

CN-119831905-B - Image correction method and device

CN119831905BCN 119831905 BCN119831905 BCN 119831905BCN-119831905-B

Abstract

The invention relates to the technical field of image processing and discloses an image correction method and device, wherein the method comprises the steps of obtaining original coordinate data of original pixels belonging to different first categories; the method comprises the steps of determining correction coordinate data of correction pixels corresponding to original pixels, determining second categories of the correction pixels according to classification rules, caching the coordinate data to corresponding first storage spaces according to first categories of the original pixels and the second categories of the corresponding correction pixels, taking the first storage spaces corresponding to the same second categories in all first storage space groups as a group, respectively obtaining all groups of coordinate data to be processed, respectively determining correction pixel values corresponding to all correction pixels, and generating a correction image according to the correction pixel values. The invention utilizes N multiplied by N first storage spaces to realize acceleration of each processing path, effectively avoids the problem of blockage, realizes the acceleration effect close to N times, and can save on-chip storage resources.

Inventors

  • XIE XIBO
  • TAO YONGKANG
  • CHEN QINGLING

Assignees

  • 广东汇天航空航天科技有限公司

Dates

Publication Date
20260508
Application Date
20241219

Claims (9)

  1. 1. An image correction method, applied to a programmable logic device, comprising: acquiring original coordinate data of original pixels belonging to different first categories, wherein the first categories of the original pixels are determined by classifying the original coordinate data of the original pixels according to preset classification rules; Determining correction coordinate data of a correction pixel corresponding to the original pixel after the original pixel is de-distorted according to the original coordinate data of the original pixel, classifying the correction coordinate data of the correction pixel according to the classification rule, and determining a second category to which the correction pixel belongs; According to the first category to which the original pixel belongs and the second category to which the corresponding correction pixel belongs, corresponding coordinate data are cached to corresponding first storage spaces, wherein corresponding first storage space groups are pre-configured for each first category, and each first storage space group comprises first storage spaces corresponding to each second category respectively; taking the first storage spaces corresponding to the same second category in each first storage space group as a group, and respectively acquiring coordinate data to be processed in each group of first storage spaces; respectively determining correction pixel values corresponding to correction pixels according to the coordinate data to be processed of each group, and generating a correction image according to the correction pixel values; the method comprises the steps of obtaining original coordinate data, wherein the original coordinate data comprises a first coordinate and a second coordinate of an original pixel, the correction coordinate data comprises the first coordinate and the second coordinate of a correction pixel, the classification rule is used for classifying the first coordinate into N categories, N is the parallelism not smaller than 2, and the classification rule is that the first coordinate is subjected to residual processing by taking N as a divisor, and different remainders correspond to different categories; the first category of the original pixel is determined by classifying the first coordinate of the original pixel according to the classification rule; The second class to which the correction pixel belongs is determined by classifying the first coordinates of the correction pixel according to the classification rule.
  2. 2. The method of claim 1, wherein the acquiring raw coordinate data for raw pixels belonging to a different first class comprises: with the parallelism degree being N, processing for generating original coordinate data is executed in parallel, and the generating of the original coordinate data includes: Presetting and determining a starting coordinate of a first coordinate and a width of the first coordinate, and a starting coordinate of a second coordinate and a width of the second coordinate; Determining a first count of a first coordinate and a second count of a second coordinate corresponding to the current count under the constraint of the width of the first coordinate and the width of the second coordinate in a current count period, wherein the step of the first count is N, and the step of the second count is 1; determining a first coordinate of the original pixel acquired in the current counting period according to the initial coordinate of the first coordinate and the first count; and determining the second coordinate of the original pixel acquired in the current counting period according to the initial coordinate of the second coordinate and the second counting.
  3. 3. The method according to claim 1, wherein the obtaining the coordinate data to be processed in each group of the first storage spaces with the first storage spaces corresponding to the same second category in each group of the first storage spaces as one group includes: Taking the first storage spaces corresponding to the same second category in each first storage space group as a group, and respectively reading the coordinate data to be processed in each group of first storage spaces; And caching the read coordinate data to be processed into corresponding second storage spaces, wherein the corresponding second storage spaces are preconfigured for each second class.
  4. 4. A method according to claim 3, wherein the reading the coordinate data to be processed in each group of the first storage spaces with the first storage spaces corresponding to the same second category in each group of the first storage spaces as one group includes: Judging whether a non-empty first storage space exists in the first storage spaces corresponding to the same second category in each first storage space group; and under the condition that a non-empty first storage space exists, the coordinate data in the non-empty first storage space are read, and the coordinate data in the non-empty first storage space are used as the coordinate data to be processed.
  5. 5. The method according to any one of claims 1 to 4, further comprising: reading original image data corresponding to an original image to be corrected, wherein the original image data comprises original pixel values and original coordinate data of all original pixels; According to the first category of each original pixel, the original pixel value of the original pixel is respectively cached to a corresponding first memory, wherein the corresponding first memory is preconfigured for each first category; The step of respectively determining the correction pixel values corresponding to the correction pixels according to the coordinate data to be processed of each group comprises the following steps: determining a corresponding first storage address according to the correction coordinate data in the coordinate data to be processed; and acquiring an original pixel value corresponding to the first storage address from a first memory corresponding to the coordinate data to be processed, and taking the original pixel value corresponding to the first storage address as a correction pixel value of a correction pixel in the coordinate data to be processed.
  6. 6. The method of claim 5, wherein generating a corrected image from the corrected pixel values comprises: according to a first category to which an original pixel in the coordinate data to be processed belongs and a second category to which a correction pixel in the coordinate data to be processed belongs, caching the correction pixel value into a corresponding third storage space, wherein a corresponding third storage space group is pre-configured for each second category, and the third storage space group comprises third storage spaces corresponding to each first category respectively; taking the third storage spaces corresponding to the same first category in each third storage space group as a group, and respectively acquiring correction pixel values in each group of third storage spaces; and determining a corresponding second storage address according to the original coordinate data in the coordinate data to be processed, recording a pixel value corresponding to the second storage address as the correction pixel value, and generating a correction image determined based on each correction pixel value.
  7. 7. The method of claim 6, wherein taking the third storage spaces of the same first class in each of the third storage space groups as a group, respectively, obtaining the corrected pixel values in each of the third storage spaces of each group, comprises: taking the third storage spaces corresponding to the same first category in each third storage space group as a group, and respectively reading correction pixel values in each group of third storage spaces; And caching the read correction pixel values to corresponding fourth storage spaces, wherein the corresponding fourth storage spaces are preconfigured for each first class.
  8. 8. The method of claim 6, wherein the recording the pixel value corresponding to the second storage address as the corrected pixel value comprises: Alternately reading the second storage address according to the first buffer area and the second buffer area, and writing the corrected pixel value into the second storage address of the second memory; The second buffer performs a write operation when the first buffer performs a read operation, and the second buffer performs a read operation when the first buffer performs a write operation.
  9. 9. An image correction apparatus for use with a programmable logic device, the apparatus comprising: The coordinate acquisition module is used for acquiring the original coordinate data of the original pixels belonging to different first categories, wherein the first categories of the original pixels are determined by classifying the original coordinate data of the original pixels according to a preset classification rule; the classification module is used for determining correction coordinate data of the correction pixels corresponding to the original pixels after the original pixels are de-distorted according to the original coordinate data of the original pixels, classifying the correction coordinate data of the correction pixels according to the classification rule, and determining a second category to which the correction pixels belong; The system comprises a coordinate caching module, a coordinate data storage module, a correction module and a correction module, wherein the coordinate caching module is used for caching corresponding coordinate data to corresponding first storage spaces according to first categories to which the original pixels belong and corresponding second categories to which the correction pixels belong; The grouping acquisition module is used for taking the first storage spaces corresponding to the same second category in each first storage space group as a group and respectively acquiring the coordinate data to be processed in each group of first storage spaces; The processing module is used for respectively determining correction pixel values corresponding to the correction pixels according to the coordinate data to be processed of each group and generating a correction image according to the correction pixel values; the method comprises the steps of obtaining original coordinate data, wherein the original coordinate data comprises a first coordinate and a second coordinate of an original pixel, the correction coordinate data comprises the first coordinate and the second coordinate of a correction pixel, the classification rule is used for classifying the first coordinate into N categories, N is the parallelism not smaller than 2, and the classification rule is that the first coordinate is subjected to residual processing by taking N as a divisor, and different remainders correspond to different categories; the first category of the original pixel is determined by classifying the first coordinate of the original pixel according to the classification rule; The second class to which the correction pixel belongs is determined by classifying the first coordinates of the correction pixel according to the classification rule.

Description

Image correction method and device Technical Field The invention relates to the technical field of image processing, in particular to an image correction method and an image correction device. Background Image distortion is mainly caused by factors such as camera lens distortion, optical imaging nonideal and the like, so that various deformation and distortion of an image are generated, and the deformation and distortion can influence the accuracy and reliability of the image. The current image de-distortion algorithm is deployed by using an ASIC (Application SPECIFIC INTEGRATED Circuit) chip, and the algorithm development engineering is simpler in this way, but a higher-end chip is required to be selected to achieve a higher processing speed. In general, image de-distortion is only one loop in an image processing project, and in the image processing project based on programmable logic devices such as an FPGA (Field Programmable GATE ARRAY ), if an asic+fpga scheme is used, the high-speed de-distortion algorithm has a high computational power requirement, and the heterogeneous scheme has high scheme complexity and high cost. Disclosure of Invention In view of this, the present invention provides an image correction method and apparatus to solve the problem that more resources are required for removing distortion of a programmable logic device. In a first aspect, the present invention provides an image correction method applied to a programmable logic device, the method comprising: acquiring original coordinate data of original pixels belonging to different first categories, wherein the first categories of the original pixels are determined by classifying the original coordinate data of the original pixels according to preset classification rules; Determining correction coordinate data of a correction pixel corresponding to the original pixel after the original pixel is de-distorted according to the original coordinate data of the original pixel, classifying the correction coordinate data of the correction pixel according to the classification rule, and determining a second category to which the correction pixel belongs; According to the first category to which the original pixel belongs and the second category to which the corresponding correction pixel belongs, corresponding coordinate data are cached to corresponding first storage spaces, wherein corresponding first storage space groups are pre-configured for each first category, and each first storage space group comprises first storage spaces corresponding to each second category respectively; taking the first storage spaces corresponding to the same second category in each first storage space group as a group, and respectively acquiring coordinate data to be processed in each group of first storage spaces; And respectively determining correction pixel values corresponding to the correction pixels according to the coordinate data to be processed of each group, and generating a correction image according to the correction pixel values. In a second aspect, the present invention provides an image correction apparatus applied to a programmable logic device, the apparatus comprising: The coordinate acquisition module is used for acquiring the original coordinate data of the original pixels belonging to different first categories, wherein the first categories of the original pixels are determined by classifying the original coordinate data of the original pixels according to a preset classification rule; the classification module is used for determining correction coordinate data of the correction pixels corresponding to the original pixels after the original pixels are de-distorted according to the original coordinate data of the original pixels, classifying the correction coordinate data of the correction pixels according to the classification rule, and determining a second category to which the correction pixels belong; The system comprises a coordinate caching module, a coordinate data storage module, a correction module and a correction module, wherein the coordinate caching module is used for caching corresponding coordinate data to corresponding first storage spaces according to first categories to which the original pixels belong and corresponding second categories to which the correction pixels belong; The grouping acquisition module is used for taking the first storage spaces corresponding to the same second category in each first storage space group as a group and respectively acquiring the coordinate data to be processed in each group of first storage spaces; And the processing module is used for respectively determining correction pixel values corresponding to the correction pixels according to the coordinate data to be processed of each group and generating a correction image according to the correction pixel values. In a third aspect, the present invention provides a programmable logic device comprising a memory and a processor, the memory and