FPGA-based object surface reflection intensity adaptive dimming method and system
Patent Information
- Application Number
- CN202610955311.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-30
- Publication Date
- 2026-09-29
AI Technical Summary
[0011]针对现有技术的缺陷,本申请的目的在于提供一种基于FPGA的物体表面反光强度自适应调光方法及系统,旨在解决现有曝光自适应调节存在缺陷的问题
本申请提供一种基于FPGA的物体表面反光强度自适应调光方法及系统,对于物体表面反光强度的计算,本申请图像通过异常帧屏蔽、梯度滤波、有效反射区域提取、区域峰值压缩、整帧多级求和计算的方式表征物体表面反光强度。通过逐行并行筛选有效区域内有效亮度峰值,主动剔除暗区、噪声等冗余无效像素,仅保留物体表面真实反光高光信息,有效避开大面积背景、噪声、无效暗亮区域对亮度统计的影响,避免反光强度误判、反馈失真问题。通过多级流水线加法树对行峰值数据规整求和,确保提取的反光强度数据完整、无遗漏,可有效抑制噪声导致的反光强度偏移,使曝光调节依据真实、稳定。
Smart Images

Figure CN122845941A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of industrial vision, and more specifically, relates to an adaptive dimming method and system for the reflective intensity of an object surface based on FPGA. Background Technology
[0002] Adaptive exposure control is a crucial step in machine vision imaging, industrial inspection, and surface quality inspection. Its function is to adjust imaging parameters in real time based on the reflective intensity of the object's surface, ensuring stable image brightness without overexposure or underexposure, thus providing reliable data support for subsequent image processing, feature extraction, and defect identification. Currently, the commonly used solutions for adaptive control of image brightness and exposure include the following: (1) Fixed exposure time and post-processing image method. This method involves acquiring images before the device starts working, setting fixed exposure parameters, and keeping the exposure time constant throughout the operation. After the acquired images are uploaded to the PC, the brightness is adjusted by the backend software algorithm.
[0003] (2) A dimming method based on the overall grayscale mean. This method calculates the global average grayscale value of the entire image, compares it with the target brightness, and then adjusts the exposure.
[0004] (3) Passive dimming method based on threshold comparison. This method sets a threshold range and only makes a one-time adjustment when the image brightness exceeds the threshold range.
[0005] (4) Machine learning-based method. This method trains a neural network by extracting information such as image edges, corners, and feature points, and infers changes in image brightness based on the trained model to adjust the exposure.
[0006] All four of the above-mentioned adaptive exposure adjustment methods have certain drawbacks.
[0007] (1) The fixed exposure time method is simple and low cost, but it cannot follow the changes in the reflective intensity of the object surface in real time, and it is easy to overexpose or underexpose, resulting in serious loss of image details; at the same time, the PC post-processing has algorithm processing delay, which makes it difficult to meet the real-time adjustment requirements of high frame rate area array cameras.
[0008] (2) The dimming method based on the overall grayscale mean is not sensitive to image details such as local highlights and sudden changes in local reflections, has poor brightness feedback representativeness, and low adjustment accuracy.
[0009] (3) The passive dimming method based on threshold comparison only makes a single adjustment when the brightness exceeds the threshold. It does not have the ability to continuously close the loop, which can easily cause image brightness jumps and flickering, and cannot adapt to continuously changing reflective environments.
[0010] (4) Machine learning-based methods require a large number of samples for training, resulting in high model complexity and difficulty in hardware deployment. In practical applications, they have poor generalization ability to scene changes, insufficient real-time performance, and difficulty in achieving low-latency adjustment on embedded hardware such as FPGA. Summary of the Invention
[0011] In view of the shortcomings of the prior art, the purpose of this application is to provide an adaptive dimming method and system for the reflective intensity of object surfaces based on FPGA, which aims to solve the problems of the existing adaptive exposure adjustment.
[0012] To achieve the above objectives, in a first aspect, this application provides an FPGA-based adaptive dimming method for the reflective intensity of an object's surface, comprising the following steps: The image data of the object surface captured by the imaging device is received through the parallel bus of the FPGA, and the received image data is buffered through t-level cascaded FIFOs; the image data includes m rows of image frames, each row of image frames includes n columns of pixel data, and s columns of pixel data of each row of image frames are received in parallel in the same clock cycle; where t, m, n and s are positive integers, and s≤n. The horizontal gradient of all adjacent pixel data in each row of image frames is obtained. When any horizontal gradient exceeds a preset horizontal gradient threshold, it is marked as an abnormal horizontal gradient. The total number of abnormal horizontal gradients in the image data is counted. The vertical gradient of each column of image frames is also performed based on the parallel bus and the t-level cascaded FIFO. The vertical gradient of adjacent pixel data or two pixel data with a preset pixel interval in each column of image frames is calculated based on the vertically filtered image data. When the total number of abnormal horizontal gradients does not exceed the threshold, the effective reflection area in the image data is determined based on the vertical gradient; The reflective intensity of the object surface is determined based on pixel data within the effective reflective area, and the exposure time of the imaging device is adjusted based on the reflective intensity to keep the reflective intensity stably within a preset reflective intensity range.
[0013] In one possible implementation, determining the effective reflection region in the image data based on the longitudinal gradient includes: All acquired vertical gradients are compared sequentially with a preset vertical gradient threshold. If the vertical gradient exceeds the preset vertical gradient threshold, the corresponding adjacent pixel data is determined to be a valid reflective area pixel. If the values of multiple adjacent vertical gradients corresponding to multiple effective reflective area pixels in the same column of image frames change according to a preset rule, then the multiple effective reflective areas are marked as effective reflection areas; the preset rule is that the value of the vertical gradient changes from a positive number to a negative number, or from a negative number to a positive number.
[0014] In one possible implementation, the reflectivity of the object's surface is determined based on pixel data within the effective reflective area, including: Count the number of effective reflective areas in each column of image frames, and take the maximum number of effective reflective areas in n column image frames as the number of detectable layers on the object surface; All effective reflection areas of each column of image frames are divided according to the number of layers to obtain the effective reflection areas of each column of image frames in each detectable layer; wherein, there is at most one effective reflection area in one column of image frames in one detectable layer. The reflectivity of each detectable layer is determined by combining the effective reflectivity of each column of image frames within each detectable layer.
[0015] It should be noted that this application considers the reflectance intensity of different detection layers to avoid the limitations of existing technologies that, when considering reflectance intensity as a whole, cannot adapt to different detection layers, thus affecting detection accuracy. When the number of effective reflective areas in different column image frames is inconsistent, the effective reflective areas can be divided into different detection layers by referring to the distribution of detection layers on the image.
[0016] In one possible implementation, the reflectivity of each detectable layer is determined by combining the effective reflective areas of each column of image frames within each detectable layer, including: Compare the pixel data of all pixels belonging to the effective reflective area in each column of each detectable layer, and take the largest pixel data as the vertical reflective brightness peak of that column. The reflectivity of each detectable layer is determined based on the average of the longitudinal reflectivity peak values of each column within each detectable layer.
[0017] In one possible implementation, the reflectivity of each detectable layer is determined based on the average of the longitudinal reflectivity peak values of each column within each detectable layer, including: The peak values of longitudinal reflectance brightness in each column within each detectable layer are cached; When the number of longitudinal reflective brightness peaks in the cache is not equal to a power of 2, the longitudinal reflective brightness peaks in the cache are padded with bit width based on the average of adjacent longitudinal reflective brightness peaks; the bit width is a power of 2. The peak value of the longitudinal reflective brightness after bit width padding is input into a multi-level binary pipelined addition tree, and the peak values are summed in parallel level by level within a continuous clock cycle to obtain the sum of the peak reflective brightness of the corresponding detectable layer; the level of the binary pipelined addition tree is the power corresponding to the bit width after padding. A register logic right shift operation is performed on the sum of the peak reflective brightness, where the number of bits shifted to the right is the level number, to obtain the average peak brightness of the corresponding detectable layer, which is then used as the reflective intensity of the corresponding detectable layer.
[0018] In one possible implementation, the vertical gradient of adjacent pixel data or two pixel data separated by a preset pixel interval in each column of image frames is calculated based on the vertically filtered image data, including: After performing vertical filtering on each column of image frames based on the parallel bus and t-level cascaded FIFO, 1+t rows of image frames are read sequentially. The h+k-th pixel data in the 1+t pixel data of each column of image frames in the read 1+t rows of image frames is subtracted from the h-th pixel data to obtain the vertical gradient corresponding to the h+k-th pixel data and the h-th pixel data; where 1≤h≤1+t, 1≤h+k≤1+t, 1≤k≤t, and h and k are both positive integers.
[0019] In one possible implementation, pixel data belonging to the effective reflective area in each column of each detectable layer are compared, and the largest pixel data is taken as the vertical reflective brightness peak of that column, including: in, Indicates the first line, the first... Whether the original pixels of the column are located in the effective reflection area. Indicates the first Line 1 Whether the original pixel of the column is located in the effective reflection area, if it is located in the effective reflection area =1, otherwise =0; Indicates the first line, the first... List the original pixel grayscale brightness values; Indicates the first Line 1 List the original pixel grayscale brightness values. The number of pixel rows per frame of the image. This indicates that the initial peak value for each column is the pixel value of the column corresponding to the effective reflective area of the first row. For the first When inputting pixels row by row, the current pixel will be... Column pixels The previous peak value of that column stored in the register. Compare the maximum values. If the current pixel brightness value is greater, update the peak value in the register. Otherwise, keep the original registered peak value unchanged and iterate through the entire frame of the image.
[0020] In one possible implementation, adjusting the exposure time of the imaging device based on the reflective intensity to stably maintain the reflective intensity within a preset reflective intensity range includes: The exposure time of the imaging device is adjusted based on the reflectivity of each detectable layer, so that the reflectivity of each detectable layer is stably maintained within the corresponding preset reflectivity range.
[0021] Secondly, this application provides an FPGA-based adaptive dimming system for the reflective intensity of an object's surface, comprising: The image data receiving unit is used to receive image data of the object surface captured by the imaging device through the parallel bus of the FPGA, and buffer the received image data through t-level cascaded FIFOs; the image data includes m rows of image frames, each row of image frames includes n columns of pixel data, and s columns of pixel data of each row of image frames are received in parallel in the same clock cycle; where t, m, n and s are positive integers, and s≤n; The horizontal gradient acquisition unit is used to acquire the horizontal gradient of all adjacent pixel data in each row of image frames. When any horizontal gradient exceeds the preset horizontal gradient threshold, it is marked as an abnormal horizontal gradient, and the total number of abnormal horizontal gradients in the image data is counted. It also performs vertical filtering on each column of image frames based on the parallel bus and the t-level cascaded FIFO, and calculates the vertical gradient of adjacent pixel data or two pixel data with a preset pixel interval in each column of image frames based on the vertically filtered image data. A reflection region determination unit is used to determine the effective reflection region in the image data based on the vertical gradient when the total number of abnormal horizontal gradients does not exceed a threshold. The reflectivity intensity adjustment unit is used to determine the reflectivity of the object surface based on pixel data within the effective reflectivity area, and to adjust the exposure time of the imaging device based on the reflectivity intensity so that the reflectivity intensity is stably maintained within a preset reflectivity intensity range.
[0022] Thirdly, this application provides an electronic device, including: a memory and one or more processors; The memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions; The one or more processors invoke the computer instructions to cause the electronic device to perform the method described in the first aspect above.
[0023] In summary, compared with the prior art, the technical solutions conceived in this application have the following main technical advantages: This application provides an FPGA-based adaptive dimming method and system for object surface reflectivity. For calculating the reflectivity of an object surface, this application characterizes the reflectivity through abnormal frame masking, gradient filtering, effective reflection region extraction, regional peak compression, and multi-level summation calculation across the entire frame. By filtering effective brightness peaks within the effective region row by row in parallel, redundant and invalid pixels such as dark areas and noise are actively removed, retaining only the true reflective highlight information of the object surface. This effectively avoids the influence of large-area background, noise, and invalid dark and bright areas on brightness statistics, preventing misjudgment and feedback distortion of reflectivity. Through multi-level pipelined addition trees, the row peak data is regularized and summed to ensure the completeness and absence of extracted reflectivity data, effectively suppressing reflectivity shifts caused by noise, and making exposure adjustment based on reality and stability.
[0024] This application provides an FPGA-based adaptive dimming method and system for the reflectivity of object surfaces. It utilizes FPGA for parallel processing of high-frame-rate images, adapting to application scenarios with uneven reflectivity. Structurally, multiple tasks, including parallel image input, gradient peak compression extraction, multi-level summation, and exposure adjustment, are executed in parallel. Each task process is pipelined, ensuring independent and orderly processing. In terms of data processing, multiple pixel data streams are received within the same clock cycle, and parallel comparisons and maximum value filtering are performed simultaneously. Multiple pixels are processed synchronously, significantly shortening the time for reflectivity extraction and exposure adjustment per frame. Through the parallel processing and pipelined architecture of the FPGA, the speed of adaptive dimming for reflectivity is greatly improved, meeting the real-time application requirements of high-frame-rate, high-speed online detection. Attached Figure Description
[0025] Figure 1 This is a flowchart of an FPGA-based adaptive dimming method for the reflective intensity of an object surface, provided in an embodiment of this application. Figure 2 This is a flowchart of the processing steps for adaptive dimming of surface reflectivity of an object based on FPGA, provided in an embodiment of this application. Figure 3 This is a schematic diagram of the dual FIFO cascaded generation of the image matrix provided in the embodiments of this application; Figure 4 This is a schematic diagram of the composition of the light control part of the confocal sensor provided in the embodiments of this application; Figure 5 This is a sample image of the high frame rate data source collected before dimming, provided in the embodiments of this application. Figure 6 This is a sample image after dimming, acquired from a high frame rate data source provided in this application embodiment; Figure 7 This is an architecture diagram of an FPGA-based adaptive dimming system for reflecting light intensity on an object surface, provided in an embodiment of this application. Figure 8This is an architectural diagram of the electronic device provided in the embodiments of this application. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0027] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0028] Furthermore, throughout this specification, references to "an embodiment"; "an embodiment," "an example," or similar language indicate that a particular feature, structure, or characteristic described in connection with that embodiment is included in at least one embodiment of this application. Therefore, the appearance of the phrase "in one embodiment;" throughout this specification, and similar language, may, but not necessarily, refer to the same embodiment.
[0029] Figure 1 This application provides an FPGA-based adaptive dimming method for the reflective intensity of an object's surface, such as... Figure 1 As shown, it includes the following steps: Step S101: Receive image data of the object surface captured by the imaging device through the parallel bus of the FPGA, and buffer the received image data through a cascaded FIFO of t levels; the image data includes m rows of image frames, each row of image frames includes n columns of pixel data, and s columns of pixel data of each row of image frames are received in parallel in the same clock cycle; where t, m, n and s are positive integers, and s≤n; Step S102: Obtain the horizontal gradient of all adjacent pixel data in each row of image frames. When any horizontal gradient exceeds the preset horizontal gradient threshold, mark it as an abnormal horizontal gradient and count the total number of abnormal horizontal gradients in the image data. Also, perform vertical filtering on each column of image frames based on the parallel bus and the t-level cascaded FIFO, and calculate the vertical gradient of adjacent pixel data or two pixel data separated by a preset pixel in each column of image frames based on the vertically filtered image data. Step S103: When the total number of abnormal horizontal gradients does not exceed the threshold, determine the effective reflection area in the image data based on the vertical gradient; Step S104: Determine the reflectivity of the object surface based on the pixel data within the effective reflectivity area, and adjust the exposure time of the imaging device based on the reflectivity to keep the reflectivity stably within a preset reflectivity range.
[0030] In one embodiment, determining the effective reflective region in the image data based on the longitudinal gradient includes: All acquired vertical gradients are compared sequentially with a preset vertical gradient threshold. If the vertical gradient exceeds the preset vertical gradient threshold, the corresponding adjacent pixel data is determined to be a valid reflective area pixel. If the values of multiple adjacent vertical gradients corresponding to multiple effective reflective area pixels in the same column of image frames change according to a preset rule, then the multiple effective reflective areas are marked as effective reflection areas; the preset rule is that the value of the vertical gradient changes from a positive number to a negative number, or from a negative number to a positive number.
[0031] In one embodiment, determining the reflectivity of an object's surface based on pixel data within the effective reflective area includes: Count the number of effective reflective areas in each column of image frames, and take the maximum number of effective reflective areas in n column image frames as the number of detectable layers on the object surface; All effective reflection areas of each column of image frames are divided according to the number of layers to obtain the effective reflection areas of each column of image frames in each detectable layer; wherein, there is at most one effective reflection area in one column of image frames in one detectable layer. The reflectivity of each detectable layer is determined by combining the effective reflectivity of each column of image frames within each detectable layer.
[0032] In one embodiment, determining the reflectivity of each detectable layer by combining the effective reflective areas of each column of image frames within each detectable layer includes: Compare the pixel data of all pixels belonging to the effective reflective area in each column of each detectable layer, and take the largest pixel data as the vertical reflective brightness peak of that column. The reflectivity of each detectable layer is determined based on the average of the longitudinal reflectivity peak values of each column within each detectable layer.
[0033] In one embodiment, determining the reflectivity of each detectable layer based on the average of the longitudinal reflectivity peak values of each column within each detectable layer includes: The peak values of longitudinal reflectance brightness in each column within each detectable layer are cached; When the number of longitudinal reflective brightness peaks in the cache is not equal to a power of 2, the longitudinal reflective brightness peaks in the cache are padded with bit width based on the average of adjacent longitudinal reflective brightness peaks in the cache, where the bit width is a power of 2. The peak value of the longitudinal reflective brightness after bit width padding is input into a multi-level binary pipelined addition tree, and the peak values are summed in parallel level by level within a continuous clock cycle to obtain the sum of the peak reflective brightness of the corresponding detectable layer; the level of the binary pipelined addition tree is the power corresponding to the bit width after padding. A register logic right shift operation is performed on the sum of the peak reflective brightness, where the number of bits shifted to the right is the level number, to obtain the average peak brightness of the corresponding detectable layer, which is then used as the reflective intensity of the corresponding detectable layer.
[0034] In one embodiment, calculating the vertical gradient of adjacent pixel data or two pixel data separated by a preset pixel interval in each column of image frames based on the vertically filtered image data includes: After performing vertical filtering on each column of image frames based on the parallel bus and t-level cascaded FIFO, 1+t rows of image frames are read sequentially. The h+k-th pixel data in the 1+t pixel data of each column of image frames in the read 1+t rows of image frames is subtracted from the h-th pixel data to obtain the vertical gradient corresponding to the h+k-th pixel data and the h-th pixel data; where 1≤h≤1+t, 1≤h+k≤1+t, 1≤k≤t, and h and k are both positive integers.
[0035] In one embodiment, pixel data of all pixels belonging to the effective reflective area in each column of each detectable layer are compared, and the largest pixel data is taken as the vertical reflective brightness peak of that column, including: in, Indicates the first line, the first... Whether the original pixels of the column are located in the effective reflection area. Indicates the first Line 1 Whether the original pixel of the column is located in the effective reflection area, if it is located in the effective reflection area =1, otherwise =0; Indicates the first line, the first... List the original pixel grayscale brightness values; Indicates the first Line 1 List the original pixel grayscale brightness values. The number of pixel rows per frame of the image. This indicates that the initial peak value for each column is the pixel value of the column corresponding to the effective reflective area of the first row. For the first When inputting pixels row by row, the current pixel will be... Column pixels The previous peak value of that column stored in the register. Compare the maximum values. If the current pixel brightness value is greater, update the peak value in the register. Otherwise, keep the original registered peak value unchanged and iterate through the entire frame of the image.
[0036] In one embodiment, adjusting the exposure time of the imaging device based on the reflective intensity to stably maintain the reflective intensity within a preset reflective intensity range includes: The exposure time of the imaging device is adjusted based on the reflectivity of each detectable layer, so that the reflectivity of each detectable layer is stably maintained within the corresponding preset reflectivity range.
[0037] In one specific embodiment, this application proposes an FPGA-based adaptive light adjustment method for the reflective intensity of an object's surface, relating to the field of industrial machine vision. Specifically, it can be applied to spectral confocal sensors in 3D online inspection, 3D contour scanning, and non-contact precision measurement equipment. This method can adaptively adjust exposure in real time, following changes in the reflective intensity of the object's surface, even in scenarios with high frame rates and uneven reflectivity. Figure 2 As shown, the processing steps are as follows.
[0038] (1) Parallel image input. High frame rate image data adopts a parallel bus method, inputting multiple pixel data of one row of image in each clock cycle, with the row valid signal and frame valid signal as synchronization flags.
[0039] It should be noted that the aforementioned high frame rate specifically refers to the image acquisition frame rate range of this system being 2500~20000 frames per second, far exceeding the frame rate of conventional civilian video, which belongs to high-speed imaging scenarios.
[0040] (2) Horizontal gradient anomaly frame masking. A maximum threshold for the horizontal gradient of brightness is preset (this threshold is higher than the noise floor amplitude). An independent threshold comparator is configured for each of the multiple data streams in each clock cycle. The threshold judgment of all pixel grayscale values is completed synchronously in a single cycle. The horizontal gradient calculation function is expressed as: in, For the first Frame number Line 1 The grayscale value of each pixel. Count the number of abnormal pixels in the entire frame. If the total number of abnormal pixels in the entire frame exceeds the threshold, the current frame is determined to be an invalid abnormal frame, the latched frame is blocked by the gating signal, and all operations in this frame are skipped.
[0041] (3) Vertical filtering. A two-stage cascaded FIFO system of the same specifications is used to form a two-row image buffer link, which, together with the original input row, forms a three-group vertical pixel matrix. For example... Figure 3As shown, the read and write enable of the FIFO is controlled by the row counting threshold logic. FIFO1 skips the first row when read and does not buffer the last row of the frame when write. FIFO2 skips the first two rows when read and does not buffer the last two rows of the frame when write. Subsequently, the three sets of column pixel vertical pixel matrices of the multi-channel data are cyclically split. The vertical median is calculated for each column output of each channel data, and the median is used to replace the current pixel value. The calculation results are then recombined in the cyclic order into a multi-channel data parallel form. At the same time, timing synchronization logic ensures that the filtering window is aligned with the output line and field synchronization signals.
[0042] (4) Extraction of effective reflection area. The vertical matrix of the three columns of pixels output in step (3) is calculated according to the vertical gradient. A preset vertical gradient threshold register is used to synchronously compare the gradient magnitude of each pixel with the reflection boundary determination threshold in real time. If the gradient magnitude exceeds the threshold, the pixel is determined to be an effective reflection area pixel; if the gradient magnitude is below the threshold, it is classified as a background area pixel. The sign of the effective gradient values generated in two consecutive steps is recorded, and the pixel position where the gradient sign changes from positive to negative is stored as the gradient peak position. The number of gradient detection peaks is set according to the number of sample layers measured. The gradient position area recorded in each column of the image is the effective reflection area.
[0043] (5) Region Peak Compression. If the sample being tested is an opaque single-layer object, the gradient peak position within the region is unique; if the sample being tested is a multi-layer translucent object, multiple gradient peaks exist within the effective reflection region. The gradient peak of the layer of interest in each column is selected for pixel grayscale value storage. The peak compression function is expressed as: in, Indicates the first line, the first... Whether the original pixels of the column are located in the effective reflection area. Indicates the first Line 1 Whether the original pixel of the column is located in the effective reflection area, if it is located in the effective reflection area =1, otherwise =0; Indicates the first line, the first... List the original pixel grayscale brightness values; Indicates the first Line 1 List the original pixel grayscale brightness values. The number of pixel rows per frame of the image. This indicates that the initial peak value for each column is the pixel value of the column corresponding to the effective reflective area of the first row. For the first When inputting pixels row by row, the current pixel will be... Column pixels The previous peak value of that column stored in the register. Compare the maximum values. If the current pixel brightness value is greater, update the peak value in the register. Otherwise, keep the original registered peak value unchanged and iterate through the entire frame of the image.
[0044] (6) Peak Buffering. All peak values extracted within a frame are buffered to form a set of peak values representing the brightness of the entire frame. Simultaneously, at the end of the frame, bit-width padding is performed on the data. For ports whose input port column number is not a power of 2, the difference is filled by averaging the grayscale values of adjacent peak pixels to ensure bit-width alignment in subsequent operations. The peak value set function for image brightness information is expressed as: To pad its bit width, the function is as follows: in, It is the set of peak brightness values for all columns in the entire frame. For the image number Vertical brightness peak, This is the bit width of the original peak data. Align the bit width for the operation.
[0045] (7) Multi-stage pipelined summation. The peak data stored in the previous process is summed using a multi-stage (up to 11 stages, depending on the image size) binary pipelined adder tree. The number of adder tree stages corresponds to the data size in a binary logarithmic relationship. Each stage of peak data summation is completed within a single cycle, progressively compressing the data volume. The first stage input function of the multi-stage binary pipeline... Represented as: No. Binary recursive summation The function is represented as: After multi-level processing, the total peak value S of the entire frame is expressed as: in, Indicates the first bit width after padding. Vertical brightness peak of column image Indicates the first The summation result of the current operation level in the binary addition tree. This indicates the odd-numbered index of the element in level (l-1) participating in this addition operation. This represents the index of the adjacent even number in level l-1 that participates in this addition operation. This represents the final summation result after each of the 11 stages of the binary pipeline is summed in pairs.
[0046] (8) Peak brightness value calculation. The peak brightness sum obtained from multiple accumulations is right-shifted in a register to obtain the average peak brightness value of the entire frame. This average brightness value is used to characterize the reflective intensity of the object's surface. Wherein, let: The real-time reflectance intensity quantization function of the object's surface is expressed as: in, This represents the total number of pixels per row in a single frame of an image. For the corresponding number of binary shift bits, The first bit after bit width padding Vertical brightness peak of column image This is the sum of column peak values calculated internally by the FPGA using a multi-stage binary pipeline addition tree hardware. A binary logic right shift operator specific to FPGA hardware. The final calculated average peak brightness directly and equivalently characterizes the intensity of reflection from the object's surface.
[0047] (9) Adaptive exposure adjustment. The calculated reflective intensity of the object surface is compared with the preset target reflective intensity range; if the reflective intensity value is lower than the preset lower limit, the exposure trigger time is increased; if the average value is higher than the upper limit, the exposure trigger time is decreased; if it is within a reasonable range, the exposure trigger time remains unchanged.
[0048] (10) Exposure output synchronized with light source. The exposure pulse is output synchronously according to the adjusted exposure time to control the on / off of the light source and exposure triggering, so that the brightness of the next frame image stabilizes and tends to the preset target reflective intensity range.
[0049] like Figure 4 As shown, this application uses an FPGA as the processing and computing core for the adaptive dimming algorithm of the object surface reflectivity. GPUs, on the other hand, possess massively parallel computing capabilities, making them suitable for processing high frame rate image data. Furthermore, GPUs do not require dedicated hardware logic design when performing image processing tasks such as reflectivity extraction and exposure adjustment. CPUs, as mature general-purpose computing development tools, can perform various general-purpose computing tasks such as reflectivity summation, averaging, and exposure adjustment rule judgment with relatively high latency. Therefore, in scenarios where power consumption and real-time requirements are not critical, CPUs can replace the FPGA in this solution as the processing and computing core, and thus require protection in this regard.
[0050] Figure 5 and Figure 6 These are sample images before and after dimming collected from the high frame rate data source provided in the embodiments of this application; such as Figure 5 , Figure 6 As shown, Figure 5 The high frame rate data source captured the sample image before dimming. The brightness was too low and the image details were not clear, which was not conducive to the subsequent detection algorithm processing. Figure 6 Increasing the exposure time results in clearer image textures, leading to more accurate post-detection algorithms.
[0051] In summary, this application uses an FPGA as the processing core of the adaptive dimming algorithm for the reflective intensity of object surfaces. Leveraging its parallel computing and pipelined operation characteristics, it significantly improves the computational speed of reflective intensity extraction and exposure adjustment, enabling it to adapt to high frame rates and scenes with uneven reflective characteristics, and process high-resolution images. This application employs an "image peak compression reading" mechanism, compressing a massive row of pixel data into a single peak data point to accurately represent the true reflective intensity of the object surface, preventing misjudgment and feedback distortion of reflective intensity. Furthermore, based on the compressed column peak dataset, this application uses a multi-stage pipelined summation and shift averaging method to calculate the average reflective intensity, effectively overcoming the problem of reflective intensity feedback offset under noise and background interference.
[0052] Figure 7 The architecture diagram of the FPGA-based adaptive dimming system for reflecting light intensity on an object surface provided in this application embodiment is as follows: Figure 7 As shown, it includes: The image data receiving unit 710 is used to receive image data of the object surface captured by the imaging device through the parallel bus of the FPGA, and buffer the received image data through t-level cascaded FIFOs; the image data includes m rows of image frames, each row of image frames includes n columns of pixel data, and s columns of pixel data of each row of image frames are received in parallel in the same clock cycle; where t, m, n and s are positive integers, and s≤n. The horizontal gradient acquisition unit 720 is used to acquire the horizontal gradient of all adjacent pixel data in each row of image frames. When any horizontal gradient exceeds a preset horizontal gradient threshold, it is marked as an abnormal horizontal gradient, and the total number of abnormal horizontal gradients in the image data is counted. It also performs vertical filtering on each column of image frames based on the parallel bus and the t-level cascaded FIFO, and calculates the vertical gradient of adjacent pixel data or two pixel data with a preset pixel interval in each column of image frames based on the vertically filtered image data. The reflection region determination unit 730 is used to determine the effective reflection region in the image data based on the vertical gradient when the total number of abnormal horizontal gradients does not exceed a threshold. The reflectivity intensity adjustment unit 740 is used to determine the reflectivity of the object surface based on pixel data within the effective reflectivity area, and to adjust the exposure time of the imaging device based on the reflectivity to keep the reflectivity stably within a preset reflectivity intensity range.
[0053] It should be understood that the above system is used to execute the methods in the above embodiments. The corresponding program units in the system are similar in implementation principle and technical effect to those described in the above methods. The working process of the system can be referred to the corresponding process in the above methods, and will not be repeated here.
[0054] Based on the methods in the above embodiments, such as Figure 8 As shown, this application provides an electronic device, such as... Figure 8 As shown, the electronic device may include a processor 810, a communication interface 840, a memory 830, and a communication bus 840, wherein the processor 810, the communication interface 840, and the memory 830 communicate with each other via the communication bus 840. The processor 810 may call logical instructions in the memory 830 to execute the methods in the above embodiments.
[0055] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0056] Based on the methods in the above embodiments, this application provides a computer-readable storage medium storing a computer program that, when run on a processor, causes the processor to execute the methods in the above embodiments.
[0057] Based on the methods in the above embodiments, this application provides a computer program product that, when run on a processor, causes the processor to execute the methods in the above embodiments.
[0058] It is understood that the processor in the embodiments of this application can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. A general-purpose processor can be a microprocessor or any conventional processor.
[0059] The method steps in this application embodiment can be implemented in hardware or by a processor executing software instructions. The software instructions can consist of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, portable hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can reside in an ASIC.
[0060] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0061] It is understood that the various numerical designations used in the embodiments of this application are merely for the convenience of description and are not intended to limit the scope of the embodiments of this application.
[0062] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. An adaptive dimming method for the reflective intensity of an object surface based on FPGA, characterized in that, Includes the following steps: The image data of the object surface captured by the imaging device is received through the parallel bus of the FPGA, and the received image data is buffered through a cascaded FIFO buffer. The image data includes m rows of image frames, each row of image frames includes n columns of pixel data, and s columns of pixel data of each row of image frames are received in parallel in the same clock cycle; where t, m, n and s are positive integers, and s≤n; The horizontal gradient of all adjacent pixel data in each row of image frames is obtained. When any horizontal gradient exceeds a preset horizontal gradient threshold, it is marked as an abnormal horizontal gradient. The total number of abnormal horizontal gradients in the image data is counted. The vertical gradient of each column of image frames is also performed based on the parallel bus and the t-level cascaded FIFO. The vertical gradient of adjacent pixel data or two pixel data with a preset pixel interval in each column of image frames is calculated based on the vertically filtered image data. When the total number of abnormal horizontal gradients does not exceed the threshold, the effective reflection area in the image data is determined based on the vertical gradient; The reflectivity of the object's surface is determined based on pixel data within the effective reflectivity area, and the exposure time of the imaging device is adjusted based on the reflectivity to keep the reflectivity stably within a preset reflectivity range.
2. The adaptive dimming method for the reflective intensity of an object surface according to claim 1, characterized in that, Determining the effective reflection region in the image data based on the longitudinal gradient includes: All acquired vertical gradients are compared sequentially with a preset vertical gradient threshold. If the vertical gradient exceeds the preset vertical gradient threshold, the corresponding adjacent pixel data is determined to be a valid reflective area pixel. If the values of multiple adjacent vertical gradients corresponding to multiple effective reflective area pixels in the same column of image frames change according to a preset rule, then the multiple effective reflective areas are marked as effective reflection areas; the preset rule is that the value of the vertical gradient changes from a positive number to a negative number, or from a negative number to a positive number.
3. The adaptive dimming method for the reflective intensity of an object surface according to claim 1, characterized in that, The intensity of reflection on an object's surface is determined based on pixel data within the effective reflective area, including: Count the number of effective reflective areas in each column of image frames, and take the maximum number of effective reflective areas in n column image frames as the number of detectable layers on the object surface; All effective reflection areas of each column of image frames are divided according to the number of layers to obtain the effective reflection areas of each column of image frames in each detectable layer; wherein, there is at most one effective reflection area in one column of image frames in one detectable layer. The reflectivity of each detectable layer is determined by combining the effective reflectivity of each column of image frames within each detectable layer.
4. The adaptive dimming method for the reflective intensity of an object surface according to claim 3, characterized in that, The reflectivity of each detectable layer is determined by combining the effective reflective areas of each column of image frames within each detectable layer, including: Compare the pixel data of all pixels belonging to the effective reflective area in each column of each detectable layer, and take the largest pixel data as the vertical reflective brightness peak of that column. The reflectivity of each detectable layer is determined based on the average of the longitudinal reflectivity peak values of each column within each detectable layer.
5. The adaptive dimming method for the reflective intensity of an object surface according to claim 4, characterized in that, The reflectivity of each detectable layer is determined based on the average of the longitudinal reflectivity peak values of each column within each detectable layer, including: The peak values of longitudinal reflectance brightness in each column within each detectable layer are cached; When the number of longitudinal reflective brightness peaks in the cache is not equal to a power of 2, the longitudinal reflective brightness peaks in the cache are padded with bit width based on the average of adjacent longitudinal reflective brightness peaks in the cache, where the bit width is a power of 2. The peak value of the longitudinal reflective brightness after bit width padding is input into a multi-level binary pipelined addition tree, and the peak values are summed in parallel level by level within a continuous clock cycle to obtain the sum of the peak reflective brightness of the corresponding detectable layer; the level of the binary pipelined addition tree is the power corresponding to the bit width after padding. A register logic right shift operation is performed on the sum of the peak reflective brightness, where the number of bits shifted to the right is the level number, to obtain the average peak brightness of the corresponding detectable layer, which is then used as the reflective intensity of the corresponding detectable layer.
6. The adaptive dimming method for the reflective intensity of an object surface according to claim 4, characterized in that, Calculate the vertical gradient of adjacent pixel data or two pixel data with a preset pixel interval in each column of image frames based on the vertically filtered image data, including: After performing vertical filtering on each column of image frames based on the parallel bus and t-level cascaded FIFO, 1+t rows of image frames are read sequentially. The h+k-th pixel data in the 1+t pixel data of each column of image frames in the read 1+t rows of image frames is subtracted from the h-th pixel data to obtain the vertical gradient corresponding to the h+k-th pixel data and the h-th pixel data; where 1≤h≤1+t, 1≤h+k≤1+t, 1≤k≤t, and h and k are both positive integers.
7. The adaptive dimming method for the reflective intensity of an object surface according to claim 4, characterized in that, The pixel data of all pixels belonging to the effective reflective area in each column of each detectable layer are compared, and the largest pixel data is taken as the vertical reflective brightness peak of that column, including: in, Indicates the first line, the first... Whether the original pixels of the column are located in the effective reflection area. Indicates the first Line number Whether the original pixel of the column is located in the effective reflection area, if it is located in the effective reflection area =1, otherwise =0; Indicates the first line, the first... List the original pixel grayscale brightness values; Indicates the first Line number List the original pixel grayscale brightness values. The number of pixel rows per frame of the image. This indicates that the initial peak value for each column is the pixel value of the column corresponding to the effective reflective area of the first row. For the first When inputting pixels row by row, the current pixel will be... Column pixels The previous peak value of that column stored in the register. Compare the maximum values. If the current pixel brightness value is greater, update the peak value in the register. Otherwise, keep the original registered peak value unchanged and iterate through the entire frame of the image.
8. The adaptive dimming method for the reflective intensity of an object surface according to any one of claims 1 to 7, characterized in that, Adjusting the exposure time of the imaging device based on the reflected light intensity to stably maintain the reflected light intensity within a preset reflected light intensity range includes: The exposure time of the imaging device is adjusted based on the reflectivity of each detectable layer, so that the reflectivity of each detectable layer is stably maintained within the corresponding preset reflectivity range.
9. An FPGA-based adaptive dimming system for the reflective intensity of an object's surface, characterized in that, include: The image data receiving unit is used to receive image data of the object surface captured by the imaging device through the parallel bus of the FPGA, and buffer the received image data through a cascaded FIFO buffer. The image data includes m rows of image frames, each row of image frames includes n columns of pixel data, and s columns of pixel data of each row of image frames are received in parallel in the same clock cycle; where t, m, n and s are positive integers, and s≤n; The horizontal gradient acquisition unit is used to acquire the horizontal gradient of all adjacent pixel data in each row of image frames. When any horizontal gradient exceeds the preset horizontal gradient threshold, it is marked as an abnormal horizontal gradient, and the total number of abnormal horizontal gradients in the image data is counted. It also performs vertical filtering on each column of image frames based on the parallel bus and the t-level cascaded FIFO, and calculates the vertical gradient of adjacent pixel data or two pixel data with a preset pixel interval in each column of image frames based on the vertically filtered image data. A reflection region determination unit is used to determine the effective reflection region in the image data based on the vertical gradient when the total number of abnormal horizontal gradients does not exceed a threshold. The reflectivity intensity adjustment unit is used to determine the reflectivity of the object surface based on pixel data within the effective reflectivity area, and to adjust the exposure time of the imaging device based on the reflectivity intensity so that the reflectivity intensity is stably maintained within a preset reflectivity intensity range.
10. An electronic device, characterized in that, include: Includes memory and one or more processors; The memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions; The one or more processors invoke the computer instructions to cause the electronic device to perform the method as described in any one of claims 1-8.