WO2020057062A1 - Method and apparatus for implementing bilateral image filtering in fpga, and fpga - Google Patents

Method and apparatus for implementing bilateral image filtering in fpga, and fpga Download PDF

Info

Publication number
WO2020057062A1
WO2020057062A1 PCT/CN2019/077053 CN2019077053W WO2020057062A1 WO 2020057062 A1 WO2020057062 A1 WO 2020057062A1 CN 2019077053 W CN2019077053 W CN 2019077053W WO 2020057062 A1 WO2020057062 A1 WO 2020057062A1
Authority
WO
WIPO (PCT)
Prior art keywords
pixel data
weight
range
data
value
Prior art date
Application number
PCT/CN2019/077053
Other languages
French (fr)
Chinese (zh)
Inventor
刘淼
Original Assignee
北京图森未来科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京图森未来科技有限公司 filed Critical 北京图森未来科技有限公司
Publication of WO2020057062A1 publication Critical patent/WO2020057062A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration by the use of local operators
    • G06T5/70
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/10Image enhancement or restoration by non-spatial domain filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details
    • G06T2207/20028Bilateral filtering
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present invention relates to the field of image processing, and in particular, to a method and device for realizing bilateral filtering of an image in a Field-Programmable Gate Array (FPGA), an FPGA, a computer program, and an imaging device.
  • FPGA Field-Programmable Gate Array
  • image processing is performed on a video image acquired by an imaging device to obtain required image data.
  • Image processing techniques include filtering.
  • Image filtering is to suppress the noise of the target image while preserving image feature information as much as possible. It is an indispensable operation in image preprocessing. The quality of its processing effect will directly affect the effectiveness and reliability of subsequent image processing and analysis. Sex.
  • image filtering There are many methods for image filtering, such as median filtering, non-linear filtering, morphological filtering, etc. Each filtering method has different advantages and uses, and can be personalized according to customer needs.
  • Bilateral filter is a non-linear filtering method. It considers spatial information and gray similarity at the same time, and combines the spatial proximity of the image and the gray value similarity of the pixel to filter the image. At the same time, the edge (ie, detail features) information of the image is well preserved. In comparison, general filters (such as Wiener filter, Gaussian filter, etc.) will have obvious edge blurring, and the protection effect on high-frequency edge details is not good. Therefore, bilateral filtering is widely used in applications that require high image edge details. It comprehensively considers the correlation between spatial and value domains to process target data. It is a compromise processing method with simple, non-iterative, and local Features.
  • I ′ is the image pixel after bilateral filtering
  • I is the input image pixel of the filter
  • I (i, j) is the gray value of the current filtered target pixel
  • (i, j) is the coordinate of the target pixel
  • is the set of all pixels contained in the filtering window (filtering is performed in a certain window area)
  • I (k, l) is the gray value of any pixel within the filtering window ⁇
  • (k, l ) Is the coordinates of the pixel.
  • g s is a filter function in the spatial domain
  • f r is a filter function in the value domain.
  • K is the weight, which represents the proximity in the airspace and the similarity in the range.
  • I (i, j) on the image I (k, l) is any pixel point in the area window ⁇ (for example, a window of 3 * 3, 5 * 5, or 7 * 7) where the point is located,
  • the weight function g s which characterizes the spatial proximity of two pixels, can be expressed by a Gaussian kernel:
  • ⁇ s and ⁇ r represent the smoothness parameters of the space domain and the range, respectively, and ⁇ s is defined as the spatial degree proximity factor. The larger the value, the greater the influence of surrounding pixels on the target pixel, and the more blurred the image; otherwise, the image is clearer, but if its value is too small, the filtering effect of noise may be limited.
  • the video image data is processed by the FPGA using a bilateral filtering algorithm to obtain filtered image data.
  • IP Intelligent Property
  • the present application provides a method and device for implementing bilateral filtering of an image in an FPGA, an FPGA, a computer program, and an imaging device. , Can not meet the real-time requirements.
  • a method for implementing bilateral filtering of an image in an FPGA including:
  • the received pixel data is determined as the target pixel data, and all the pixel data in the filtering window where the target pixel data is located is determined.
  • the target pixel data is filtered by using a bilateral filter to obtain the filtered pixel data according to all the found spatial weight values and range weight values of the affected pixel data.
  • an apparatus for implementing bilateral filtering of an image in an FPGA including:
  • the searching unit is configured to determine, after receiving the valid data in the image data, the received pixel data as target pixel data, and determine that all the pixel data in the filtering window where the target pixel data is located is the affected pixel data; Look up and determine the airspace weight value corresponding to each affected pixel data from the stored airspace weight table, and find and determine the value of the domain weight corresponding to each affected pixel data from the stored value domain weight table;
  • the filtering unit is configured to filter the target pixel data by using a bilateral filter according to the spatial weight value and the range weight value of all the affected pixel data of the found target pixel data, to obtain filtered pixel data.
  • an FPGA is provided, and the FPGA includes the foregoing device for implementing bilateral filtering of an image.
  • a computer program is provided, the computer program having a code segment configured to perform an image bilateral filtering process, the image bilateral filtering process includes:
  • the received one pixel data is determined as the target pixel data, and all the pixel data in the filtering window where the target pixel data is located is determined as the affected pixel data;
  • the target pixel data is filtered by using a bilateral filter to obtain the filtered pixel data according to all the found spatial weight values and range weight values of the affected pixel data.
  • an imaging device including an image sensor and an FPGA
  • An image sensor is used to obtain image data
  • the FPGA determines the received pixel data as target pixel data after receiving valid data in the image data, and determines all pixels in the filtering window where the target pixel data is located.
  • Data is the data of the affected pixels;
  • the target pixel data is filtered by using a bilateral filter to obtain the filtered pixel data according to all the found spatial weight values and range weight values of the affected pixel data.
  • the method for implementing bilateral filtering of an image in an FPGA in the process of receiving image data from an image sensor by the FPGA, for any pixel data received, all The pixel data is the influential pixel data.
  • the spatial weight value and range weight value of all influencing pixels are filtered by a bilateral filter to obtain the filtered pixels.
  • the complex spatial weight calculation and range weight calculation are changed from real-time calculation to query.
  • the table operation and table lookup operation speed is much faster than the real-time calculation speed, which can speed up the processing speed of the bilateral filtering of the image and improve the real-time processing. Therefore, it can solve the problem of filtering the image data by using the bilateral filtering algorithm on the FPGA in the prior art. Handle problems that cannot meet real-time requirements.
  • FIG. 1 is a processing flowchart of a method for implementing bilateral filtering of an image in an FPGA according to an embodiment of the present application
  • FIG. 2 is another processing flowchart of a method for implementing bilateral filtering of an image in an FPGA according to an embodiment of the present invention
  • FIG. 3 is an example of position labels in the filtering window
  • FIG. 4 is an example of an airspace weight table
  • FIG. 5 is an example of a range weight table
  • FIG. 6 is another processing flowchart of a method for implementing bilateral filtering of an image in an FPGA according to an embodiment of the present invention
  • FIG. 7 is a schematic structural diagram of an apparatus for implementing bilateral filtering of an image in an FPGA according to an embodiment of the present invention.
  • FIG. 8 is another schematic structural diagram of an apparatus for implementing bilateral filtering of an image in an FPGA provided by an embodiment of the present invention.
  • the embodiment of the present application provides a solution for implementing bilateral filtering of an image in an FPGA to solve the problem.
  • this solution in the process of receiving image data from the image sensor by the FPGA, for any pixel data received, it is determined that all the pixel data in the filtering window where the pixel data is located is the affected pixel data, and the weight from the stored airspace is determined.
  • the bilateral target filter is used to filter the target pixel to obtain the filtered pixel.
  • the complex spatial weight calculation and range weight calculation are changed from real-time calculation to table lookup operation, which is much faster than real-time.
  • the speed of calculation can speed up the processing speed of bilateral filtering of the image and improve the real-time performance of the processing, which can solve the problem of using the bilateral filtering algorithm on the FPGA to filter the image data in the prior art, which cannot meet the real-time requirements.
  • An embodiment of the present application provides a method for implementing bilateral filtering of an image in an FPGA. As shown in FIG. 1, the method includes:
  • Step 102 In the process of the FPGA receiving the image data from the image sensor, after receiving the valid data in the image data, determine the received pixel data as the target pixel data, and determine the target pixel data in the filter window. All pixel data is the affected pixel data;
  • Step 104 Look up and determine the airspace weight value corresponding to each affected pixel data from the stored airspace weight table in turn, and look up and determine the value of the domain weight corresponding to each affected pixel data from the stored range weight table.
  • Step 106 Filter the target pixel data by using a bilateral filter to obtain filtered pixel data according to the spatial weight values and range weight values of all the affected pixel data that are found by the target pixel data.
  • a table lookup operation is performed on all the affected pixel data of each received pixel data in the filtering window to find the spatial weight value and range weight value of all affected pixel data, and according to The found spatial weight value and range weight value, and the target pixel data is filtered by using a bilateral filter, which can improve the operation speed of determining the spatial weight value and the range weight value through a fast table lookup operation. It can improve the processing speed and real-time performance of image bilateral filtering processing on FPGA, and can solve the problem of using the bilateral filtering algorithm on FPGA to filter image data in the prior art, which cannot meet the real-time requirements.
  • the airspace weight table and the range weight table may be determined and stored according to the following steps:
  • Step 100 During the FPGA receiving the first frame of image data, during the blanking period of the first frame of image data, according to a preset spatial smoothing parameter ⁇ s , a range smoothing parameter ⁇ r , a radius r of the filtering window ⁇ , and The bit width n of the gray value data determines the airspace weight value included in the airspace weight table and the range weight value included in the range weight table;
  • the airspace weight table includes M airspace weight values.
  • One airspace weight value is an airspace neighboring weight of the target pixel data in the filter window that affects the pixel data to the target pixel data.
  • the range weight table includes N range weight values, and a range weight value is a range proximity weight that affects pixel data to target pixel data.
  • N 2 n
  • n is the bit width of the gray value data.
  • the airspace weight table and range weight table can be saved as a look-up-table (LUT).
  • an airspace weight value that affects pixel data is determined according to the following formula (3); a range weight value is determined according to the formula (4);
  • g s is a filtering function in the spatial domain
  • f r is a filtering function in the value domain
  • I (i, j) is the gray value of the target pixel data
  • (i, j) is the coordinates of the target pixel data
  • I ( k, l) is the gray value that affects the pixel data
  • (k, l) is the coordinate that affects the pixel data
  • ⁇ s is a preset spatial smoothness parameter
  • ⁇ r is a preset range smooth parameter.
  • ⁇ s and ⁇ r are usually preset parameters, and are set by an operator according to specific application needs.
  • Step 101 Store the determined airspace weight table and range weight table.
  • the operation of storing the determined spatial weight table may include: storing the spatial weight value corresponding to the affected pixel data in the spatial weight table according to the position of the affected pixel data in the filtering window.
  • Affected pixel data can be labeled with the position of the affected pixel in the filter window, as shown in Figure 3; and according to the position of the affected pixel data in the filter window, the spatial weight value corresponding to the affected pixel data is stored in the spatial weight table, as shown in the figure. 4 shown.
  • the pixel data with the position number (1, 1) is the target pixel data
  • the position numbers shown are (0,0), (0,1), (0,2), (1,0), (1,1), (1,2), (2,0), (2, 1), (2, 2) pixel data.
  • the index is a position number that affects pixel data, and each position number corresponds to an airspace weight value, including g1 to g9.
  • the operation of storing the determined range weight table may include: storing the range weight values corresponding to the values 0 to N in the range weight table in the order of the values from 0 to N in ascending or descending order. ;
  • the variables in the window ⁇ include the smoothing parameter ⁇ r , the gray value I (i, j) of the target pixel, and the gray value I (k, l) of the affected pixel, where the preset ⁇ r is constant, then the variable only contains
  • I (i, j) and I (k, l) are the gray values of pixels at a point on the image I, the values are non-negative integers.
  • can be used as an index, and the values are 0, 1, 2, ..., 255, and the corresponding formula (4) is stored in the LUT In Figure 5, the index is 0 to 255, and n0 to n255 represent the value of formula (4) when
  • the operation of finding and determining an airspace weight value corresponding to the pixel data from the stored airspace weight table in step 104 includes:
  • a spatial weight value corresponding to the position of the affected pixel data is determined from the stored spatial weight table.
  • the position of the affected pixel data in the filtering window may be determined first, and the spatial weight value corresponding to the position may be found in the spatial weight table.
  • the operation of searching for and determining an affected range weight value corresponding to pixel data from the stored range weight table in the above step 104 includes:
  • a difference between the gray value of the target pixel data and the gray value of the affected pixel data is determined, and a range weight value corresponding to the difference value is searched and determined in the range weight table according to the difference value.
  • the spatial weight value and range weight value of the affected pixels can be found.
  • step 106 using a bilateral filter to filter the target pixel data includes:
  • I ′ is the image pixel data after bilateral filtering
  • I is the input image pixel data of the filter
  • I (i, j) is the gray value of the target pixel data
  • (i, j) represents the coordinates of the target pixel data point
  • is the set of all pixel data points contained in the filter window
  • I (k, l) is an influential pixel data in the filter window ⁇
  • (k, l) is the coordinate that affects the pixel data
  • g s is in the spatial domain Filter function
  • f r is the filter function on the value range
  • K is the weight.
  • step 104 the value of g s and the value of f r have been found, and the searched value is substituted into the above formulas (1) and (2), and the filtered pixel data is calculated and obtained.
  • the spatial smoothing parameter ⁇ s , the range smoothing parameter ⁇ r , the filtering window radius r, and the gray value data bit width n are preset and fixed. In other embodiments, according to the needs of the application scenario, it is allowed to modify and update any one of the parameters of the spatial smoothing parameter ⁇ s , the range smoothing parameter ⁇ r , the filtering window radius r, and the gray value data bit width n. Then, the process shown in FIG. 1 needs to update the airspace weight table and the range weight table according to the updated parameters.
  • FIG. 6 shows a processing flow for updating the airspace weight table and the range weight table.
  • the processing before the processing flow shown in FIG. 1 includes:
  • Step 100 ' In the process of receiving subsequent image data, during the frame blanking period of the received image data, detect any of the spatial smoothing parameters, range smoothing parameters, filter window size, and gray value data bit width of the bilateral filter. Whether a parameter has been updated;
  • Step 101 ' When it is determined that the parameters are not updated, valid data in the image data is received, and the process proceeds to step 102;
  • Step 102 ' When it is determined that the parameters are updated, determine the airspace weight values included in the airspace weight table according to the updated airspace smoothing parameters, range smoothing parameters, filter window size, and gray value data bit width, and / The range weight value included in the OR range weight table; stores the updated airspace weight table and / or range weight table; and receives valid data in the image data, and the process proceeds to step 102.
  • the airspace weight table and the range weight table can be updated according to the updated parameters. Further combined with the processing shown in FIG. 1, the airspace weight table and the range weight table can be updated according to the processing shown in FIG. 1. To filter the pixel data.
  • the bilateral target filter is used to filter the target pixel to obtain the filtered pixel; among them, the complex spatial weight calculation and range weight calculation are changed from real-time calculation to table lookup operation, and the speed of table lookup operation is much faster.
  • the speed of real-time calculation can speed up the processing speed of bilateral filtering of the image and improve the real-time performance of the processing, so that it can solve the problem of using the bilateral filtering algorithm on the FPGA to filter the image data in the prior art, which cannot meet the real-time requirements
  • an embodiment of the present application further provides a device for implementing bilateral filtering of an image in an FPGA.
  • FIG. 7 shows a structure of an apparatus for implementing bilateral filtering of an image in an FPGA provided by an embodiment of the present application.
  • the apparatus includes:
  • a receiving unit 71 configured to receive image data from an image sensor
  • the searching unit 72 is configured to determine, after the receiving unit 71 receives valid data in the image data, one pixel data received as the target pixel data, and determine that all the pixel data in the filtering window where the target pixel data is located is the affected pixel data. ; Search and determine the spatial weight value corresponding to each affected pixel data in turn from the stored spatial weight table, and find and determine the corresponding domain weight value from each stored pixel weight table from the stored range weight table;
  • the filtering unit 73 is configured to filter the target pixel data by using a bilateral filter to obtain the filtered pixel data according to the spatial weight value and the range weight value of all the affected pixel data of the found target pixel data.
  • the apparatus shown in FIG. 7 may further include a determining unit 70.
  • a determining unit 70 is configured to: during the process of receiving the first frame of image data by the receiving unit, during the frame blanking period of the first frame of image data, according to a preset spatial smoothing parameter ⁇ s , a range smoothing parameter ⁇ r , and a filtering window
  • the radius r and the bit width n of the gray value data determine the airspace weight value included in the airspace weight table and the value of the range weight included in the value range weight table; the determined airspace weight table and range weight table are stored;
  • the airspace weight table includes M airspace weight values.
  • One airspace weight value is an airspace neighboring weight of the target pixel data in the filter window that affects the pixel data to the target pixel data.
  • the range weight table includes N range weight values.
  • a range weight value is a range weight that affects pixel data to target pixel data.
  • N 2 n , n is the gray-scale data bit width.
  • the determining unit 70 stores the determined spatial weight table, which includes: storing the spatial weight values corresponding to the affected pixel data in the spatial weight table according to the position order of the affected pixel data in the filtering window;
  • the searching unit 72 searches and determines an airspace weight value corresponding to the affected pixel data from the stored airspace weight table, including: according to the position of the affected pixel data in the filtering window, searching and determining from the stored airspace weight table to determine the affected pixel.
  • the spatial weight value corresponding to the position of the data is not limited to the position of the data.
  • the determining unit stores the determined range weight table, which includes: storing values corresponding to the values 0 to N in the range weight table according to the order from 0 to N values from small to large or from large to small. Domain proximity weight value;
  • the searching unit 72 searches and determines from the stored range weight table a range weight value corresponding to the affected pixel data, including: determining a difference between a gray value of the target pixel data and a gray value of the affected pixel data. Value, according to the difference value, look up in the range weight table to determine the range weight value corresponding to the difference value.
  • the determining unit 70 is further configured to: in the process of receiving the subsequent image data by the receiving unit 71, during the frame blanking period of the received image data, detect the spatial smoothness parameters and smooth value range of the bilateral filter Whether any one of the parameters, filter window size and gray value data bit width is updated; if it is determined that the parameter is not updated, valid data in the image data is received; if it is determined that the parameter is updated, according to the update
  • the airspace smoothing parameter, range smoothing parameter, filter window size, and gray value data bit width determine the airspace weight values included in the airspace weight table, and / or the range weight values included in the range weight table; after the update is stored, The airspace weight table and / or range weight table; and receive valid data from the image data.
  • the determining unit determines an airspace weight value included in the airspace weight table, and determines a range weight value included in the range weight table, including:
  • g s is a filtering function in the spatial domain
  • f r is a filtering function in the value domain
  • I (i, j) is the gray value of the target pixel data
  • (i, j) is the coordinates of the target pixel data
  • I ( k, l) is the gray value that affects the pixel data
  • (k, l) is the coordinate that affects the pixel data
  • ⁇ s is the spatial smoothing parameter
  • ⁇ r is the smoothing parameter of the range.
  • the filtering unit 73 uses a bilateral filter to filter the target pixel data, including: filtering the target pixel data according to the following formula, among them, I ′ is the image pixel data after bilateral filtering, I is the input image pixel data of the filter, I (i, j) is the gray value of the target pixel data, (i, j) represents the coordinates of the target pixel data point, ⁇ Is the set of all pixel data points contained in the filter window, I (k, l) is a gray value that affects the pixel data in the filter window ⁇ , (k, l) is the coordinates that affect the pixel data; g s is the spatial domain Filter function, f r is the filter function on the value range; K is the weight.
  • I ′ is the image pixel data after bilateral filtering
  • I is the input image pixel data of the filter
  • I (i, j) is the gray value of the target pixel data
  • (i, j) represents the coordinates of the target pixel
  • the device shown in FIG. 7 or 8 can be encapsulated into an IP core, and the method shown in FIG. 1 or FIG. 2 is implemented by calling the IP core.
  • an embodiment of the present application further provides a computer program having a code segment configured to perform an image bilateral filtering process, where the image bilateral filtering process may be as shown in FIG. 1 or FIG. 2 Processing.
  • an embodiment of the present application further provides an FPGA.
  • the FPGA includes a device as shown in FIG. 7 or FIG. 8.
  • the FPGA may further include a computer program as described above.
  • the FPGA provided in the embodiment of the present application can speed up the processing speed of bilateral filtering of an image and improve the real-time performance of processing.
  • an embodiment of the present application further provides an imaging device.
  • the imaging device includes an image sensor and an FPGA as described above.
  • the imaging device provided in the embodiment of the present application can speed up the processing speed of bilateral filtering of an image and improve the real-time performance of processing.
  • the imaging device provided in the embodiment of the present application may be a specific device such as a camera.
  • the FPGA during the process of receiving image data from the image sensor by the FPGA, for the received pixel data, it is determined that all the pixel data in the filtering window where the pixel data is located is the affected pixel data , From the stored airspace weight table to find and determine the corresponding airspace weight value of each affected pixel, from the stored value domain weight table to find and determine the value of the corresponding domain weight value of each affected pixel, according to the found all affected pixels of the airspace Weight value and range weight value.
  • the target pixel is filtered by using a bilateral filter to obtain filtered pixels.
  • the complex spatial weight calculation and range weight calculation are changed from real-time calculation to table lookup operation and table lookup operation.
  • the speed is much faster than the real-time calculation speed, which can speed up the processing speed of bilateral filtering of the image and improve the real-time performance of the processing, which can solve the problem of filtering the image data by using the bilateral filtering algorithm on the FPGA in the prior art. Asked questions.
  • a person of ordinary skill in the art may understand that all or part of the steps carried by the methods in the foregoing embodiments may be implemented by a program instructing related hardware.
  • the program may be stored in a computer-readable storage medium. When the program is executed, Including one or a combination of steps of a method embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing module, or each unit may exist separately physically, or two or more units may be integrated into one module.
  • the above integrated modules may be implemented in the form of hardware or software functional modules. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
  • the embodiments of the present invention may be provided as a method, a system, or a computer program product. Therefore, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, magnetic disk memory, optical memory, etc.) containing computer-usable program code therein.
  • computer-usable storage media including, but not limited to, magnetic disk memory, optical memory, etc.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to work in a particular manner such that the instructions stored in the computer-readable memory produce a manufactured article including an instruction device, the instructions
  • the device implements the functions specified in one or more flowcharts and / or one or more blocks of the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing device, so that a series of steps can be performed on the computer or other programmable device to produce a computer-implemented process, which can be executed on the computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more flowcharts and / or one or more blocks of the block diagrams.

Abstract

A method and apparatus for implementing bilateral image filtering in an FPGA, and an FPGA, for use in solving the problem in the prior art of being unable to meet real-time requirements when filtering image data by using a bilateral filtering algorithm on an FPGA. The method comprises: in the process that an FPGA receives image data from an imaging device, after receiving valid data in the image data, determining one piece of received pixel data as target pixel data, and determining all pixel data in a filtering window where the target pixel data is located as influence pixel data (102); sequentially searching for and determining a domain weight value corresponding to each influence pixel data from a stored domain weight table and searching for and determining a range weight value corresponding to each influence pixel data from a stored range weight table (104); and filtering the target pixel data by means of a bilateral filter according to the found domain weight values and range weight values of all the influence pixel data of the target pixel data, to obtain filtered pixel data (106).

Description

在FPGA中实现图像双边滤波的方法和装置、FPGAMethod and device for implementing bilateral image filtering in FPGA, FPGA
本申请要求在2018年9月19日提交中国专利局、申请号为201811096288.1、发明名称为“在FPGA中实现图像双边滤波的方法和装置、FPGA”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on September 19, 2018, with the application number 201811096288.1, and the invention name is "Method and Apparatus for Implementing Bilateral Filtering of Images in FPGAs, FPGAs". Citations are incorporated in this application.
技术领域Technical field
本发明涉及图像处理领域,特别涉及一种在现场可编程门阵列(Field-Programmable Gate Array,FPGA)中实现图像双边滤波的方法和装置、FPGA、计算机程序、成像设备。The present invention relates to the field of image processing, and in particular, to a method and device for realizing bilateral filtering of an image in a Field-Programmable Gate Array (FPGA), an FPGA, a computer program, and an imaging device.
背景技术Background technique
目前,在一些应用场景中,会对成像设备获取到的视频图像进行图像处理,得到所需要的图像数据。At present, in some application scenarios, image processing is performed on a video image acquired by an imaging device to obtain required image data.
这些图像处理技术中包括滤波处理。图像滤波即在尽量保留图像特征信息的条件下对目标图像的噪声进行抑制,是图像预处理中不可缺少的操作,其处理效果的好坏将直接影响到后续图像处理和分析的有效性和可靠性。图像滤波的方法有很多种,例如中值滤波、非线性滤波、形态学滤波等,每种滤波方法都有不同的优势和用途,具体可根据客户需求进行个性化选择。These image processing techniques include filtering. Image filtering is to suppress the noise of the target image while preserving image feature information as much as possible. It is an indispensable operation in image preprocessing. The quality of its processing effect will directly affect the effectiveness and reliability of subsequent image processing and analysis. Sex. There are many methods for image filtering, such as median filtering, non-linear filtering, morphological filtering, etc. Each filtering method has different advantages and uses, and can be personalized according to customer needs.
双边滤波器(Bilateral Filter)是一种非线性滤波的方法,它同时考虑空域信息和灰度相似性,结合图像的空间邻近度和像素的灰度值相似度对图像进行滤波,可在滤除噪声的同时较好地保存图像的边缘(即细节特征)信息。较之,一般的滤波器(例如维纳滤波(Wiener filter)、高斯滤波(Gaussian filter)等)会存在较明显的边缘模糊现象,对于高频的边缘细节的保护效果不好。因此,双边滤波在对图像边缘细节要求高的应用中得到广泛应用,它综合考虑空域和值域的相关性对目标数据进行处理,是一种折中处理方法,具有简单、非迭代、局部的特点。Bilateral filter (Bilateral filter) is a non-linear filtering method. It considers spatial information and gray similarity at the same time, and combines the spatial proximity of the image and the gray value similarity of the pixel to filter the image. At the same time, the edge (ie, detail features) information of the image is well preserved. In comparison, general filters (such as Wiener filter, Gaussian filter, etc.) will have obvious edge blurring, and the protection effect on high-frequency edge details is not good. Therefore, bilateral filtering is widely used in applications that require high image edge details. It comprehensively considers the correlation between spatial and value domains to process target data. It is a compromise processing method with simple, non-iterative, and local Features.
在图像处理的离散领域,双边滤波的定义可表示为:In the discrete field of image processing, the definition of bilateral filtering can be expressed as:
Figure PCTCN2019077053-appb-000001
Figure PCTCN2019077053-appb-000001
其中,
Figure PCTCN2019077053-appb-000002
among them,
Figure PCTCN2019077053-appb-000002
其中,Ι'为双边滤波后的图像像素,I为滤波器的输入图像像素,I(i,j)为当前滤波的目标像素点的灰度值,(i,j)表示目标像素点的坐标,Ω为滤波窗口内包含的所有像素点的 集合(滤波是在一定窗口区域内进行的),I(k,l)为滤波窗口Ω内的任一像素点的灰度值,(k,l)为该像素点的坐标。g s为空域上的滤波函数,f r为值域上的滤波函数。K为权重,表征空域上的邻近度和值域上的相似性。 Among them, I ′ is the image pixel after bilateral filtering, I is the input image pixel of the filter, I (i, j) is the gray value of the current filtered target pixel, and (i, j) is the coordinate of the target pixel , Ω is the set of all pixels contained in the filtering window (filtering is performed in a certain window area), I (k, l) is the gray value of any pixel within the filtering window Ω, (k, l ) Is the coordinates of the pixel. g s is a filter function in the spatial domain, and f r is a filter function in the value domain. K is the weight, which represents the proximity in the airspace and the similarity in the range.
对于图像上的任意一点I(i,j),I(k,l)为该点所在的区域窗口Ω(例如3*3、5*5或者7*7的窗口)内的任一像素点,则表征两个像素点空域邻近度的权重函数g s可采用高斯核表示: For any point I (i, j) on the image, I (k, l) is any pixel point in the area window Ω (for example, a window of 3 * 3, 5 * 5, or 7 * 7) where the point is located, Then the weight function g s , which characterizes the spatial proximity of two pixels, can be expressed by a Gaussian kernel:
Figure PCTCN2019077053-appb-000003
Figure PCTCN2019077053-appb-000003
同理,表征两个像素点值域相似度的权重函数f rSimilarly, the weight function f r representing the similarity of the range of two pixels is:
Figure PCTCN2019077053-appb-000004
Figure PCTCN2019077053-appb-000004
其中σ s、σ r分别表示空域和值域的光滑参数,定义σ s为空间度邻近度因子。其值越大,周围像素对目标像素点的影响越大,图像越模糊;反之,图像越清晰,但若其值过小,噪声的滤除效果可能会受限。 Among them, σ s and σ r represent the smoothness parameters of the space domain and the range, respectively, and σ s is defined as the spatial degree proximity factor. The larger the value, the greater the influence of surrounding pixels on the target pixel, and the more blurred the image; otherwise, the image is clearer, but if its value is too small, the filtering effect of noise may be limited.
在一些应用场景中,图像成像设备获取到视频图像数据之后,通过FPGA使用双边滤波算法对视频图像数据进行处理,得到滤波后的图像数据。通常是在FPGA中实时调用IP(Intellectual Property)核对图像数据中的每个像素点进行上述公式的计算。In some application scenarios, after the video imaging data is obtained by the image imaging device, the video image data is processed by the FPGA using a bilateral filtering algorithm to obtain filtered image data. Generally, IP (Intellectual Property) is called in FPGA to check each pixel in the image data and calculate the above formula.
但是,在FPGA中使用双边滤波算法对图像数据滤波处理的过程中,会消耗大量的逻辑资源,且无法对成像设备获取到的图像数据进行实时处理,从而通常将获取到的图像数据进行缓存到本地,再进行滤波处理。However, in the process of using bilateral filtering algorithms to filter image data in FPGAs, a large amount of logical resources are consumed, and the image data acquired by the imaging equipment cannot be processed in real time, so the acquired image data is usually cached to Locally, filtering is performed.
可见,在现有成像设备的FPGA上使用双边滤波算法对图像数据进行滤波处理的方法中,存在无法满足实时性要求的问题。It can be seen that, in the method of filtering the image data by using the bilateral filtering algorithm on the FPGA of the existing imaging equipment, there is a problem that the real-time requirement cannot be met.
发明内容Summary of the Invention
鉴于上述问题,本申请提供了一种在FPGA中实现图像双边滤波的方法和装置、FPGA、计算机程序、成像设备,用以解决现有技术中在FPGA上使用双边滤波算法对图像数据进行滤波处理,无法满足实时性要求的问题。In view of the above problems, the present application provides a method and device for implementing bilateral filtering of an image in an FPGA, an FPGA, a computer program, and an imaging device. , Can not meet the real-time requirements.
根据本申请的一个方面,提供了一种在FPGA中实现图像双边滤波的方法,包括:According to an aspect of the present application, a method for implementing bilateral filtering of an image in an FPGA is provided, including:
在FPGA接收来自图像传感器的图像数据的过程中,在接收到图像数据中的有效数据后,将接收到的一个像素数据确定为目标像素数据,确定该目标像素数据所在滤波窗口中的全部像素数据为影响像素数据;In the process of FPGA receiving image data from the image sensor, after receiving valid data in the image data, the received pixel data is determined as the target pixel data, and all the pixel data in the filtering window where the target pixel data is located is determined. To affect pixel data;
依次从存储的空域权重表中查找确定每个影响像素数据对应的空域权重值,从存储的 值域权重表中查找确定每个影响像素数据对应的值域权重值;Look up and determine the airspace weight value corresponding to each affected pixel data from the stored airspace weight table in turn, and look up and determine the range weight value corresponding to each affected pixel data from the stored range weight table;
根据查找到的该目标像素数据的全部影响像素数据的空域权重值和值域权重值,使用双边滤波器对该目标像素数据进行滤波,得到滤波后的像素数据。The target pixel data is filtered by using a bilateral filter to obtain the filtered pixel data according to all the found spatial weight values and range weight values of the affected pixel data.
根据本申请的一个方面,提供了一种在FPGA中实现图像双边滤波的装置,包括:According to an aspect of the present application, an apparatus for implementing bilateral filtering of an image in an FPGA is provided, including:
接收单元,用于接收图像数据;A receiving unit for receiving image data;
查找单元,用于在接收单元接收到图像数据中的有效数据后,将接收到的一个像素数据确定为目标像素数据,确定该目标像素数据所在滤波窗口中的全部像素数据为影响像素数据;依次从存储的空域权重表中查找确定每个影响像素数据对应的空域权重值,从存储的值域权重表中查找确定每个影响像素数据对应的值域权重值;The searching unit is configured to determine, after receiving the valid data in the image data, the received pixel data as target pixel data, and determine that all the pixel data in the filtering window where the target pixel data is located is the affected pixel data; Look up and determine the airspace weight value corresponding to each affected pixel data from the stored airspace weight table, and find and determine the value of the domain weight corresponding to each affected pixel data from the stored value domain weight table;
滤波单元,用于根据查找到的该目标像素数据的全部影响像素数据的空域权重值和值域权重值,使用双边滤波器对该目标像素数据进行滤波,得到滤波后的像素数据。The filtering unit is configured to filter the target pixel data by using a bilateral filter according to the spatial weight value and the range weight value of all the affected pixel data of the found target pixel data, to obtain filtered pixel data.
根据本申请的一个方面,提供了一种FPGA,该FPGA包括上述实现图像双边滤波的装置。根据本申请的一个方面,提供了一种计算机程序,该计算机程序具有被配置用于执行图像双边滤波处理的代码段,图像双边滤波处理包括:According to an aspect of the present application, an FPGA is provided, and the FPGA includes the foregoing device for implementing bilateral filtering of an image. According to one aspect of the present application, a computer program is provided, the computer program having a code segment configured to perform an image bilateral filtering process, the image bilateral filtering process includes:
接收图像数据的过程中,在接收到图像数据中的有效数据后,将接收到的一个像素数据确定为目标像素数据,确定该目标像素数据所在滤波窗口中的全部像素数据为影响像素数据;In the process of receiving image data, after receiving valid data in the image data, the received one pixel data is determined as the target pixel data, and all the pixel data in the filtering window where the target pixel data is located is determined as the affected pixel data;
依次从存储的空域权重表中查找确定每个影响像素数据对应的空域权重值,从存储的值域权重表中查找确定每个影响像素数据对应的值域权重值;Look up and determine the spatial weight value corresponding to each affected pixel data from the stored spatial weight table in turn, and look up and determine the corresponding domain weight value from the stored value domain weight table;
根据查找到的该目标像素数据的全部影响像素数据的空域权重值和值域权重值,使用双边滤波器对该目标像素数据进行滤波,得到滤波后的像素数据。The target pixel data is filtered by using a bilateral filter to obtain the filtered pixel data according to all the found spatial weight values and range weight values of the affected pixel data.
根据本申请的一个方面,提供了一种成像设备,包括图像传感器和FPGA;According to an aspect of the present application, there is provided an imaging device including an image sensor and an FPGA;
图像传感器用于获取图像数据;An image sensor is used to obtain image data;
FPGA用于接收来自图像传感器的图像数据的过程中,在接收到图像数据中的有效数据后,将接收到的一个像素数据确定为目标像素数据,确定该目标像素数据所在滤波窗口中的全部像素数据为影响像素数据;In the process of receiving image data from the image sensor, the FPGA determines the received pixel data as target pixel data after receiving valid data in the image data, and determines all pixels in the filtering window where the target pixel data is located. Data is the data of the affected pixels;
依次从存储的空域权重表中查找确定每个影响像素数据对应的空域权重值,从存储的值域权重表中查找确定每个影响像素数据对应的值域权重值;Look up and determine the spatial weight value corresponding to each affected pixel data from the stored spatial weight table in turn, and look up and determine the corresponding domain weight value from the stored value domain weight table;
根据查找到的该目标像素数据的全部影响像素数据的空域权重值和值域权重值,使用双边滤波器对该目标像素数据进行滤波,得到滤波后的像素数据。The target pixel data is filtered by using a bilateral filter to obtain the filtered pixel data according to all the found spatial weight values and range weight values of the affected pixel data.
根据本申请实施例提供的在FPGA中实现图像双边滤波的方法,在FPGA接收到来自图像传感器的图像数据的过程中,对接收到的任意一个像素数据,确定该像素数据所在滤 波窗口中的全部像素数据为影响像素数据,从存储的空域权重表中查找确定每个影响像素对应的空域权重值,从存储的值域权重表中查找确定每个影响像素对应的值域权重值,根据查找到的全部影响像素的空域权重值和值域权重值,使用双边滤波器对该目标像素进行滤波,得到滤波后的像素;其中将复杂的空域权重计算和值域权重计算,由实时计算改为查表操作,查表操作的速度大大快于实时计算的速度,能够加快图像双边滤波的处理速度,提高处理的实时性,从而能够解决现有技术中在FPGA上使用双边滤波算法对图像数据进行滤波处理,无法满足实时性要求的问题。According to the method for implementing bilateral filtering of an image in an FPGA provided by an embodiment of the present application, in the process of receiving image data from an image sensor by the FPGA, for any pixel data received, all The pixel data is the influential pixel data. Look up and determine the corresponding airspace weight value from the stored airspace weight table, and look up and determine the corresponding value domain weight value from the stored value domain weight table. The spatial weight value and range weight value of all influencing pixels are filtered by a bilateral filter to obtain the filtered pixels. Among them, the complex spatial weight calculation and range weight calculation are changed from real-time calculation to query. The table operation and table lookup operation speed is much faster than the real-time calculation speed, which can speed up the processing speed of the bilateral filtering of the image and improve the real-time processing. Therefore, it can solve the problem of filtering the image data by using the bilateral filtering algorithm on the FPGA in the prior art. Handle problems that cannot meet real-time requirements.
本发明的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本发明而了解。本发明的目的和其他优点可通过在所写的说明书、权利要求书、以及附图中所特别指出的结构来实现和获得。Other features and advantages of the present invention will be explained in the following description, and partly become apparent from the description, or be understood by implementing the present invention. The objects and other advantages of the present invention can be achieved and obtained through the structures specifically pointed out in the written description, claims, and drawings.
下面通过附图和实施例,对本发明的技术方案做进一步的详细描述。The technical solutions of the present invention will be described in further detail below with reference to the drawings and embodiments.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
附图用来提供对本发明的进一步理解,并且构成说明书的一部分,与本发明的实施例一起用于解释本发明,并不构成对本发明的限制。显而易见地,下面描述中的附图仅仅是本发明一些实施例,对于本领域普通技术人员而言,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。在附图中:The drawings are used to provide a further understanding of the present invention, and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention, and do not constitute a limitation on the present invention. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts. In the drawings:
图1为本申请实施例提供的在FPGA中实现图像双边滤波的方法的处理流程图;1 is a processing flowchart of a method for implementing bilateral filtering of an image in an FPGA according to an embodiment of the present application;
图2为本发明实施例提供的在FPGA中实现图像双边滤波的方法的另一种处理流程图;FIG. 2 is another processing flowchart of a method for implementing bilateral filtering of an image in an FPGA according to an embodiment of the present invention; FIG.
图3为滤波窗口中的位置标号示例;FIG. 3 is an example of position labels in the filtering window;
图4为空域权重表的示例;FIG. 4 is an example of an airspace weight table;
图5为值域权重表的示例;FIG. 5 is an example of a range weight table;
图6为本发明实施例提供的在FPGA中实现图像双边滤波的方法的另一种处理流程图;FIG. 6 is another processing flowchart of a method for implementing bilateral filtering of an image in an FPGA according to an embodiment of the present invention; FIG.
图7为本发明实施例提供的在FPGA中实现图像双边滤波的装置的结构示意图;7 is a schematic structural diagram of an apparatus for implementing bilateral filtering of an image in an FPGA according to an embodiment of the present invention;
图8为本发明实施例提供的在FPGA中实现图像双边滤波的装置的另一种结构示意图。FIG. 8 is another schematic structural diagram of an apparatus for implementing bilateral filtering of an image in an FPGA provided by an embodiment of the present invention.
具体实施方式detailed description
为了使本技术领域的人员更好地理解本发明中的技术方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例 仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described The embodiments are only a part of the embodiments of the present invention, but not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without creative efforts should fall within the protection scope of the present invention.
针对现有技术中在FPGA上使用双边滤波算法对图像数据进行滤波处理,无法满足实时性要求的问题,本申请实施例提供了一种在FPGA中实现图像双边滤波的方案,用于解决该问题。在该方案中,在FPGA接收到来自图像传感器的图像数据的过程中,对接收到的任意一个像素数据,确定该像素数据所在滤波窗口中的全部像素数据为影响像素数据,从存储的空域权重表中查找确定每个影响像素对应的空域权重值,从存储的值域权重表中查找确定每个影响像素对应的值域权重值,根据查找到的全部影响像素的空域权重值和值域权重值,使用双边滤波器对该目标像素进行滤波,得到滤波后的像素;其中将复杂的空域权重计算和值域权重计算,由实时计算改为查表操作,查表操作的速度大大快于实时计算的速度,能够加快图像双边滤波的处理速度,提高处理的实时性,从而能够解决现有技术中在FPGA上使用双边滤波算法对图像数据进行滤波处理,无法满足实时性要求的问题。Aiming at the problem that the bilateral filtering algorithm is used to filter image data on the FPGA in the prior art and cannot meet the real-time requirement, the embodiment of the present application provides a solution for implementing bilateral filtering of an image in an FPGA to solve the problem. . In this solution, in the process of receiving image data from the image sensor by the FPGA, for any pixel data received, it is determined that all the pixel data in the filtering window where the pixel data is located is the affected pixel data, and the weight from the stored airspace is determined. Look up and determine the spatial weight value corresponding to each affected pixel in the table, find and determine the value range weight value corresponding to each affected pixel from the stored range weight table, and according to the found space weight value and range weight of all affected pixels Value, the bilateral target filter is used to filter the target pixel to obtain the filtered pixel. Among them, the complex spatial weight calculation and range weight calculation are changed from real-time calculation to table lookup operation, which is much faster than real-time. The speed of calculation can speed up the processing speed of bilateral filtering of the image and improve the real-time performance of the processing, which can solve the problem of using the bilateral filtering algorithm on the FPGA to filter the image data in the prior art, which cannot meet the real-time requirements.
以上是本发明的核心思想,为了使本技术领域的人员更好地理解本发明实施例中的技术方案,并使本发明实施例的上述目的、特征和优点能够更加明显易懂,下面结合附图对本发明实施例中技术方案作进一步详细的说明。The above is the core idea of the present invention. In order for those skilled in the art to better understand the technical solutions in the embodiments of the present invention, and to make the above-mentioned objects, features, and advantages of the embodiments of the present invention more obvious and understandable, the following is combined with the attached The drawings further illustrate the technical solutions in the embodiments of the present invention in detail.
本申请实施例提供了一种在FPGA中实现图像双边滤波的方法,如图1所示,该方法包括:An embodiment of the present application provides a method for implementing bilateral filtering of an image in an FPGA. As shown in FIG. 1, the method includes:
步骤102、在FPGA接收来自图像传感器的图像数据的过程中,在接收到图像数据中的有效数据后,将接收到的一个像素数据确定为目标像素数据,确定该目标像素数据所在滤波窗口中的全部像素数据为影响像素数据;Step 102: In the process of the FPGA receiving the image data from the image sensor, after receiving the valid data in the image data, determine the received pixel data as the target pixel data, and determine the target pixel data in the filter window. All pixel data is the affected pixel data;
步骤104、依次从存储的空域权重表中查找确定每个影响像素数据对应的空域权重值,从存储的值域权重表中查找确定每个影响像素数据对应的值域权重值;Step 104: Look up and determine the airspace weight value corresponding to each affected pixel data from the stored airspace weight table in turn, and look up and determine the value of the domain weight corresponding to each affected pixel data from the stored range weight table.
步骤106、根据查找到的该目标像素数据的全部影响像素数据的空域权重值和值域权重值,使用双边滤波器对该目标像素数据进行滤波,得到滤波后的像素数据。Step 106: Filter the target pixel data by using a bilateral filter to obtain filtered pixel data according to the spatial weight values and range weight values of all the affected pixel data that are found by the target pixel data.
通过如图1所示的处理过程,对接收到的每个像素数据在滤波窗口中的全部影响像素数据进行查表操作,查找得到全部影响像素数据的空域权重值和值域权重值,并根据查找到的空域权重值和值域权重值,使用双边滤波器对该目标像素数据进行滤波,能够通过操作速度较快的查表操作来提高确定空域权重值和值域权重值的操作速度,从而能够提高在FPGA上进行图像双边滤波处理的处理速度和实时性,能够解决现有技术中在FPGA上使用双边滤波算法对图像数据进行滤波处理,无法满足实时性要求的问题。Through the processing process shown in FIG. 1, a table lookup operation is performed on all the affected pixel data of each received pixel data in the filtering window to find the spatial weight value and range weight value of all affected pixel data, and according to The found spatial weight value and range weight value, and the target pixel data is filtered by using a bilateral filter, which can improve the operation speed of determining the spatial weight value and the range weight value through a fast table lookup operation. It can improve the processing speed and real-time performance of image bilateral filtering processing on FPGA, and can solve the problem of using the bilateral filtering algorithm on FPGA to filter image data in the prior art, which cannot meet the real-time requirements.
在一些实施例中,如图2所示,在如图1所示的处理过程之前,可以根据如下步骤进 行确定和存储空域权重表和值域权重表:In some embodiments, as shown in FIG. 2, before the processing shown in FIG. 1, the airspace weight table and the range weight table may be determined and stored according to the following steps:
步骤100、在FPGA接收第一帧图像数据的过程中,在第一帧图像数据的消隐期,根据预设的空域光滑参数σ s、值域光滑参数σ r、滤波窗口Ω的半径r和灰度值数据位宽n,确定空域权重表中包括的空域权重值、和值域权重表中包括的值域权重值; Step 100: During the FPGA receiving the first frame of image data, during the blanking period of the first frame of image data, according to a preset spatial smoothing parameter σ s , a range smoothing parameter σ r , a radius r of the filtering window Ω, and The bit width n of the gray value data determines the airspace weight value included in the airspace weight table and the range weight value included in the range weight table;
其中,空域权重表中包括M个空域权重值,一个空域权重值是目标像素数据在滤波窗口中的一个影响像素数据对目标像素数据的空域邻近权重,滤波窗口中包括M个影响像素数据,M=(2r+1) 2,r为滤波窗口Ω的窗口半径;值域权重表中包括N个值域权重值,一个值域权重值是影响像素数据对目标像素数据的一种值域邻近权重,N=2 n,n为灰度值数据位宽。 Among them, the airspace weight table includes M airspace weight values. One airspace weight value is an airspace neighboring weight of the target pixel data in the filter window that affects the pixel data to the target pixel data. The filter window includes M influence pixel data, M = (2r + 1) 2 , r is the window radius of the filtering window Ω; the range weight table includes N range weight values, and a range weight value is a range proximity weight that affects pixel data to target pixel data. , N = 2 n , n is the bit width of the gray value data.
在一些应用场景中,空域权重表和值域权重表可以被保存为显示查找表(look-Up-Table,LUT)。In some application scenarios, the airspace weight table and range weight table can be saved as a look-up-table (LUT).
具体地,根据下列公式(3)确定一个影响像素数据的空域权重值;根据公式(4)确定一种值域权重值;Specifically, an airspace weight value that affects pixel data is determined according to the following formula (3); a range weight value is determined according to the formula (4);
Figure PCTCN2019077053-appb-000005
Figure PCTCN2019077053-appb-000005
Figure PCTCN2019077053-appb-000006
Figure PCTCN2019077053-appb-000006
其中,g s为空域上的滤波函数,f r为值域上的滤波函数,I(i,j)为目标像素数据的灰度值,(i,j)为目标像素数据的坐标,I(k,l)为影响像素数据的灰度值,(k,l)为影响像素数据的坐标,σ s为预设的空域光滑参数,σ r为预设的值域光滑参数。 Among them, g s is a filtering function in the spatial domain, f r is a filtering function in the value domain, I (i, j) is the gray value of the target pixel data, (i, j) is the coordinates of the target pixel data, and I ( k, l) is the gray value that affects the pixel data, (k, l) is the coordinate that affects the pixel data, σ s is a preset spatial smoothness parameter, and σ r is a preset range smooth parameter.
在具体的应用场景中,σ s和σ r通常为预设的参数,并且由操作人员根据具体的应用需要进行设置。 In a specific application scenario, σ s and σ r are usually preset parameters, and are set by an operator according to specific application needs.
步骤101、存储确定得到的空域权重表和值域权重表。Step 101: Store the determined airspace weight table and range weight table.
其中,存储确定得到的空域权重表的操作,可以包括:根据滤波窗口中影响像素数据的位置,在空域权重表中存储影响像素数据对应的空域权重值。The operation of storing the determined spatial weight table may include: storing the spatial weight value corresponding to the affected pixel data in the spatial weight table according to the position of the affected pixel data in the filtering window.
例如,以3*3的滤波窗口Ω为例,窗口Ω的半径为r=1,当以该滤波窗口对一个目标像素数据进行滤波时,该滤波窗口中包括(2r+1) 2=9个影响像素数据,可以对该滤波窗口中影响像素的位置进行标号,如图3所示;并根据滤波窗口中影响像素数据的位置,在空域权重表中存储影响像素数据对应空域权重值,如图4所示。在图3所示的滤波窗口中,位置标号为(1,1)的像素数据为目标像素数据,在滤波窗口Ω=3×3内的所有数据均为其影响像素数据,即如下图3所示的位置编号为(0,0)、(0,1)、(0,2)、(1,0)、(1,1)、(1,2)、(2,0)、(2,1)、(2,2)的像素数据。在图4所示的空域权重表中,索引为影响像素数据的 位置编号,每个位置编号对应一个空域权重值,包括g1~g9。 For example, taking a 3 * 3 filter window Ω as an example, the radius of the window Ω is r = 1, and when a target pixel data is filtered by the filter window, the filter window includes (2r + 1) 2 = 9 Affected pixel data can be labeled with the position of the affected pixel in the filter window, as shown in Figure 3; and according to the position of the affected pixel data in the filter window, the spatial weight value corresponding to the affected pixel data is stored in the spatial weight table, as shown in the figure. 4 shown. In the filter window shown in FIG. 3, the pixel data with the position number (1, 1) is the target pixel data, and all the data in the filter window Ω = 3 × 3 are the affected pixel data, that is, as shown in FIG. 3 below. The position numbers shown are (0,0), (0,1), (0,2), (1,0), (1,1), (1,2), (2,0), (2, 1), (2, 2) pixel data. In the airspace weight table shown in FIG. 4, the index is a position number that affects pixel data, and each position number corresponds to an airspace weight value, including g1 to g9.
其中,存储确定得到的值域权重表的操作,可以包括:按照0至N数值从小到大或者从大到小的顺序,在值域权重表中对应存储数值0至N对应的值域权重值;The operation of storing the determined range weight table may include: storing the range weight values corresponding to the values 0 to N in the range weight table in the order of the values from 0 to N in ascending or descending order. ;
在上述公式(4)中,在窗口Ω内变量包括平滑参数σ r、目标像素点的灰度值I(i,j)和影响像素点的灰度值I(k,l),其中预设的σ r不变,则变量仅包含|I(i,j)-I(k,l)|(即目标像素数据与影响像素数据的灰度值的差)。例如,对于灰度值数据的位宽为n=8bit的图像数据,I(i,j)∈[0,255],I(k,l)∈[0,255],因此|I(i,j)-I(k,l)|∈[0,255]。由于I(i,j)和I(k,l)都是图像I上某点的像素灰度值,因此取值为非负整数。此时,可将|I(i,j)-I(k,l)|作为索引,分别取值0、1、2、…、255,并将其对应的公式(4)的数值存储于LUT中,如图5所示,索引即为0~255,n0~n255分别代表|I(i,j)-I(k,l)|∈[0,255]时公式(4)的结果数值,也即值域权重值。 In the above formula (4), the variables in the window Ω include the smoothing parameter σ r , the gray value I (i, j) of the target pixel, and the gray value I (k, l) of the affected pixel, where the preset Σ r is constant, then the variable only contains | I (i, j) -I (k, l) | (that is, the difference between the target pixel data and the gray value of the affected pixel data). For example, for image data with a bit width of n = 8 bits of gray value data, I (i, j) ∈ [0,255], I (k, l) ∈ [0,255], so | I (i, j) -I (k, l) | ∈ [0,255]. Because I (i, j) and I (k, l) are the gray values of pixels at a point on the image I, the values are non-negative integers. At this time, | I (i, j) -I (k, l) | can be used as an index, and the values are 0, 1, 2, ..., 255, and the corresponding formula (4) is stored in the LUT In Figure 5, the index is 0 to 255, and n0 to n255 represent the value of formula (4) when | I (i, j) -I (k, l) | ∈ [0,255], that is, Range weight value.
根据上述存储空域权重表和值域权重表的操作,相对应地,上述步骤104中从存储的空域权重表中查找确定一个影响像素数据对应的空域权重值的操作,包括:According to the operations of storing the airspace weight table and the range weight table, correspondingly, the operation of finding and determining an airspace weight value corresponding to the pixel data from the stored airspace weight table in step 104 includes:
根据影响像素数据在滤波窗口中的位置,从存储的空域权重表中查找确定与该影响像素数据的位置对应的空域权重值。According to the position of the affected pixel data in the filtering window, a spatial weight value corresponding to the position of the affected pixel data is determined from the stored spatial weight table.
例如,如图3和图4所示,可以先确定影响像素数据在滤波窗口中的位置,并在空域权重表中查找该位置对应的空域权重值。For example, as shown in FIG. 3 and FIG. 4, the position of the affected pixel data in the filtering window may be determined first, and the spatial weight value corresponding to the position may be found in the spatial weight table.
上述步骤104中从存储的值域权重表中查找确定一个影响像素数据对应的值域权重值的操作,包括:The operation of searching for and determining an affected range weight value corresponding to pixel data from the stored range weight table in the above step 104 includes:
确定目标像素数据的灰度值与该影响像素数据的灰度值之间的差值,根据该差值数值在值域权重表中查找确定与该差值数值对应的值域权重值。A difference between the gray value of the target pixel data and the gray value of the affected pixel data is determined, and a range weight value corresponding to the difference value is searched and determined in the range weight table according to the difference value.
例如,在确定了目标像素数据的灰度值和一个影响像素数据的灰度值之间的差值后,以该差值的数值为索引,在如图5所示的值域权重表中,查找到该差值数值对应的值域权重值。For example, after determining the difference between the gray value of the target pixel data and a gray value that affects the pixel data, use the value of the difference as an index. In the range weight table shown in FIG. 5, Find the range weight value corresponding to the difference value.
通过上述处理可以查找到影响像素的空域权重值和值域权重值。Through the above processing, the spatial weight value and range weight value of the affected pixels can be found.
在上述步骤106中,使用双边滤波器对该目标像素数据进行滤波,包括:In the above step 106, using a bilateral filter to filter the target pixel data includes:
根据下列公式(1)和公式(2)对目标像素数据进行滤波:Filter the target pixel data according to the following formula (1) and formula (2):
Figure PCTCN2019077053-appb-000007
Figure PCTCN2019077053-appb-000007
Figure PCTCN2019077053-appb-000008
Figure PCTCN2019077053-appb-000008
其中,Ι'为双边滤波后的图像像素数据,I为滤波器的输入图像像素数据,I(i,j)为目标像素数据的灰度值,(i,j)表示目标像素数据点的坐标,Ω为滤波窗口内包含的所有像素 数据点的集合,I(k,l)为滤波窗口Ω内的一个影响像素数据,(k,l)为影响像素数据的坐标;g s为空域上的滤波函数,f r为值域上的滤波函数;K为权重。 Among them, I ′ is the image pixel data after bilateral filtering, I is the input image pixel data of the filter, I (i, j) is the gray value of the target pixel data, and (i, j) represents the coordinates of the target pixel data point , Ω is the set of all pixel data points contained in the filter window, I (k, l) is an influential pixel data in the filter window Ω, (k, l) is the coordinate that affects the pixel data; g s is in the spatial domain Filter function, f r is the filter function on the value range; K is the weight.
在上述步骤104中已经查找得到g s的值和f r的值,将查找得到的值代入到上述公式(1)和(2)中,计算得到滤波后的像素数据。 In the above step 104, the value of g s and the value of f r have been found, and the searched value is substituted into the above formulas (1) and (2), and the filtered pixel data is calculated and obtained.
以上描述了对像素数据进行双边滤波的处理。The process of bilateral filtering the pixel data has been described above.
在上述实施例中,空域光滑参数σ s、值域光滑参数σ r、滤波窗口半径r和灰度值数据位宽n是预设的、且固定不变的。在另一些实施例中,根据应用场景的需要,允许对空域光滑参数σ s、值域光滑参数σ r、滤波窗口半径r和灰度值数据位宽n中的任意一个参数进行修改和更新,则图1所示的处理需要根据更新后的参数更新空域权重表和值域权重表。 In the above embodiment, the spatial smoothing parameter σ s , the range smoothing parameter σ r , the filtering window radius r, and the gray value data bit width n are preset and fixed. In other embodiments, according to the needs of the application scenario, it is allowed to modify and update any one of the parameters of the spatial smoothing parameter σ s , the range smoothing parameter σ r , the filtering window radius r, and the gray value data bit width n. Then, the process shown in FIG. 1 needs to update the airspace weight table and the range weight table according to the updated parameters.
图6中示出了对空域权重表和值域权重表进行更新的处理流程,该处理在图1所示处理流程之前,包括:FIG. 6 shows a processing flow for updating the airspace weight table and the range weight table. The processing before the processing flow shown in FIG. 1 includes:
步骤100’、在接收后续图像数据的过程中,在接收图像数据的帧消隐期,检测双边滤波器的空域光滑参数、值域光滑参数、滤波窗口尺寸和灰度值数据位宽中的任意一个参数是否有更新;Step 100 ': In the process of receiving subsequent image data, during the frame blanking period of the received image data, detect any of the spatial smoothing parameters, range smoothing parameters, filter window size, and gray value data bit width of the bilateral filter. Whether a parameter has been updated;
步骤101’、在确定参数没有更新的情况下,接收图像数据中的有效数据,处理进行到步骤102;Step 101 ': When it is determined that the parameters are not updated, valid data in the image data is received, and the process proceeds to step 102;
步骤102’、在确定参数有更新的情况下,根据更新后的空域光滑参数、值域光滑参数、滤波窗口尺寸和灰度值数据位宽,确定空域权重表中包括的空域权重值、和/或值域权重表中包括的值域权重值;存储更新后的空域权重表和/或值域权重表;并接收图像数据中的有效数据,处理进行到步骤102。Step 102 ': When it is determined that the parameters are updated, determine the airspace weight values included in the airspace weight table according to the updated airspace smoothing parameters, range smoothing parameters, filter window size, and gray value data bit width, and / The range weight value included in the OR range weight table; stores the updated airspace weight table and / or range weight table; and receives valid data in the image data, and the process proceeds to step 102.
确定空域权重表中包括的空域权重值和确定值域权重表中包括的值域权重值的处理如上所述,这边不再赘述。The process of determining the airspace weight value included in the airspace weight table and determining the range weight value included in the range weight table is as described above, and is not repeated here.
通过如图6所示的处理过程,能够根据更新后的参数对空域权重表和值域权重表进行更新,进一步结合图1所示的处理,能够根据更新后的空域权重表和值域权重表来对像素数据进行滤波处理。Through the process shown in FIG. 6, the airspace weight table and the range weight table can be updated according to the updated parameters. Further combined with the processing shown in FIG. 1, the airspace weight table and the range weight table can be updated according to the processing shown in FIG. 1. To filter the pixel data.
根据本申请实施例提供的方法,在FPGA接收到来自图像传感器的图像数据的过程中,对接收到的像素数据,确定该像素数据所在滤波窗口中的全部像素数据为影响像素数据,从存储的空域权重表中查找确定每个影响像素对应的空域权重值,从存储的值域权重表中查找确定每个影响像素对应的值域权重值,根据查找到的全部影响像素的空域权重值和值域权重值,使用双边滤波器对该目标像素进行滤波,得到滤波后的像素;其中将复杂的空域权重计算和值域权重计算,由实时计算改为查表操作,查表操作的速度大大快于实时计算的速度,能够加快图像双边滤波的处理速度,提高处理的实时性,从而能够解决现有技 术中在FPGA上使用双边滤波算法对图像数据进行滤波处理,无法满足实时性要求的问题。According to the method provided in the embodiment of the present application, during the process of receiving image data from the image sensor by the FPGA, for the received pixel data, it is determined that all the pixel data in the filtering window where the pixel data is located is affected pixel data. Look up the airspace weight table to determine the airspace weight value corresponding to each influencing pixel, look up and determine the value range weight value corresponding to each influencing pixel from the stored value range weight table, and according to the airspace weight values and values of all the influencing pixels found Domain weight value, the bilateral target filter is used to filter the target pixel to obtain the filtered pixel; among them, the complex spatial weight calculation and range weight calculation are changed from real-time calculation to table lookup operation, and the speed of table lookup operation is much faster The speed of real-time calculation can speed up the processing speed of bilateral filtering of the image and improve the real-time performance of the processing, so that it can solve the problem of using the bilateral filtering algorithm on the FPGA to filter the image data in the prior art, which cannot meet the real-time requirements.
基于相同的发明构思,本申请实施例还提供了一种在FPGA中实现图像双边滤波的装置。Based on the same inventive concept, an embodiment of the present application further provides a device for implementing bilateral filtering of an image in an FPGA.
图7中示出了本申请实施例提供的在FPGA中实现图像双边滤波的装置的结构,该装置包括:FIG. 7 shows a structure of an apparatus for implementing bilateral filtering of an image in an FPGA provided by an embodiment of the present application. The apparatus includes:
接收单元71,用于接收来自图像传感器的图像数据;A receiving unit 71, configured to receive image data from an image sensor;
查找单元72,用于在接收单元71接收到图像数据中的有效数据后,将接收到的一个像素数据确定为目标像素数据,确定该目标像素数据所在滤波窗口中的全部像素数据为影响像素数据;依次从存储的空域权重表中查找确定每个影响像素数据对应的空域权重值,从存储的值域权重表中查找确定每个影响像素数据对应的值域权重值;The searching unit 72 is configured to determine, after the receiving unit 71 receives valid data in the image data, one pixel data received as the target pixel data, and determine that all the pixel data in the filtering window where the target pixel data is located is the affected pixel data. ; Search and determine the spatial weight value corresponding to each affected pixel data in turn from the stored spatial weight table, and find and determine the corresponding domain weight value from each stored pixel weight table from the stored range weight table;
滤波单元73,用于根据查找到的该目标像素数据的全部影响像素数据的空域权重值和值域权重值,使用双边滤波器对该目标像素数据进行滤波,得到滤波后的像素数据。The filtering unit 73 is configured to filter the target pixel data by using a bilateral filter to obtain the filtered pixel data according to the spatial weight value and the range weight value of all the affected pixel data of the found target pixel data.
在一些实施例中,如图8所示,图7所示的装置还可以进一步包括确定单元70。In some embodiments, as shown in FIG. 8, the apparatus shown in FIG. 7 may further include a determining unit 70.
确定单元70,用于在接收单元接收第一帧图像数据的过程中,在第一帧图像数据的帧消隐期,根据预设的空域光滑参数σ s、值域光滑参数σ r、滤波窗口半径r和灰度值数据位宽n,确定空域权重表中包括的空域权重值、和值域权重表中包括的值域权重值;存储确定得到的空域权重表和值域权重表; A determining unit 70 is configured to: during the process of receiving the first frame of image data by the receiving unit, during the frame blanking period of the first frame of image data, according to a preset spatial smoothing parameter σ s , a range smoothing parameter σ r , and a filtering window The radius r and the bit width n of the gray value data determine the airspace weight value included in the airspace weight table and the value of the range weight included in the value range weight table; the determined airspace weight table and range weight table are stored;
其中,空域权重表中包括M个空域权重值,一个空域权重值是目标像素数据在滤波窗口中的一个影响像素数据对目标像素数据的空域邻近权重,滤波窗口中包括M个影响像素数据,M=(2r+1) 2,r为窗口Ω的窗口半径;值域权重表中包括N个值域权重值,一个值域权重值是一种影响像素数据对目标像素数据的值域邻近权重,N=2 n,n为灰度值数据位宽。 Among them, the airspace weight table includes M airspace weight values. One airspace weight value is an airspace neighboring weight of the target pixel data in the filter window that affects the pixel data to the target pixel data. The filter window includes M influence pixel data, M = (2r + 1) 2 , r is the window radius of the window Ω; the range weight table includes N range weight values. A range weight value is a range weight that affects pixel data to target pixel data. N = 2 n , n is the gray-scale data bit width.
在一些实施例中,确定单元70存储确定得到的空域权重表,包括:根据滤波窗口中影响像素数据的位置顺序,在空域权重表中存储影响像素数据对应的空域权重值;In some embodiments, the determining unit 70 stores the determined spatial weight table, which includes: storing the spatial weight values corresponding to the affected pixel data in the spatial weight table according to the position order of the affected pixel data in the filtering window;
则,查找单元72从存储的空域权重表中查找确定一个影响像素数据对应的空域权重值,包括:根据影响像素数据在滤波窗口中的位置,从存储的空域权重表中查找确定与该影响像素数据的位置对应的空域权重值。Then, the searching unit 72 searches and determines an airspace weight value corresponding to the affected pixel data from the stored airspace weight table, including: according to the position of the affected pixel data in the filtering window, searching and determining from the stored airspace weight table to determine the affected pixel. The spatial weight value corresponding to the position of the data.
在一些实施例中,确定单元存储确定得到的值域权重表,包括:按照0至N数值从小到大或者从大到小的顺序,在值域权重表中对应存储数值0至N对应的值域邻近权重值;In some embodiments, the determining unit stores the determined range weight table, which includes: storing values corresponding to the values 0 to N in the range weight table according to the order from 0 to N values from small to large or from large to small. Domain proximity weight value;
则,查找单元72从存储的值域权重表中查找确定一个影响影响像素数据对应的值域权重值,包括:确定目标像素数据的灰度值与该影响像素数据的灰度值之间的差值,根据该差值数值在值域权重表中查找确定与该差值数值对应的值域权重值。Then, the searching unit 72 searches and determines from the stored range weight table a range weight value corresponding to the affected pixel data, including: determining a difference between a gray value of the target pixel data and a gray value of the affected pixel data. Value, according to the difference value, look up in the range weight table to determine the range weight value corresponding to the difference value.
进一步地,在一些实施例中,确定单元70还用于:在接收单元71接收后续图像数据的过程中,在接收图像数据的帧消隐期,检测双边滤波器的空域光滑参数、值域光滑参数、滤波窗口尺寸和灰度值数据位宽中的任意一个参数是否有更新;在确定参数没有更新的情况下,接收图像数据中的有效数据;在确定参数有更新的情况下,根据更新后的空域光滑参数、值域光滑参数、滤波窗口尺寸和灰度值数据位宽,确定空域权重表中包括的空域权重值、和/或值域权重表中包括的值域权重值;存储更新后的空域权重表和/或值域权重表;并接收图像数据中的有效数据。Further, in some embodiments, the determining unit 70 is further configured to: in the process of receiving the subsequent image data by the receiving unit 71, during the frame blanking period of the received image data, detect the spatial smoothness parameters and smooth value range of the bilateral filter Whether any one of the parameters, filter window size and gray value data bit width is updated; if it is determined that the parameter is not updated, valid data in the image data is received; if it is determined that the parameter is updated, according to the update The airspace smoothing parameter, range smoothing parameter, filter window size, and gray value data bit width, determine the airspace weight values included in the airspace weight table, and / or the range weight values included in the range weight table; after the update is stored, The airspace weight table and / or range weight table; and receive valid data from the image data.
在一些实施例中,确定单元确定空域权重表中包括的空域权重值,确定值域权重表中包括的值域权重值,包括:In some embodiments, the determining unit determines an airspace weight value included in the airspace weight table, and determines a range weight value included in the range weight table, including:
根据公式
Figure PCTCN2019077053-appb-000009
确定一个影响像素数据的空域权重值;
According to formula
Figure PCTCN2019077053-appb-000009
Determine a spatial weight value that affects pixel data;
根据公式
Figure PCTCN2019077053-appb-000010
确定一种值域权重值;
According to formula
Figure PCTCN2019077053-appb-000010
Determine a range weight value;
其中,g s为空域上的滤波函数,f r为值域上的滤波函数,I(i,j)为目标像素数据的灰度值,(i,j)为目标像素数据的坐标,I(k,l)为影响像素数据的灰度值,(k,l)为影响像素数据的坐标,σ s为空域光滑参数,σ r为值域光滑参数。 Among them, g s is a filtering function in the spatial domain, f r is a filtering function in the value domain, I (i, j) is the gray value of the target pixel data, (i, j) is the coordinates of the target pixel data, and I ( k, l) is the gray value that affects the pixel data, (k, l) is the coordinate that affects the pixel data, σ s is the spatial smoothing parameter, and σ r is the smoothing parameter of the range.
在一些实施例中,滤波单元73使用双边滤波器对该目标像素数据进行滤波,包括:根据下列公式对目标像素数据进行滤波,
Figure PCTCN2019077053-appb-000011
其中,
Figure PCTCN2019077053-appb-000012
Ι′为双边滤波后的图像像素数据,I为滤波器的输入图像像素数据,I(i,j)为目标像素数据的灰度值,(i,j)表示目标像素数据点的坐标,Ω为滤波窗口内包含的所有像素数据点的集合,I(k,l)为滤波窗口Ω内的一个影响像素数据的灰度值,(k,l)为影响像素数据的坐标;g s为空域上的滤波函数,f r为值域上的滤波函数;K为权重。
In some embodiments, the filtering unit 73 uses a bilateral filter to filter the target pixel data, including: filtering the target pixel data according to the following formula,
Figure PCTCN2019077053-appb-000011
among them,
Figure PCTCN2019077053-appb-000012
I ′ is the image pixel data after bilateral filtering, I is the input image pixel data of the filter, I (i, j) is the gray value of the target pixel data, (i, j) represents the coordinates of the target pixel data point, Ω Is the set of all pixel data points contained in the filter window, I (k, l) is a gray value that affects the pixel data in the filter window Ω, (k, l) is the coordinates that affect the pixel data; g s is the spatial domain Filter function, f r is the filter function on the value range; K is the weight.
在具体的应用场景中,如图7或8所示的装置可以被封装为一个IP核,通过对IP核的调用,实现如图1或图2所示的方法。In a specific application scenario, the device shown in FIG. 7 or 8 can be encapsulated into an IP core, and the method shown in FIG. 1 or FIG. 2 is implemented by calling the IP core.
基于相同的发明构思,本申请实施例还提供了一种计算机程序,该计算机程序具有被配置用于执行图像双边滤波处理的代码段,其中图像双边滤波处理可以是如图1或图2所示的处理。Based on the same inventive concept, an embodiment of the present application further provides a computer program having a code segment configured to perform an image bilateral filtering process, where the image bilateral filtering process may be as shown in FIG. 1 or FIG. 2 Processing.
基于相同的发明构思,本申请实施例还提供了一种FPGA。在一些实施例中,该FPGA 中包括如图7或图8所示的装置。在另一些实施例中,该FPGA中还可以包括如上所述的计算机程序。本申请实施例提供的FPGA能够加快图像双边滤波的处理速度,提高处理的实时性。Based on the same inventive concept, an embodiment of the present application further provides an FPGA. In some embodiments, the FPGA includes a device as shown in FIG. 7 or FIG. 8. In other embodiments, the FPGA may further include a computer program as described above. The FPGA provided in the embodiment of the present application can speed up the processing speed of bilateral filtering of an image and improve the real-time performance of processing.
基于相同的发明构思,本申请实施例还提供了一种成像设备。该成像设备包括图像传感器和如上所述的FPGA。本申请实施例提供的成像设备能够加快图像双边滤波的处理速度,提高处理的实时性。本申请实施例提供的成像设备可以是摄像头等具体的设备。Based on the same inventive concept, an embodiment of the present application further provides an imaging device. The imaging device includes an image sensor and an FPGA as described above. The imaging device provided in the embodiment of the present application can speed up the processing speed of bilateral filtering of an image and improve the real-time performance of processing. The imaging device provided in the embodiment of the present application may be a specific device such as a camera.
综上,根据本申请实施例提供的技术方案,在FPGA接收到来自图像传感器的图像数据的过程中,对接收到的像素数据,确定该像素数据所在滤波窗口中的全部像素数据为影响像素数据,从存储的空域权重表中查找确定每个影响像素对应的空域权重值,从存储的值域权重表中查找确定每个影响像素对应的值域权重值,根据查找到的全部影响像素的空域权重值和值域权重值,使用双边滤波器对该目标像素进行滤波,得到滤波后的像素;其中将复杂的空域权重计算和值域权重计算,由实时计算改为查表操作,查表操作的速度大大快于实时计算的速度,能够加快图像双边滤波的处理速度,提高处理的实时性,从而能够解决现有技术中在FPGA上使用双边滤波算法对图像数据进行滤波处理,无法满足实时性要求的问题。In summary, according to the technical solution provided in the embodiment of the present application, during the process of receiving image data from the image sensor by the FPGA, for the received pixel data, it is determined that all the pixel data in the filtering window where the pixel data is located is the affected pixel data , From the stored airspace weight table to find and determine the corresponding airspace weight value of each affected pixel, from the stored value domain weight table to find and determine the value of the corresponding domain weight value of each affected pixel, according to the found all affected pixels of the airspace Weight value and range weight value. The target pixel is filtered by using a bilateral filter to obtain filtered pixels. The complex spatial weight calculation and range weight calculation are changed from real-time calculation to table lookup operation and table lookup operation. The speed is much faster than the real-time calculation speed, which can speed up the processing speed of bilateral filtering of the image and improve the real-time performance of the processing, which can solve the problem of filtering the image data by using the bilateral filtering algorithm on the FPGA in the prior art. Asked questions.
以上结合具体实施例描述了本发明的基本原理,但是,需要指出的是,对本领域普通技术人员而言,能够理解本发明的方法和装置的全部或者任何步骤或者部件可以在任何计算装置(包括处理器、存储介质等)或者计算装置的网络中,以硬件固件、软件或者他们的组合加以实现,这是本领域普通技术人员在阅读了本发明的说明的情况下运用它们的基本编程技能就能实现的。The basic principles of the present invention have been described above in conjunction with specific embodiments. However, it should be pointed out that those skilled in the art can understand all or any steps or components of the methods and devices of the present invention on any computing device (including Processors, storage media, etc.) or computing devices in a network, implemented with hardware firmware, software, or a combination of them. This is how a person of ordinary skill in the art would use their basic programming skills after reading the description of the present invention. Achievable.
本领域普通技术人员可以理解实现上述实施例方法携带的全部或部分步骤是可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,该程序在执行时,包括方法实施例的步骤之一或其组合。A person of ordinary skill in the art may understand that all or part of the steps carried by the methods in the foregoing embodiments may be implemented by a program instructing related hardware. The program may be stored in a computer-readable storage medium. When the program is executed, Including one or a combination of steps of a method embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理模块中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing module, or each unit may exist separately physically, or two or more units may be integrated into one module. The above integrated modules may be implemented in the form of hardware or software functional modules. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形 式。Those skilled in the art should understand that the embodiments of the present invention may be provided as a method, a system, or a computer program product. Therefore, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, magnetic disk memory, optical memory, etc.) containing computer-usable program code therein.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, and combinations of processes and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, so that the instructions generated by the processor of the computer or other programmable data processing device are used to generate instructions Means for implementing the functions specified in one or more flowcharts and / or one or more blocks of the block diagrams.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to work in a particular manner such that the instructions stored in the computer-readable memory produce a manufactured article including an instruction device, the instructions The device implements the functions specified in one or more flowcharts and / or one or more blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing device, so that a series of steps can be performed on the computer or other programmable device to produce a computer-implemented process, which can be executed on the computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more flowcharts and / or one or more blocks of the block diagrams.
尽管已描述了本发明的上述实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括上述实施例以及落入本发明范围的所有变更和修改。Although the above embodiments of the present invention have been described, those skilled in the art can make other changes and modifications to these embodiments once they know the basic inventive concepts. Therefore, the appended claims are intended to be construed to include the embodiments described above and all changes and modifications that fall within the scope of the invention.
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. In this way, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention also intends to include these modifications and variations.

Claims (18)

  1. 一种在FPGA中实现图像双边滤波的方法,其特征在于,包括:A method for implementing bilateral filtering of an image in an FPGA is characterized in that it includes:
    在FPGA接收来自图像传感器的图像数据的过程中,在接收到图像数据中的有效数据后,将接收到的一个像素数据确定为目标像素数据,确定该目标像素数据所在滤波窗口中的全部像素数据为影响像素数据;In the process of FPGA receiving image data from the image sensor, after receiving valid data in the image data, the received pixel data is determined as the target pixel data, and all the pixel data in the filtering window where the target pixel data is located is determined. To affect pixel data;
    依次从存储的空域权重表中查找确定每个影响像素数据对应的空域权重值,从存储的值域权重表中查找确定每个影响像素数据对应的值域权重值;Look up and determine the spatial weight value corresponding to each affected pixel data from the stored spatial weight table in turn, and look up and determine the corresponding domain weight value from the stored value domain weight table;
    根据查找到的该目标像素数据的全部影响像素数据的空域权重值和值域权重值,使用双边滤波器对该目标像素数据进行滤波,得到滤波后的像素数据。The target pixel data is filtered by using a bilateral filter to obtain the filtered pixel data according to all the found spatial weight values and range weight values of the affected pixel data.
  2. 根据权利要求1所述的方法,其特征在于,还包括:The method according to claim 1, further comprising:
    在FPGA接收第一帧图像数据的过程中,在第一帧图像数据的帧消隐期,根据预设的空域光滑参数σ s、值域光滑参数σ r、滤波窗口半径r和灰度值数据位宽n,确定空域权重表中包括的空域权重值、和值域权重表中包括的值域权重值;存储确定得到的空域权重表和值域权重表; During the FPGA receiving the first frame of image data, during the frame blanking period of the first frame of image data, according to the preset spatial smoothing parameter σ s , range smoothing parameter σ r , filtering window radius r, and gray value data The bit width n determines the airspace weight value included in the airspace weight table and the range weight value included in the range weight table; stores the determined airspace weight table and range weight table;
    其中,空域权重表中包括M个空域权重值,一个空域权重值是目标像素数据在滤波窗口中的一个影响像素数据对目标像素数据的空域邻近权重,滤波窗口中包括M个影响像素数据,M=(2r+1) 2,r为滤波窗口Ω的窗口半径;值域权重表中包括N个值域权重值,一个值域权重值是一种影响像素数据对目标像素数据的值域邻近权重,N=2 n,n为灰度值数据位宽。 Among them, the airspace weight table includes M airspace weight values. One airspace weight value is an airspace neighboring weight of the target pixel data in the filter window that affects the pixel data to the target pixel data. The filter window includes M influence pixel data, M = (2r + 1) 2 , r is the window radius of the filtering window Ω; the range weight table includes N range weight values, and a range weight value is a range weight that affects pixel data to target pixel data. , N = 2 n , n is the bit width of the gray value data.
  3. 根据权利要求2所述的方法,其特征在于,存储确定得到的空域权重表,包括:The method according to claim 2, wherein storing the determined airspace weight table comprises:
    根据滤波窗口中影响像素数据的位置顺序,在空域权重表中存储影响像素数据对应的空域权重值;则,According to the position order of the affected pixel data in the filtering window, the spatial weight value corresponding to the affected pixel data is stored in the spatial weight table; then,
    从存储的空域权重表中查找确定一个影响像素数据对应的空域权重值,包括:Look up and determine an airspace weight value corresponding to the affected pixel data from the stored airspace weight table, including:
    根据影响像素数据在滤波窗口中的位置,从存储的空域权重表中查找确定与该影响像素数据的位置对应的空域权重值。According to the position of the affected pixel data in the filtering window, a spatial weight value corresponding to the position of the affected pixel data is determined from the stored spatial weight table.
  4. 根据权利要求2所述的方法,其特征在于,存储确定得到的值域权重表,包括:The method according to claim 2, wherein storing the determined range weight table comprises:
    按照0至N数值从小到大或者从大到小的顺序,在值域权重表中对应存储数值0至N对应的值域邻近权重值;则,According to the order from 0 to N values from small to large or from big to small, the range weights corresponding to the values 0 to N are correspondingly stored in the range weight table; then,
    从存储的值域权重表中查找确定一个影响像素数据对应的值域权重值,包括:Look up and determine a range weight value corresponding to the affected pixel data from the stored range weight table, including:
    确定目标像素数据的灰度值与该影响像素数据的灰度值之间的差值,根据该差值数值在值域权重表中查找确定与该差值数值对应的值域权重值。A difference between the gray value of the target pixel data and the gray value of the affected pixel data is determined, and a range weight value corresponding to the difference value is searched and determined in the range weight table according to the difference value.
  5. 根据权利要求2所述的方法,其特征在于,还包括:The method according to claim 2, further comprising:
    在接收后续图像数据的过程中,在接收图像数据的帧消隐期,检测双边滤波器的空域光滑参数、值域光滑参数、滤波窗口尺寸和灰度值数据位宽中的任意一个参数是否有更新;In the process of receiving subsequent image data, during the frame blanking period of the received image data, it is detected whether any one of the parameters of the spatial smoothing parameter, the range smoothing parameter, the filtering window size, and the gray value data bit width of the bilateral filter is present. Update
    在确定参数没有更新的情况下,接收图像数据中的有效数据;Receive valid data in image data if it is determined that the parameters have not been updated;
    在确定参数有更新的情况下,根据更新后的空域光滑参数、值域光滑参数、滤波窗口尺寸和灰度值数据位宽,确定空域权重表中包括的空域权重值、和/或值域权重表中包括的值域权重值;存储更新后的空域权重表和/或值域权重表;并接收图像数据中的有效数据。When it is determined that the parameters are updated, the airspace weight values and / or range weights included in the airspace weight table are determined according to the updated airspace smoothing parameters, range smoothing parameters, filter window size, and gray value data bit width. The range weight values included in the table; store the updated airspace weight table and / or range weight table; and receive valid data in the image data.
  6. 根据权利要求2或5所述的方法,其特征在于,确定空域权重表中包括的空域权重值,确定值域权重表中包括的值域权重值,包括:The method according to claim 2 or 5, wherein determining an airspace weight value included in the airspace weight table, and determining a range weight value included in the range weight table includes:
    根据公式
    Figure PCTCN2019077053-appb-100001
    确定一个影响像素数据的空域权重值;
    According to formula
    Figure PCTCN2019077053-appb-100001
    Determine a spatial weight value that affects pixel data;
    根据公式
    Figure PCTCN2019077053-appb-100002
    确定一种值域权重值;
    According to formula
    Figure PCTCN2019077053-appb-100002
    Determine a range weight value;
    其中,g s为空域上的滤波函数,f r为值域上的滤波函数,I(i,j)为目标像素数据的灰度值,(i,j)为目标像素数据的坐标,I(k,l)为影响像素数据的灰度值,(k,l)为影响像素数据的坐标,σ s为空域光滑参数,σ r为值域光滑参数。 Among them, g s is a filtering function in the spatial domain, f r is a filtering function in the value domain, I (i, j) is the gray value of the target pixel data, (i, j) is the coordinates of the target pixel data, and I ( k, l) is the gray value that affects the pixel data, (k, l) is the coordinate that affects the pixel data, σ s is the spatial smoothing parameter, and σ r is the smoothing parameter of the range.
  7. 根据权利要求1所述的方法,其特征在于,使用双边滤波器对该目标像素数据进行滤波,包括:The method according to claim 1, wherein filtering the target pixel data by using a bilateral filter comprises:
    根据下列公式对目标像素数据进行滤波,
    Figure PCTCN2019077053-appb-100003
    其中,
    Figure PCTCN2019077053-appb-100004
    Ι′为双边滤波后的图像像素数据,I为滤波器的输入图像像素数据,I(i,j)为目标像素数据的灰度值,(i,j)表示目标像素数据点的坐标,Ω为滤波窗口内包含的所有像素数据点的集合,I(k,l)为滤波窗口Ω内的一个影响像素数据的灰度值,(k,l)为影响像素数据的坐标;g s为空域上的滤波函数,f r为值域上的滤波函数;K为权重。
    Filter the target pixel data according to the following formula,
    Figure PCTCN2019077053-appb-100003
    among them,
    Figure PCTCN2019077053-appb-100004
    I ′ is the image pixel data after bilateral filtering, I is the input image pixel data of the filter, I (i, j) is the gray value of the target pixel data, (i, j) represents the coordinates of the target pixel data point, Ω Is the set of all pixel data points contained in the filter window, I (k, l) is a gray value that affects the pixel data in the filter window Ω, (k, l) is the coordinates that affect the pixel data; g s is the spatial domain Filter function, f r is the filter function on the value range; K is the weight.
  8. 根据权利要求1所示的方法,其特征在于,空域权重表和值域权重表保存为显示查找表。The method according to claim 1, wherein the airspace weight table and the range weight table are stored as a display lookup table.
  9. 一种在FPGA中实现图像双边滤波的装置,其特征在于,包括:A device for implementing bilateral filtering of an image in an FPGA is characterized in that it includes:
    接收单元,用于接收图像数据;A receiving unit for receiving image data;
    查找单元,用于在接收单元接收到图像数据中的有效数据后,将接收到的一个像素数据确定为目标像素数据,确定该目标像素数据所在滤波窗口中的全部像素数据为影响像素 数据;依次从存储的空域权重表中查找确定每个影响像素数据对应的空域权重值,从存储的值域权重表中查找确定每个影响像素数据对应的值域权重值;The searching unit is configured to determine, after receiving the valid data in the image data, the received pixel data as target pixel data, and determine that all the pixel data in the filtering window where the target pixel data is located is the affected pixel data; Look up and determine the airspace weight value corresponding to each affected pixel data from the stored airspace weight table, and find and determine the value of the domain weight corresponding to each affected pixel data from the stored value domain weight table;
    滤波单元,用于根据查找到的该目标像素数据的全部影响像素数据的空域权重值和值域权重值,使用双边滤波器对该目标像素数据进行滤波,得到滤波后的像素数据。The filtering unit is configured to filter the target pixel data by using a bilateral filter according to the spatial weight value and the range weight value of all the affected pixel data of the found target pixel data, to obtain filtered pixel data.
  10. 根据权利要求9所述的装置,其特征在于,所述装置还包括:The apparatus according to claim 9, further comprising:
    确定单元,用于在接收单元接收第一帧图像数据的过程中,在第一帧图像数据的帧消隐期,根据预设的空域光滑参数σ s、值域光滑参数σ r、滤波窗口半径r和灰度值数据位宽n,确定空域权重表中包括的空域权重值、和值域权重表中包括的值域权重值;存储确定得到的空域权重表和值域权重表; A determining unit, configured to: during the receiving of the first frame of image data by the receiving unit, during the frame blanking period of the first frame of image data, according to a preset spatial smoothing parameter σ s , a range smoothing parameter σ r , and a filtering window radius r and gray value data bit width n, determine the airspace weight value included in the airspace weight table, and the range weight value included in the range weight table; store the determined airspace weight table and range weight table;
    其中,空域权重表中包括M个空域权重值,一个空域权重值是目标像素数据在滤波窗口中的一个影响像素数据对目标像素数据的空域邻近权重,滤波窗口中包括M个影响像素数据,M=(2r+1) 2,r为滤波窗口Ω的窗口半径;值域权重表中包括N个值域权重值,一个值域权重值是一种影响像素数据对目标像素数据的值域邻近权重,N=2 n,n为灰度值数据位宽。 Among them, the airspace weight table includes M airspace weight values. One airspace weight value is an airspace neighboring weight of the target pixel data in the filter window that affects the pixel data to the target pixel data. The filter window includes M influence pixel data, M = (2r + 1) 2 , r is the window radius of the filtering window Ω; the range weight table includes N range weight values, and a range weight value is a range weight that affects pixel data to target pixel data. , N = 2 n , n is the bit width of the gray value data.
  11. 根据权利要求10所述的装置,其特征在于,确定单元存储确定得到的空域权重表,包括:The apparatus according to claim 10, wherein the determining unit stores the determined airspace weight table, comprising:
    根据滤波窗口中影响像素数据的位置顺序,在空域权重表中存储影响像素数据对应的空域权重值;则,According to the position order of the affected pixel data in the filtering window, the spatial weight value corresponding to the affected pixel data is stored in the spatial weight table; then,
    查找单元从存储的空域权重表中查找确定一个影响像素数据对应的空域权重值,包括:The search unit determines from the stored airspace weight table an airspace weight value corresponding to the affected pixel data, including:
    根据影响像素数据在滤波窗口中的位置,从存储的空域权重表中查找确定与该影响像素数据的位置对应的空域权重值。According to the position of the affected pixel data in the filtering window, a spatial weight value corresponding to the position of the affected pixel data is determined from the stored spatial weight table.
  12. 根据权利要求10所述的装置,其特征在于,确定单元存储确定得到的值域权重表,包括:The apparatus according to claim 10, wherein the determining unit stores the determined range weight table, comprising:
    按照0至N数值从小到大或者从大到小的顺序,在值域权重表中对应存储数值0至N对应的值域邻近权重值;则,According to the order from 0 to N values from small to large or from big to small, the range weights corresponding to the values 0 to N are correspondingly stored in the range weight table; then,
    查找单元从存储的值域权重表中查找确定一个影响像素数据对应的值域权重值,包括:The search unit searches the stored range weight table to determine a range weight value corresponding to the affected pixel data, including:
    确定目标像素数据的灰度值与该影响像素数据的灰度值之间的差值,根据该差值数值在值域权重表中查找确定与该差值数值对应的值域权重值。A difference between the gray value of the target pixel data and the gray value of the affected pixel data is determined, and a range weight value corresponding to the difference value is searched and determined in the range weight table according to the difference value.
  13. 根据权利要求10所述的装置,其特征在于,确定单元还用于:The apparatus according to claim 10, wherein the determining unit is further configured to:
    在接收单元接收后续图像数据的过程中,在接收图像数据的帧消隐期,检测双边滤波器的空域光滑参数、值域光滑参数、滤波窗口尺寸和灰度值数据位宽中的任意一个参数是否有更新;During the process of receiving the subsequent image data by the receiving unit, during the frame blanking period of the received image data, any one of the parameters of the spatial smoothing parameter, the range smoothing parameter, the filtering window size and the gray value data width of the bilateral filter is detected Whether there is an update;
    在确定参数没有更新的情况下,接收图像数据中的有效数据;Receive valid data in image data if it is determined that the parameters have not been updated;
    在确定参数有更新的情况下,根据更新后的空域光滑参数、值域光滑参数、滤波窗口尺寸和灰度值数据位宽,确定空域权重表中包括的空域权重值、和/或值域权重表中包括的值域权重值;存储更新后的空域权重表和/或值域权重表;并接收图像数据中的有效数据。When it is determined that the parameters are updated, the airspace weight values and / or range weights included in the airspace weight table are determined according to the updated airspace smoothing parameters, range smoothing parameters, filter window size, and gray value data bit width. The range weight values included in the table; store the updated airspace weight table and / or range weight table; and receive valid data in the image data.
  14. 根据权利要求10或者13所述的装置,其特征在于,确定单元确定空域权重表中包括的空域权重值,确定值域权重表中包括的值域权重值,包括:The apparatus according to claim 10 or 13, wherein the determining unit determines an airspace weight value included in the airspace weight table, and determines a range weight value included in the range weight table, comprising:
    根据公式
    Figure PCTCN2019077053-appb-100005
    确定一个影响像素数据的空域权重值;
    According to formula
    Figure PCTCN2019077053-appb-100005
    Determine a spatial weight value that affects pixel data;
    根据公式
    Figure PCTCN2019077053-appb-100006
    确定一种值域权重值;
    According to formula
    Figure PCTCN2019077053-appb-100006
    Determine a range weight value;
    其中,g s为空域上的滤波函数,f r为值域上的滤波函数,I(i,j)为目标像素数据的灰度值,(i,j)为目标像素数据的坐标,I(k,l)为影响像素数据的灰度值,(k,l)为影响像素数据的坐标,σ s为空域光滑参数,σ r为值域光滑参数。 Among them, g s is a filtering function in the spatial domain, f r is a filtering function in the value domain, I (i, j) is the gray value of the target pixel data, (i, j) is the coordinates of the target pixel data, and I ( k, l) is the gray value that affects the pixel data, (k, l) is the coordinate that affects the pixel data, σ s is the spatial smoothing parameter, and σ r is the smoothing parameter of the range.
  15. 根据权利要求9所述的装置,其特征在于,滤波单元使用双边滤波器对该目标像素数据进行滤波,包括:The device according to claim 9, wherein the filtering unit filters the target pixel data using a bilateral filter, comprising:
    根据下列公式对目标像素数据进行滤波,
    Figure PCTCN2019077053-appb-100007
    其中,
    Figure PCTCN2019077053-appb-100008
    Ι′为双边滤波后的图像像素数据,I为滤波器的输入图像像素数据,I(i,j)为目标像素数据的灰度值,(i,j)表示目标像素数据点的坐标,Ω为滤波窗口内包含的所有像素数据点的集合,I(k,l)为滤波窗口Ω内的一个影响像素数据的灰度值,(k,l)为影响像素数据的坐标;g s为空域上的滤波函数,f r为值域上的滤波函数;K为权重。
    Filter the target pixel data according to the following formula,
    Figure PCTCN2019077053-appb-100007
    among them,
    Figure PCTCN2019077053-appb-100008
    I ′ is the image pixel data after bilateral filtering, I is the input image pixel data of the filter, I (i, j) is the gray value of the target pixel data, (i, j) represents the coordinates of the target pixel data point, Ω Is the set of all pixel data points contained in the filter window, I (k, l) is a gray value that affects the pixel data in the filter window Ω, (k, l) is the coordinates that affect the pixel data; g s is the spatial domain Filter function, f r is the filter function on the value range; K is the weight.
  16. 一种FPGA,其特征在于,包括实现图像双边滤波的装置,该装置包括:An FPGA is characterized in that it includes a device for implementing bilateral filtering of an image, and the device includes:
    接收单元,用于接收来自图像传感器的图像数据;A receiving unit for receiving image data from an image sensor;
    查找单元,用于在接收单元接收到图像数据中的有效数据后,将接收到的一个像素数据确定为目标像素数据,确定该目标像素数据所在滤波窗口中的全部像素数据为影响像素数据;依次从存储的空域权重表中查找确定每个影响像素数据对应的空域权重值,从存储的值域权重表中查找确定每个影响像素数据对应的值域权重值;The searching unit is configured to determine, after receiving the valid data in the image data, the received pixel data as target pixel data, and determine that all the pixel data in the filtering window where the target pixel data is located is the affected pixel data; Look up and determine the airspace weight value corresponding to each affected pixel data from the stored airspace weight table, and find and determine the value of the domain weight corresponding to each affected pixel data from the stored value domain weight table;
    滤波单元,用于根据查找到的该目标像素数据的全部影响像素数据的空域权重值和值域权重值,使用双边滤波器对该目标像素数据进行滤波,得到滤波后的像素数据。The filtering unit is configured to filter the target pixel data by using a bilateral filter according to the spatial weight value and the range weight value of all the affected pixel data of the found target pixel data, to obtain filtered pixel data.
  17. 一种计算机程序,其特征在于,该计算机程序具有被配置用于执行图像双边滤波处理的代码段,图像双边滤波处理包括:A computer program, characterized in that the computer program has a code segment configured to perform bilateral image filtering processing, and the image bilateral filtering processing includes:
    接收图像数据的过程中,在接收到图像数据中的有效数据后,将接收到的一个像素数据确定为目标像素数据,确定该目标像素数据所在滤波窗口中的全部像素数据为影响像素数据;In the process of receiving image data, after receiving valid data in the image data, the received one pixel data is determined as the target pixel data, and all the pixel data in the filtering window where the target pixel data is located is determined as the affected pixel data;
    依次从存储的空域权重表中查找确定每个影响像素数据对应的空域权重值,从存储的值域权重表中查找确定每个影响像素数据对应的值域权重值;Look up and determine the spatial weight value corresponding to each affected pixel data from the stored spatial weight table in turn, and look up and determine the corresponding domain weight value from the stored value domain weight table;
    根据查找到的该目标像素数据的全部影响像素数据的空域权重值和值域权重值,使用双边滤波器对该目标像素数据进行滤波,得到滤波后的像素数据。The target pixel data is filtered by using a bilateral filter to obtain the filtered pixel data according to all the found spatial weight values and range weight values of the affected pixel data.
  18. 一种成像设备,其特征在于,包括图像传感器和FPGA;图像传感器用于获取图像数据;An imaging device, comprising an image sensor and an FPGA; the image sensor is used to acquire image data;
    FPGA用于接收来自图像传感器的图像数据的过程中,在接收到图像数据中的有效数据后,将接收到的一个像素数据确定为目标像素数据,确定该目标像素数据所在滤波窗口中的全部像素数据为影响像素数据;In the process of receiving image data from the image sensor, the FPGA determines the received pixel data as target pixel data after receiving valid data in the image data, and determines all pixels in the filtering window where the target pixel data is located. Data is the data of the affected pixels;
    依次从存储的空域权重表中查找确定每个影响像素数据对应的空域权重值,从存储的值域权重表中查找确定每个影响像素数据对应的值域权重值;Look up and determine the spatial weight value corresponding to each affected pixel data from the stored spatial weight table in turn, and look up and determine the corresponding domain weight value from the stored value domain weight table;
    根据查找到的该目标像素数据的全部影响像素数据的空域权重值和值域权重值,使用双边滤波器对该目标像素数据进行滤波,得到滤波后的像素数据。The target pixel data is filtered by using a bilateral filter to obtain the filtered pixel data according to all the found spatial weight values and range weight values of the affected pixel data.
PCT/CN2019/077053 2018-09-19 2019-03-05 Method and apparatus for implementing bilateral image filtering in fpga, and fpga WO2020057062A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811096288.1A CN110930313B (en) 2018-09-19 2018-09-19 Method and device for realizing image bilateral filtering in FPGA (field programmable gate array), and FPGA
CN201811096288.1 2018-09-19

Publications (1)

Publication Number Publication Date
WO2020057062A1 true WO2020057062A1 (en) 2020-03-26

Family

ID=69855243

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/077053 WO2020057062A1 (en) 2018-09-19 2019-03-05 Method and apparatus for implementing bilateral image filtering in fpga, and fpga

Country Status (2)

Country Link
CN (1) CN110930313B (en)
WO (1) WO2020057062A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112435156B (en) * 2020-12-08 2022-12-09 烟台艾睿光电科技有限公司 Image processing method, device, equipment and medium based on FPGA
CN113822827B (en) * 2021-09-18 2024-03-22 凌云光技术股份有限公司 Average filtering method and device based on FPGA external memory
CN116228768B (en) * 2023-05-09 2023-07-21 济宁众达利电气设备有限公司 Method for detecting scratches on surface of electronic component

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104392423A (en) * 2014-11-26 2015-03-04 浙江红相科技股份有限公司 Real-time balance based infrared image detail enhancement algorithm
CN104867122A (en) * 2015-05-29 2015-08-26 北京理工大学 Infrared self-adaptive non-uniformity correction and detail enhanced cascade processing method
CN106327447A (en) * 2016-08-30 2017-01-11 天津天地伟业数码科技有限公司 Spatial domain and pixel domain hybrid de-noising algorithm based on FPGA (Field Programmable Gate Array) platform
CN108259707A (en) * 2016-12-29 2018-07-06 中国移动通信集团广东有限公司 video image real-time de-noising method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102006056650A1 (en) * 2006-12-11 2008-04-17 Siemens Ag Bilateral filtering method for digital image data, involves modifying pixel value and distance weighting functions using edge weighting function that is determined based on edge strength of image pixel
CN103020914B (en) * 2012-12-18 2016-01-20 华侨大学 Based on the rapid image defogging method capable of spatial continuity principle
CN103116875B (en) * 2013-02-05 2015-08-26 浙江大学 Self-adaptation bilateral filtering image de-noising method
CN107230190B (en) * 2017-05-23 2020-04-21 北京奇艺世纪科技有限公司 Image bilateral filtering method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104392423A (en) * 2014-11-26 2015-03-04 浙江红相科技股份有限公司 Real-time balance based infrared image detail enhancement algorithm
CN104867122A (en) * 2015-05-29 2015-08-26 北京理工大学 Infrared self-adaptive non-uniformity correction and detail enhanced cascade processing method
CN106327447A (en) * 2016-08-30 2017-01-11 天津天地伟业数码科技有限公司 Spatial domain and pixel domain hybrid de-noising algorithm based on FPGA (Field Programmable Gate Array) platform
CN108259707A (en) * 2016-12-29 2018-07-06 中国移动通信集团广东有限公司 video image real-time de-noising method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CHENG, YUE ET AL.: "Design and Implementation of Image Enhancement Platform with FPGA", JOURNAL OF INNER MONGOLIA NORMAL UNIVERSITY (NATURAL SCIENCE EDITION), vol. 44, no. 3, 31 May 2015 (2015-05-31), pages 322 - 327, ISSN: 1001-8735 *

Also Published As

Publication number Publication date
CN110930313B (en) 2023-07-14
CN110930313A (en) 2020-03-27

Similar Documents

Publication Publication Date Title
WO2019134504A1 (en) Method and device for blurring image background, storage medium, and electronic apparatus
Chen et al. Blind image deblurring with local maximum gradient prior
Park et al. Low-light image enhancement using variational optimization-based retinex model
US20210150759A1 (en) Eye gaze tracking using neural networks
WO2020057062A1 (en) Method and apparatus for implementing bilateral image filtering in fpga, and fpga
KR102629380B1 (en) Method for Distinguishing a Real Three-Dimensional Object from a Two-Dimensional Spoof of the Real Object
US10817984B2 (en) Image preprocessing method and device for JPEG compressed file
JP7067023B2 (en) Information processing device, background update method and background update program
WO2020047854A1 (en) Detecting objects in video frames using similarity detectors
CN112215773B (en) Local motion deblurring method and device based on visual saliency and storage medium
WO2018068129A1 (en) Determining variance of a block of an image based on a motion vector for the block
WO2020001222A1 (en) Image processing method, apparatus, computer readable medium, and electronic device
Dai et al. Dual-purpose method for underwater and low-light image enhancement via image layer separation
CN113947768A (en) Monocular 3D target detection-based data enhancement method and device
CN110633717A (en) Training method and device for target detection model
Pandey et al. A fast and effective vision enhancement method for single foggy image
CN112801890B (en) Video processing method, device and equipment
CN110473281A (en) Threedimensional model retouches side processing method, device, processor and terminal
WO2023215371A1 (en) System and method for perceptually optimized image denoising and restoration
CN111444555A (en) Temperature measurement information display method and device and terminal equipment
CN111311610A (en) Image segmentation method and terminal equipment
US9594955B2 (en) Modified wallis filter for improving the local contrast of GIS related images
US9679363B1 (en) System and method for reducing image noise
Soma et al. An efficient and contrast-enhanced video de-hazing based on transmission estimation using HSL color model
Li et al. A weighted least squares algorithm for time-of-flight depth image denoising

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19861901

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 30.06.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 19861901

Country of ref document: EP

Kind code of ref document: A1