A dynamic gray-scale triggered high-speed area array imaging rainfall observation method and system
By employing a high-speed area array imaging method triggered by dynamic grayscale, combined with Canny edge detection and centroid matching algorithms, the problems of imaging quality, resistance to motion distortion, and data redundancy in existing raindrop observation technologies are solved, achieving efficient and accurate raindrop observation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INST OF ATMOSPHERIC PHYSICS CHINESE ACADEMY SCI
- Filing Date
- 2026-02-25
- Publication Date
- 2026-05-19
AI Technical Summary
Existing raindrop observation technologies have shortcomings in terms of image quality, resistance to motion distortion, and data redundancy. They cannot efficiently acquire high-quality raindrop images and have complex system structures with serious data redundancy.
A high-speed area array imaging method with dynamic grayscale triggering is adopted. By combining an area array camera and a telecentric lens, the grayscale difference is calculated in real time to trigger image saving. Combined with Canny edge detection and centroid matching algorithms, the raindrop contour is accurately extracted and multi-dimensional morphological parameters are calculated to avoid motion distortion and data redundancy.
It enables efficient and accurate measurement of raindrop velocity and morphological parameters, reduces data redundancy, improves storage and processing efficiency, and ensures image quality and computational accuracy.
Smart Images

Figure CN121725016B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of meteorological observation instrument technology, and in particular to a machine vision-based precipitation microphysical property measurement technology, specifically a dynamic grayscale triggered high-speed area array imaging precipitation observation method and device. Background Technology
[0002] Raindrops are the main component of natural precipitation, and their size distribution and falling velocity are important parameters reflecting the physical processes of precipitation. Existing raindrop observation technologies are limited by many factors in terms of morphology acquisition, imaging field of view, and frame rate. The microphysical parameters of raindrops, such as size, shape, and falling velocity, are key data for studying precipitation formation mechanisms, calibrating meteorological radar parameters, and improving numerical weather prediction models. Currently, mainstream raindrop spectral observation technologies mainly include impactor raindrop spectrometers (such as JWD), specular raindrop spectrometers based on the principle of light shading (such as OTT Parsive12), and imaging raindrop spectrometers (such as 2DVD). Impactor and light-shading raindrop spectrometers cannot directly acquire true images and shape information of raindrops; their parameters are obtained through indirect inversion, which limits accuracy and reliability. Imaging raindrop spectrometers, such as two-dimensional video raindrop spectrometers (2DVD), can acquire raindrop images, but they mostly use linear scanning, requiring raindrops to continuously pass through two parallel linear scanning light curtains to reconstruct the image. This results in problems such as image stretching or compression distortion, complex system structure, and high cost. Furthermore, traditional area array video raindrop spectrometers typically use continuous recording throughout the day to avoid missed measurements, generating massive amounts of redundant image data, placing a huge burden on data storage and post-processing. Therefore, there is an urgent need in this field for a new, efficient, and high-precision rainfall observation technology that can directly acquire high-quality raindrop images, avoid motion distortion, and effectively reduce data redundancy. Summary of the Invention
[0003] The purpose of this invention is to overcome the shortcomings of existing raindrop observation technologies in terms of imaging quality, resistance to motion distortion, and data redundancy. It provides a dynamic grayscale-triggered high-speed area array imaging method and system for raindrop observation that can simultaneously and accurately measure raindrop velocity and multiple morphological parameters with minimal data volume. Its core lies in "dynamic triggering, high-speed imaging, and refined analysis." The system does not continuously record video; instead, it uses a rain sensor to determine rainfall and intelligently calculates the average grayscale difference between adjacent frames to determine if raindrops have entered the field of view. When there are no raindrops, the system only performs real-time calculations without saving data; once the grayscale change exceeds a threshold, it immediately triggers saving, thus eliminating data redundancy at the source. A high-frame-rate area array camera combined with a telecentric lens directly acquires complete two-dimensional images of the raindrop's falling process, fundamentally avoiding the motion distortion problem caused by linear array scanning. Based on the Canny edge detection algorithm, the raindrop contour is accurately extracted, and a centroid matching algorithm is used to achieve cross-frame tracking of the raindrop. This allows for the calculation of the raindrop's three-dimensional velocity (horizontal velocity, vertical velocity, and resultant velocity) as well as multiple morphological parameters such as equivalent diameter, minimum circumscribed circle diameter, and axial ratio.
[0004] The core of the dynamic grayscale-triggered high-speed area array imaging rainfall observation method lies in the orderly collaboration and deep integration of six core algorithms, achieving a complete innovation from intelligent acquisition to precise analysis:
[0005] Dynamic grayscale triggering algorithm: By calculating the grayscale difference between adjacent frames in real time, it intelligently determines the time when raindrops enter the scene, realizing "recording only when there is a change", thus eliminating data redundancy from the source;
[0006] Grayscale value calculation method: Provides a fast and reliable basis for calculating grayscale differences for triggering algorithms;
[0007] Canny edge detection algorithm: used to accurately extract raindrop contours, providing a high-quality image foundation for subsequent parameter calculations;
[0008] Raindrop velocity calculation algorithm: Based on cross-frame matching of contour centroids, accurately calculate the movement velocity of raindrops;
[0009] Raindrop diameter calculation method: Based on the contour information, calculate the equivalent diameter and the minimum circumscribed circle diameter to characterize the raindrop scale;
[0010] Raindrop axial ratio calculation method: The axial ratio is calculated by fitting the profile of an ellipse, which quantifies the degree of deformation of the raindrop shape;
[0011] The aforementioned algorithms constitute a complete and automated technology chain, enabling a comprehensive and quantitative description of the "appearance-movement-morphology" of raindrops.
[0012] This invention is achieved through the following technical solution: a high-speed area array imaging rainfall observation method based on dynamic grayscale triggering, comprising the following steps:
[0013] S1. Image Acquisition and Grayscale Conversion: Control the area array camera to continuously acquire images of the observation area and convert the acquired color images into grayscale images in real time;
[0014] S2. Dynamic triggering and sequence saving: The average grayscale difference between the current frame and the previous frame is calculated in real time. When the average grayscale difference exceeds the preset trigger threshold, it is determined that raindrops have entered the field of view. Then, the subsequent continuous image sequence starting from the determination time is triggered and a timestamp is marked for each frame image.
[0015] S3. Raindrop contour extraction: Apply the Canny edge detection algorithm frame by frame to the saved image sequence to identify and extract the contours of all raindrops in each frame;
[0016] S4. Raindrop Matching and Tracking: Calculate the centroid coordinates and circumscribed geometric parameters of each raindrop profile, and then perform cross-frame matching and tracking of the same raindrop in multiple consecutive frames based on centroid spatial proximity, profile area consistency and physical rationality of motion direction.
[0017] S5. Motion speed calculation: Based on the centroid pixel displacement (Δ) of the same successfully matched raindrop across consecutive frames. x ,Δ y Image acquisition time interval Δ t and spatial calibration scaling factor S w and S h Calculate the velocity components of raindrops in the horizontal and vertical directions. v x and v y and combined speed v ;
[0018] S6. Morphological parameter calculation: Based on the identified raindrop contour pixel information, calculate the equivalent diameter of the raindrop. D equiv Minimum circumcircle diameter D min and shaft ratio a / b Multidimensional morphological parameters;
[0019] S7. Output Results: Summarize and output the set of motion velocity and morphological parameters of all measured raindrops.
[0020] Specifically, in step S1, the grayscale conversion effectively preserves the brightness information in the image while removing color information by weighted summation of the three color channels, thereby achieving the conversion from a color image to a grayscale image. The conversion formula is as follows:
[0021] ,
[0022] in, R , G , B These represent the values of the red, green, and blue color channels of a pixel, respectively.
[0023] Based on the grayscale image, the average grayscale value of the image is further calculated to describe the overall brightness characteristics of the image. The calculation formula is as follows:
[0024] ,
[0025] Among them, gray[ i ] is the th element in the grayscale image i The grayscale value of each pixel n This represents the total number of pixels in the image.
[0026] Specifically, in step S2, the method for calculating the average gray-level difference value is as follows: The absolute difference method is used, combined with spatial interval sampling of image pixels, to calculate the average absolute value of the gray-level difference of the sampled pixels. The calculation formula is:
[0027] ,
[0028] Among them, gray[ j ] and gray prev [ j [The following are the references to the current frame and the previous frame, respectively.] j The grayscale value of each sampled pixel. m This represents the total number of sampling points;
[0029] Specifically, the method for setting the preset trigger threshold includes: continuously acquiring multiple frames of background images for a period of time during the initial stage of system startup or under a static background without raindrops; calculating the average grayscale difference value sequence between these background frames; and calculating the average grayscale value based on the background frame difference value sequence. μ bg and grayscale standard deviation σ bg Set the preset trigger threshold T Set as:
[0030] ,
[0031] in, K It is a fixed value greater than 1, determined experimentally based on the system's requirements for false alarm rate and detection rate.
[0032] Specifically, the Canny edge detection algorithm in step S3 includes the following sub-steps in sequence:
[0033] S31. Gaussian Filtering: Gaussian filtering uses a Gaussian kernel to perform convolution operations on a grayscale image to smooth noise. Gaussian filtering combines the image with a Gaussian kernel through convolution, and its mathematical expression is:
[0034] ,
[0035] in, σ It is the standard deviation of the Gaussian kernel. σ The value of directly determines the smoothness (blurring) of the filter. σ The larger the value, the flatter the "bell" curve of the Gaussian kernel, the larger the neighborhood it covers, the stronger the smoothing (blurring) effect on the image, and the more effectively it can suppress noise, but it may also lead to the loss of edge details. σ The smaller the value, the more concentrated the Gaussian kernel, the weaker the smoothing effect, and the better it can preserve edges, but the noise reduction ability is also correspondingly weakened; e and π These are the natural constant and pi, respectively. The normalization coefficients ensure that the sum of all elements in the Gaussian kernel is 1, so that the overall brightness of the image does not change after the convolution operation. Gaussian filtering can effectively remove high-frequency noise from images while preserving edge information.
[0036] S32. Gradient Calculation: Calculate the gradient magnitude and direction for each pixel. The formula for calculating the gradient magnitude is:
[0037] ,
[0038] in, I For image I The gradient magnitude represents the total rate of change of the image at that point; I x For image I exist x An upward gradient represents the rate of change of an image in the horizontal direction; Iy For image I exist y The gradient in the direction represents the rate of change of the image in the vertical direction;
[0039] Gradient direction angles in four quadrants θ The calculation formula is:
[0040] .
[0041] S33. Non-maximum suppression: By comparing the gradient magnitude of each pixel with the gradient magnitude of two pixels in its neighborhood along the gradient direction, only the pixels with the local maximum value of the gradient magnitude in the gradient direction are retained, and the non-edge pixels in the gradient magnitude are removed, thus refining the edges to make them clearer.
[0042] S34, Dual-threshold hysteresis connection: Apply two thresholds, high and low, to filter strong edge points and weak edge points, and connect the weak edges connected to the strong edges to form a complete edge contour.
[0043] Specifically, the raindrop velocity calculation in step S5 first calculates the image width direction based on the actual width and height of the image and the set resolution. x (axis) and height direction ( y Spatial calibration scaling factor (axis) S w and S h :
[0044] ,
[0045] ,
[0046] in, S w and S h Spatial calibration scale factor, unit: mm / pixel; W and H The actual width and height of the image, in mm; W pixels and H pixels Width and height in pixels;
[0047] Then, the velocity of the raindrops is calculated based on the changes in their positions and time intervals in consecutive frames.
[0048] The horizontal velocity component of the raindrop is:
[0049] ,
[0050] The vertical velocity component of the raindrop is:
[0051] ,
[0052] The resultant velocity of the raindrops is:
[0053] ,
[0054] Where, Δ x and Δ yΔ represents the pixel displacement of the raindrop centroid in the horizontal and vertical directions, respectively. t This represents the image acquisition time interval.
[0055] Specifically, the equivalent diameter mentioned in step S6 D equiv The calculation formula is:
[0056] ,
[0057] in, A The actual physical area of the raindrop's outline, in mm. 2 This area is obtained by converting the outline area from pixel units to actual physical units;
[0058] Furthermore, the minimum circumcircle diameter D min The calculation is performed by fitting the minimum circumcircle of the raindrop profile. First, an OpenCV function is used to fit the minimum circumcircle of the raindrop profile, and the radius is returned. r and the coordinates of the center of the circle ( x , y The minimum circumcircle diameter is obtained by doubling the radius. D min ;
[0059] Furthermore, based on the raindrop closed contour obtained by Canny edge detection in step S3, least squares ellipse fitting is performed to return the center coordinates of the ellipse. x , y ), shaft length ( w , h and rotation angle β ,in w and h These are the diameters of the ellipse along the major and minor axes, respectively, in pixels. Since the axis lengths returned by OpenCV are related to the ellipse's orientation, the major axis needs to be determined by comparison. a With short axis b :
[0060] ,
[0061] The shaft ratio is calculated using the following formula:
[0062] ,
[0063] When AR=1, the raindrop is an ideal sphere; when AR>1, the raindrop stretches along its long axis, and the larger the value, the more significant the deformation.
[0064] A high-speed area array imaging rainfall observation system with dynamic grayscale triggering mainly consists of an optical imaging unit 100, a backlight illumination unit 200, a central processing unit 300, a control unit 400, a communication unit 500, a power supply unit 600, and a remote center 700.
[0065] The optical imaging unit 100 includes an area array camera 1 and a telecentric lens 2, and is used for high-speed, distortion-free imaging.
[0066] The backlight illumination unit 200 includes a parallel backlight source 3, which provides uniform background light for the optical imaging unit 100.
[0067] The observation area 4 is located between the optical imaging unit 100 and the backlight illumination unit 200. Raindrops fall freely through the observation area 4. As opaque objects, the raindrops are illuminated by the parallel backlight 3. Using the principle of backlight imaging, the raindrops form a silhouette image with clear edges on the area array camera 1 through the telecentric lens 2.
[0068] The central processing unit 300 is configured to perform the image acquisition control, dynamic grayscale trigger judgment, raindrop image processing, motion and morphology parameter calculation and result output;
[0069] The control unit 400 is equipped with a rain sensor 5, which is used to detect rain and automatically control the device to turn on or into standby mode; the control unit 400 is connected to the central processing unit 300 and receives instructions from the central processing unit 300 to control the backlight unit 200 to turn on or off.
[0070] The communication unit 500 is connected to the central processing unit 300 and transmits the observation results to the remote center 700, which can remotely control the operation of the observation system.
[0071] The power supply unit 600 is equipped with a photovoltaic panel 6 and a storage battery 7 to provide power to the observation system.
[0072] The area scan camera 1 is a high-resolution area scan camera with a USB 3.0 interface, connected to the central processing unit 300. It uses ROI technology to improve the acquisition frame rate and perform continuous image acquisition. The telecentric lens 2 maintains a constant magnification under parallel backlighting, effectively eliminating perspective errors, thereby ensuring that raindrops at different spatial positions have a consistent size ratio in the image, laying the foundation for accurate size measurement.
[0073] The backlight unit 200 adopts a monochromatic parallel backlight source, with a high-brightness LED array as the light source, which is arranged in a dense and uniform manner on the light source board. The LED array is equipped with a diffuser plate and a brightness enhancement film, which transforms the discrete LED point light source into a high-quality surface light source with uniform brightness and no hot spots or dark areas.
[0074] The central processing unit 300 has a built-in computing control system, which includes four core modules: image acquisition, image processing, morphological analysis, and user interface.
[0075] The image acquisition module uses the SDK to dynamically configure parameters, accurately acquires images through a grayscale change trigger mechanism, and adopts a multi-threaded architecture to ensure efficient operation of the system at high frame rates.
[0076] The image processing module performs grayscale conversion on the image and uses the Canny edge detection algorithm to extract raindrop contours and enhance boundary information;
[0077] The morphology analysis module uses a centroid matching algorithm to match raindrops across frames, calculates their velocity, and extracts multi-dimensional morphological parameters such as equivalent diameter, minimum circumcircle diameter, and axis ratio.
[0078] The user interface module adopts a graphical design, which is easy to operate. The interface includes a parameter setting area, a system status display area, and a visualization result display area. Users can adjust camera parameters, start or stop data acquisition, calculate speed and equivalent diameter, and view the speed and diameter analysis results of raindrops through the interface.
[0079] The beneficial effects of this invention are as follows: Compared with existing technologies, this invention has the following significant advantages: It adopts a "record only when there is a change" intelligent triggering mechanism for grayscale changes, which greatly reduces the storage and processing of invalid data compared to continuous recording, significantly increasing the proportion of valid data and saving more than 99% of storage space and subsequent processing resources. It uses area array imaging combined with Canny edge detection to avoid motion distortion and ensure the accuracy of contour extraction and parameter calculation. The area array imaging method can freeze the instantaneous shape of raindrops within a single frame. Combined with a telecentric lens, it ensures the accuracy of raindrop size measurement, overcomes the inherent defects of linear array scanning, and produces realistic images without motion distortion. Six interconnected algorithms form a complete, automated solution with high reliability. It can simultaneously acquire the movement velocity of raindrops (including vertical and horizontal components) and various morphological parameters (equivalent diameter, axial ratio, etc.), providing more comprehensive data support for raindrop microphysics research. The use of multi-threaded architecture and pixel sampling calculation optimization strategies ensures the system's real-time processing capability and fast response at high frame rates. Attached Figure Description
[0080] Figure 1 This is a flowchart of the observation method steps of the present invention;
[0081] Figure 2 This is a block diagram of the observation system of the present invention.
[0082] Figure 3 System software architecture diagram of this invention;
[0083] Figure 4 This is a top view of the observation device;
[0084] Figure 5 This is an elevation sectional view of the observation device;
[0085] Figure 6 Side sectional view of the location of the optical imaging unit of the observation device ( Figure 4 (AA section);
[0086] Figure 7 Side sectional view of the location of the backlight illumination unit of the observation device ( Figure 4 (BB cesarean section);
[0087] Figure 8 Side profile view of the observation area of the observation device ( Figure 4 CC section);
[0088] Figure 9 This is an image of the raindrops falling.
[0089] Figure 10 This is a diagram showing the detection and tracking of water droplets.
[0090] In the diagram: 100-Optical imaging unit, 200-Backlight illumination unit, 300-Central processing unit, 400-Control unit, 500-Communication unit, 600-Power supply unit, 700-Remote center, 1-Area array camera, 2-Telecentric lens, 3-Parallel backlight, 4-Observation area, 5-Rain sensor, 6-Photovoltaic panel, 7-Battery, 8-Sunshade, 9-Sunshade plate, 10-Water guide eaves, 11-Bracket. Detailed Implementation
[0091] To enable those skilled in the art to better understand the present invention, in conjunction with Figures 1-10 To further illustrate this application, the terms "upper," "lower," "left," "right," "inner," and "outer," etc., used in this description indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly understood by those skilled in the art. They are used only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the components or parts referred to must have a specific orientation, or be constructed and operated in a specific orientation. The content mentioned in the embodiments is not intended to limit the present invention.
[0092] The dynamic grayscale-triggered high-speed area array imaging rainfall observation method of this invention combines intelligent triggering, high-speed imaging, precise image processing algorithms, and a professional optical system to achieve high-throughput, automated, and non-contact precise observation of the velocity and morphological parameters of raindrops. A flowchart of the observation method steps is shown below. Figure 1 This includes the following steps:
[0093] Step S1, Image Acquisition and Grayscale Conversion: The area scan camera continuously acquires images of the observation area and converts the acquired color images into grayscale images in real time. A high frame rate area scan camera preferably uses a global shutter CMOS sensor, connected to the central processing unit via USB 3.0 or Camera Link interface to ensure high-speed data transmission and avoid motion distortion that may be caused by rolling shutter. The camera's operating mode is set to continuous acquisition mode, dynamically configuring parameters such as resolution, exposure time, gain, and white balance by calling the manufacturer's SDK. Preferably, to capture rapidly falling raindrops, the exposure time is set to 0.1ms or less to freeze the moment of raindrop movement. To further improve the effective frame rate, Region of Interest (ROI) technology can be used. While maintaining the original image width, the vertical acquisition range (i.e., vertical amplitude) is reduced, for example, an image aspect ratio of 3~5:1, only sampling the central area through which the raindrops pass. Because raindrops primarily fall vertically, it's sufficient to have enough pixels in the vertical direction to capture a single raindrop, minimizing the data volume per frame and thus significantly increasing the frame rate. Specifically, while maintaining full resolution in the horizontal (width) direction, the vertical sampling height is reduced by cropping the top and bottom edges of the image. This local sampling strategy targeting the main falling path of raindrops effectively improves the frame rate while preserving key morphological information. This invention employs ROI technology, enabling the sampling frame rate to reach 396fps or higher.
[0094] The conversion from color to grayscale images employs a weighted average method based on the human eye's brightness perception characteristics. Grayscale conversion involves a weighted summation of the three color channels. Specifically, the red (R), green (G), and blue (B) channel values of each pixel are weighted and calculated to obtain the grayscale value of that pixel. This effectively preserves the brightness information in the image while removing color information, thus achieving the conversion from a color image to a grayscale image. The conversion formula is as follows:
[0095] ,
[0096] in, R , G , BThese represent the values of the red, green, and blue color channels of a pixel, respectively. The weighting coefficients (0.299, 0.587, 0.114) conform to the ITU-R BT.601 standard and more accurately reflect the human eye's sensitivity to different colors (most sensitive to green, followed by red, and least sensitive to blue), thus obtaining a grayscale image that retains more complete information. The conversion process is performed in real-time in the central processing unit, typically converting the original color image (e.g., 24-bit RGB format) to an 8-bit grayscale image (pixel value range 0-255). This significantly reduces the amount of data processed subsequently and improves system real-time performance.
[0097] Based on the grayscale image, the average grayscale value of the image is further calculated to describe the overall brightness characteristics of the image. The calculation formula is as follows:
[0098] ,
[0099] Among them, gray[ i ] is the th element in the grayscale image i The grayscale value of each pixel n This represents the total number of pixels in the image. The physical meaning of this formula is: summing the grayscale values of all pixels in the image and then dividing by the total number of pixels yields the arithmetic mean of the image's grayscale values. It reflects the overall brightness and darkness of the image. A higher value indicates a brighter overall image; a lower value indicates a darker overall image. In actual programming, optimization functions from image processing libraries such as OpenCV can be directly called for calculation (e.g., using the cv2.mean() or numpy.mean() functions) to ensure real-time performance under high-speed acquisition. This calculation is usually performed immediately after grayscale conversion, and the result is output as a floating-point number or integer value, serving as the core feature value characterizing the brightness state of that frame. In rainfall observation systems, one of the core purposes of calculating the average grayscale is to provide a benchmark or judgment basis for the subsequent "dynamic grayscale triggering" mechanism. For example, when no raindrops pass through the observation area, the average grayscale of the background image will remain at a relatively stable benchmark level; when raindrops pass through, the scattering and refraction of light by the raindrops will cause changes in the grayscale of the local and even the overall image, resulting in significant fluctuations in the average grayscale value. The system can monitor the changes in this value in real time, and when it exceeds a preset threshold range, it triggers the subsequent image saving and processing process.
[0100] Step S2, Dynamic Triggering and Sequence Saving: The average grayscale difference between the current frame and the previous frame is calculated in real time. When this average grayscale difference exceeds a preset trigger threshold, it is determined that a raindrop has entered the field of view. The system then triggers the saving of a continuous image sequence starting from the determination moment, and timestamps each frame. The image sequence saving and timestamp marking are as follows: Sequence Length Setting: The length of the image sequence saved after triggering (i.e., the number of frames) is predefined and should ensure that the entire process of a raindrop entering and leaving the field of view is completely recorded. This length can be determined by comprehensively calculating based on the expected falling speed of the raindrop, the height of the observation area, and the camera frame rate. Buffer Management: The system maintains a circular buffer (FIFO queue) in memory to continuously store the latest continuous image frames. When the trigger condition is met, the system not only saves the frames after the trigger point but also saves a predetermined number of frames before the trigger point in the buffer, thus capturing the complete moment of the raindrop entering the field of view. High-Precision Timestamps: The timestamps marked for each frame should have high precision (e.g., accurate to milliseconds), using the system's high-precision clock. Timestamp information can be embedded in image file metadata (such as EXIF information) or recorded separately in a synchronized log file, providing a precise time reference Δ for subsequent calculations of raindrop velocity. t ;
[0101] To reduce computational load and ensure real-time performance at high frame rates, not all pixels in the image are fully calculated. A grid sampling method (e.g., taking one point every N pixels) or a random sampling method can be used to select a certain number (m) of representative pixels for calculation. The method for calculating the average grayscale difference is as follows: using the absolute difference method, the absolute value of the grayscale difference between the current frame and the corresponding sampled pixels in the previous frame is calculated. This is combined with spatially spaced pixel sampling to calculate the average absolute value of the grayscale difference of all sampled pixels, thus obtaining a robust average grayscale difference value. The calculation formula is as follows:
[0102] ,
[0103] Among them, gray[ j ] and gray prev [ j [The following are the references to the current frame and the previous frame, respectively.] j The grayscale value of each sampled pixel. m This represents the total number of sampling points.
[0104] Adaptive setting of preset trigger threshold: Multiple background images are continuously acquired over a period of time under conditions of initial system startup or a static background without raindrops. The average grayscale difference sequence between these background frames is calculated. Based on the background frame difference sequence, its average grayscale value is calculated. μ bg and grayscale standard deviation σbg Set the preset trigger threshold T Set as:
[0105] ,
[0106] in, K This is a fixed value greater than 1, determined experimentally based on the system's requirements for false alarm rate and detection rate. This method allows the threshold to adapt to minute fluctuations in ambient light, improving trigger accuracy. For example, after system deployment but before formal observation, N frames (e.g., N=100) of background images are continuously acquired under rain-free conditions. A sequence of average grayscale differences between adjacent frames is calculated, and the average value of this sequence is obtained. μ with standard deviation σ . K A fixed value (e.g., 1.0~2.0) can be directly set based on experimental experience. This method ensures that the threshold can adapt to the background noise of different environments, effectively distinguishing background noise from real raindrop signals. To avoid false triggering caused by noise or slight disturbances, a hysteresis comparison mechanism can be introduced, that is, when... > T It will be triggered at any time, but you have to wait until... Falling back to a lower threshold (e.g.) T low =0.8 T After this, the system will prepare to respond to the next trigger, preventing a single event from being judged repeatedly.
[0107] Step S3: Raindrop Contour Extraction: Apply the Canny edge detection algorithm frame by frame to the saved image sequence to identify and extract the contours of all raindrops in each frame. Specific implementation process and technical details:
[0108] Step S31: Input Image Preprocessing and Enhancement: The input source is the time-stamped grayscale image sequence saved in step S2. Since raindrops appear as dark silhouettes under backlight, their edges represent the areas with the most dramatic grayscale changes in the image, providing ideal conditions for edge detection. First, Gaussian filtering is performed, using a Gaussian kernel to convolve the grayscale image to smooth noise. Gaussian filtering combines the image with the Gaussian kernel through convolution, and its mathematical expression is:
[0109] ,
[0110] in, σ It is the standard deviation of the Gaussian kernel in the raindrop observation scenario. σ The value of directly determines the smoothness (blurring) of the filter. σThe larger the value, the flatter the "bell" curve of the Gaussian kernel, the larger the neighborhood it covers, the stronger the smoothing (blurring) effect on the image, and the more effectively it can suppress noise. However, it may over-smooth the edges of raindrops, resulting in smaller extracted contour sizes and loss of details. σ The smaller the value, the more concentrated the Gaussian kernel, the weaker the smoothing effect, and the better it can preserve edges, but the noise reduction ability is also weakened accordingly, which will produce false edges. σ An optimal [condition] needs to be determined experimentally based on the actual noise level of the image and the size of the raindrops. σ The value (e.g., adjusted in the range of 1.0 to 2.0 pixels) is used to strike a balance between edge positioning accuracy and noise resistance. e and π These are the natural constant and pi, respectively. The normalization coefficients ensure that the sum of all elements in the Gaussian kernel is 1, so that the overall brightness of the image does not change after the convolution operation. Gaussian filtering can effectively remove high-frequency noise from images while preserving edge information.
[0111] Step S32, Gradient Calculation and Direction Estimation: When calculating the gradient magnitude and direction, the Sobel operator is used, and two specific 3×3 convolution kernels are used to extract the image. I exist x Upward gradient I x and images I exist y gradient in direction I y , I x This represents the rate of change of the image in the horizontal direction; I y To represent the rate of change of the image in the vertical direction;
[0112] Horizontal gradient kernel (used for calculation) I x ):
[0113] ,
[0114] Its function is to highlight vertical edges. Because the middle column of the kernel is 0, and the left and right columns have opposite signs, as it slides across the image, it calculates the difference between a pixel's "right" and "left" neighbors. The greater the difference, the more likely the pixel is located on either side of a vertical edge. I x The larger the absolute value, the greater;
[0115] Vertical gradient kernel (used for calculation) I y ):
[0116] ,
[0117] Its function is to highlight horizontal edges. Because the middle row of the kernel is 0, and the upper and lower rows have opposite signs, it calculates the difference between a pixel's "below" and "above" neighbors. The larger the difference, the more likely the pixel is located above or below a horizontal edge. I y The larger the absolute value, the greater;
[0118] The convolution calculation process, for a pixel in an image ( i , j ), its gradient value I x ( i , j )and I y ( i , j It is obtained through convolution operations: the gradient kernel is... G x The center and the pixel to be calculated ( i , j Alignment is performed by multiplying the image pixel values within the 3×3 region covered by the kernel by the weights at the corresponding positions in the kernel. Then, all nine product results are summed. The sum represents the pixel's position within the kernel. x gradient value in direction I x Similarly, using gradient kernels G y available I y The calculation formula is:
[0119] ,
[0120] ,
[0121] in, u and v It is a coordinate index variable inside the convolution kernel, which defines the coordinate offset of each position inside the convolution kernel relative to its center point. u = -1 indicates the left column, u =0 indicates the center column. u=+1 indicates the column on the right; v = -1 indicates the row above. v =0 indicates the center row. v =+1 indicates the next row; G x ( u , v )yes x The gradient operator in the direction at position ( u , v The value of ) I ( i + u , j + v ) is the image at position ( i + u , j + v The pixel value of ); G y ( u , v )yes y The gradient operator in the direction at position ( u , v The value of ) I ( i + u , j + v ) is the image at position ( i + u , j + v The pixel value of );
[0122] Calculate the gradient magnitude of each pixel. I With direction, I For image I The gradient magnitude represents the total rate of change of the image at that point; gradient magnitude I The calculation formula is:
[0123] ,
[0124] in, I For image I The gradient magnitude; I x For image I exist x An upward gradient; Iy For image I exist y Gradient in direction;
[0125] Gradient direction angles in four quadrants θ The calculation formula is:
[0126] .
[0127] Step S33, Non-maximum Suppression (NMS): By comparing the gradient magnitude of each pixel with two pixels in its neighborhood along the gradient direction, only pixels with a local maximum gradient magnitude in the gradient direction are retained. If the gradient magnitude of the current pixel is the largest among these three points, it is retained as a potential edge point; otherwise, its gradient magnitude is set to zero (i.e., suppressed). Pixels with non-edge gradient magnitudes are removed, and the edges are refined to make them clearer. This step effectively eliminates the blurring of edges, resulting in sharp, single-pixel wide edges. The core purpose is not simply to "remove non-edge points," but to refine the edges, ensuring that the edge response is a single-pixel wide, clear line.
[0128] Step S34, Dual-threshold hysteresis connection: Apply high and low thresholds to filter strong and weak edge points, and connect weak edges connected to strong edges to form a complete edge contour. The high threshold is set experimentally (…). T high ) and low threshold ( T low ),and T low ≈0.4× T high Or it can be determined experimentally. Strong edge points: gradient magnitude I > T high These points are almost certainly real raindrop edges; weak edge points: T low Gradient magnitude I ≤ T high These points could be edges or noise. Connection logic: Starting from all strong edge points, weak edge points are searched within their 8-neighborhoods. Any weak edge point connected to a strong edge point is accepted and promoted to a strong edge point, thus forming a complete and continuous raindrop contour. Isolated weak edge points not connected to any strong edge are discarded and considered noise. Contour extraction: For the binary image after double thresholding, the `cv2.findContours()` function (setting the search mode to `RETR_EXTERNAL` to only retrieve the outermost contour) is called to find all connected pixel sets, i.e., the final extracted contour of each raindrop. These contours are stored as point sets, providing the basis for subsequent matching and morphological parameter calculations.
[0129] Step S4, Raindrop Matching and Tracking: Calculate the centroid coordinates and circumscribed geometric parameters of each raindrop profile. Then, based on centroid spatial proximity, profile area consistency, and physical plausibility of motion direction, perform cross-frame matching and tracking of the same raindrop in multiple consecutive frames. Specific implementation process and technical details: Calculate a unique feature descriptor for each detected raindrop profile for subsequent matching comparison. These features include:
[0130] centroid coordinates ( Cx , Cy The geometric center of the raindrop's outline is denoted by , which is obtained by calculating image moments. The calculation formula is as follows:
[0131] ,
[0132] in, M 00 It is the zeroth moment of the profile (i.e., the area of the profile). M 10 and M 01 These are first-order moments;
[0133] Circumscribed geometric parameters: Contour area A, the total number of pixels enclosed by the contour; circumscribed rectangle, the smallest rectangle that completely encloses the contour, providing its width, height, and orientation; minimum circumscribed circle diameter. D min .
[0134] The core of the matching process is to solve a data association problem, that is, to determine the first... t Raindrops in the frame i With the t Raindrops in +1 frame j Whether they are the same physical raindrop. The matching decision is based on a weighted comprehensive evaluation of the following three criteria:
[0135] Rule 1: Centroid Spatial Proximity. Due to the extremely high camera frame rate, the displacement of the same raindrop between two consecutive frames is limited; therefore, its centroid coordinates should be very close. (Calculate the raindrop's centroid coordinates.) i With raindrops j Euclidean distance between the centroids:
[0136] ,
[0137] in, Cx i and Cy i Representing points respectively i In two-dimensional space x coordinates and y coordinate; Cx j and Cy j Representing points respectively j In two-dimensional space x coordinates and y coordinate;
[0138] Set a maximum search radius R max (Unit: pixels). Only when d ij < R max Only when this condition is met are they considered potential matches. R max Estimated based on the maximum expected raindrop velocity and frame interval. The maximum expected raindrop velocity can be referenced from historical data, or taken as 6~10 m / s (which needs to be multiplied by 10000 to convert to mm / s). The frame interval is taken from the camera frame rate. f The maximum search radius is the reciprocal of the product of the two (the two values), divided by the spatial scaling factor, and converted to pixels. R max ;
[0139] Rule 2: Consistent profile area; the size of raindrops does not change drastically within a very short time interval. Calculate raindrop size. i With raindrops j relative differences in area Set a maximum area change rate threshold. T A (For example, 20%), only when Δ A ij < T A Only then is the match considered reasonable in the area dimension;
[0140] Rule 3: Physical rationality of motion direction. Raindrops are primarily affected by gravity, and their trajectory should be smooth and conform to physical laws within a short period of time, making instantaneous reversals or right-angle turns impossible. For raindrops that have been successfully tracked for more than two frames, their current velocity vector can be fitted based on their historical centroid coordinates. Calculate the predicted location and candidate raindrops in the next frame. j The deviation from the actual position should be within a reasonable range. This criterion effectively avoids mismatches caused by raindrop intersections and overlaps.
[0141] The tracking process involves creating a new tracker for each raindrop profile in the first frame and assigning it a unique ID for initialization. For each existing tracker, its possible position in the current frame is predicted based on its previous motion velocity. All raindrop profiles (observations) detected in the current frame are associated with all active trackers (predictions) using the Hungarian algorithm (or a similar optimal assignment algorithm). The Hungarian algorithm is a multinomial-time algorithm for solving assignment problems. Its cost matrix is a linear or nonlinear weighted combination of the three criteria (distance, area difference, motion consistency), aiming to find the globally optimal matching pair. Successfully matched raindrops are associated with trackers, and the tracker's state is updated with the raindrop's latest features (centroid, area, etc.) (e.g., using Kalman filtering for smooth estimation). If a tracker fails to find a match for several consecutive frames, its corresponding raindrop has left the field of view, and tracking terminates. Raindrop profiles in the current frame that do not match any existing trackers are initialized as new trackers (new raindrops enter the field of view). The sequence of centroid coordinates of the same raindrop in different frames that are successfully matched constitutes the raindrop's falling trajectory.
[0142] Step S5, Motion Speed Calculation: Based on the centroid pixel displacement (Δ) of the same successfully matched raindrop between consecutive frames. x , Δ y Image acquisition time interval Δ t and spatial calibration scaling factor S w and S h Calculate the velocity components of raindrops in the horizontal and vertical directions. v x and v y and combined speed v The specific process is as follows:
[0143] Data Input and Preprocessing: The input source is the successful output of step S4 (raindrop matching and tracking), which is the sequence of timestamped centroid coordinates of the same raindrop in different frames. For example, raindrop ID-001 at time point... t , t +1, t The centroid coordinates of +2,... are respectively ( x t , y t ),( x t+1 , y t+1 ), ( x t+2 , yt+2 ),.... Calculate the pixel displacement Δ of the raindrop centroid in the horizontal and vertical directions between two consecutive frames. x and Δ y Horizontal pixel displacement Δ x = x t+1 - x t Vertical pixel displacement Δ y = y t+1 - y t In the image coordinate system, the origin (0,0) is located at the top left corner. y Since the positive direction of the axis is downward, for a falling raindrop, Δ y It is a positive value;
[0144] Accurate acquisition of spatial calibration scaling factor: Raindrop velocity calculation, first calculate the image width direction based on the actual width and height of the image and the set resolution ( x (axis) and height direction ( y Spatial calibration scaling factor (axis) S w and S h Spatial calibration scaling factor S w and S h (Unit: mm / pixel) is crucial for converting pixel displacement into actual physical displacement (unit: mm). This requires rigorous camera calibration. The calibration method involves placing a calibration board of known precise dimensions (e.g., a checkerboard or circular calibration board) in the observation area and photographing the board. The actual width and height of the image on the calibration board are then measured. W and H (Unit: mm) The corresponding pixel width and height in the image. W pixels and H pixels (Unit: pixel l). Using a telecentric lens can effectively eliminate perspective errors, ensure a constant scale factor throughout the entire observation area, prevent lens distortion, and spatially calibrate the scale factor. S w and S h Equality is a crucial foundation for achieving accurate measurement. The calculation formula is:
[0145] ,
[0146] ;
[0147] Image displacement calculation: Convert pixel displacement into actual physical displacement using a scaling factor, the horizontal image displacement Δ X =Δ x · S w (Unit: mm), Vertical physical displacement Δ Y =Δ y · S h (Unit: mm);
[0148] Time interval Δ t Precise determination of: Δ t The frame interval for image acquisition is given by the inverse of which is the camera frame rate. f , that is, Δ t =1 / f To ensure the accuracy of speed calculations, a high-precision, stable timestamp is required. The timestamp should be directly derived from the camera's hardware trigger signal or the system's high-precision clock.
[0149] Calculate the raindrop velocity components and resultant velocity based on the positional changes and time intervals of the raindrops in consecutive frames:
[0150] The horizontal velocity component of the raindrop is:
[0151] , ,
[0152] The vertical velocity component of the raindrop is:
[0153] , ,
[0154] Where, Δ t The time interval for image acquisition;
[0155] The resultant velocity of the raindrops is:
[0156] ;
[0157] Optimization and statistics of velocity calculation: To reduce random errors in a single calculation, the velocity values of the same raindrop can be calculated across multiple consecutive frames (e.g., ...). v t , v t+1 , v t+2 ...) Calculate the average value as the final velocity of the raindrop within the corresponding time period to make the results more robust.
[0158] Step S6, Morphological Parameter Calculation: Based on the identified raindrop contour pixel information, a complete calculation chain for three key morphological parameters is established. Starting from the contour pixel information, through geometric fitting and physical unit conversion, numerical values with clear physical meaning are finally obtained. Equivalent diameter D equiv Minimum circumcircle diameter D min and shaft ratio a / b Together, they constitute a multidimensional morphological feature system describing raindrop size, envelope, and shape, providing a solid data foundation for in-depth microphysical analysis of rainfall;
[0159] The equivalent diameter is the diameter corresponding to a circle with an equal area when the raindrop profile is considered. It is used to quantify the overall size of the raindrop and is a core parameter describing raindrop size, widely used in the study of raindrop spectral distribution and precipitation kinetic energy estimation. First, from the raindrop profile pixel information extracted in step S3, the pixel area Apixels (i.e., the total number of pixels within the profile) enclosed by the profile are directly obtained. The spatial scaling factor calibrated in step S5 is then used... S w or S h (Unit: mm / pixel) Convert pixel area to actual physical area A (Unit: mm²)
[0160] or ,
[0161] According to the formula for the area of a circle, A = π ( D equiv / 2) 2 The equivalent diameter is obtained by inverse solution. D equiv :
[0162] ,
[0163] in, A The actual physical area of the raindrop's outline, in mm. 2 This area is obtained by converting the outline area from pixel units to actual physical units.
[0164] minimum circumcircle diameter D min It is the diameter of the smallest circle that can completely enclose the outline of a raindrop, reflecting the size of the raindrop's envelope. D min This provides the static minimum envelope size of the raindrop at the moment of imaging, a parameter that can serve as a characteristic size reference for studying raindrop aerodynamic properties (such as drag coefficient estimation). Minimum circumcircle diameterD min The minimum bounding circle of the raindrop profile is fitted. First, an OpenCV function is used to fit the minimum bounding circle of the raindrop profile. This is done by directly calling the `cv2.minEnclosingCircle()` function from the OpenCV library. The input to this function is the set of points representing the raindrop profile, and the output is the coordinates of the center of the fitted circle. x , y ) and radius r (Unit: pixels). Minimum circumcircle diameter D min That is, twice the radius. D min =2× r ;
[0165] Similarly, the spatial scaling factor also needs to be utilized. S w or S h Convert the diameter in pixels to physical dimensions (unit: mm):
[0166] or .
[0167] Shaft ratio a / b The axial ratio is used to quantify the degree to which the raindrop's shape deviates from a spherical shape and is a key parameter describing raindrop morphology (such as spherical or ellipsoidal). First, an ellipse fitting is performed. Based on the raindrop's closed contour obtained in step S3, the OpenCV function `cv2.fitEllipse()` is called to perform least-squares ellipse fitting. This function returns an ellipse containing the coordinates of the ellipse's center (…). x , y ), length of main spindle and secondary spindle ( w , h (unit: pixels), and rotation angle β The structure. Among them... w and h These are the diameters of the ellipse along the major and minor axes, respectively. Since the order of axis lengths returned by OpenCV is related to the ellipse's direction, the major axis needs to be determined by comparison. a With short axis b :
[0168] ,
[0169] Here a and b Let be the semi-major and semi-minor axes (radii) of the ellipse, and let be the axial ratio of the raindrop. ARThe ratio of the major axis diameter to the minor axis diameter is given by the fact that the radius ratio and diameter ratio yield the same result. Therefore, it can be directly calculated from the semi-axis length ratio, as shown in the following formula:
[0170] ,
[0171] when AR When the value is 1, the raindrops are ideally spherical; AR When the axial ratio is greater than 1, the raindrop stretches along its long axis and becomes ellipsoidal. The larger the value, the more significant the deformation of the raindrop due to air resistance during its descent. The axial ratio is an important input parameter for studying the falling attitude, deformation dynamics, and scattering characteristics of raindrops in radar remote sensing.
[0172] Step S7, Result Output: Summarize and output the set of motion velocity and morphological parameters of all measured raindrops. The implementation process is as follows:
[0173] Data aggregation and structuring: The core of this step is to integrate the processing results of steps S4 (raindrop matching and tracking), S5 (velocity calculation), and S6 (morphological parameter calculation) to generate a complete, structured data record for each successfully tracked raindrop. Each record must contain at least the following information:
[0174] Raindrop unique identifier (ID): Used to distinguish different individual raindrops. Includes: timestamp information, recording the frame timestamps of the first and last time the raindrop was identified and tracked, and the time span of the entire trajectory; a set of motion parameters, including the horizontal velocity component. v x Vertical velocity component v y Combined speed v The coordinate sequence of each point on the trajectory; the set of morphological parameters, and the equivalent diameter. D equiv Minimum circumcircle diameter D min Shaft ratio AR The quality flag is used to indicate the reliability of this record.
[0175] Output Format and Persistence: All calculated raindrop data will be output and saved in a standardized format that is easy for subsequent analysis and processing. Main Output Formats – Structured Data Files: CSV (Comma-Separated Values) File: This is the most commonly used and universal format. The first row contains column headers (e.g., Raindrop_ID, Start_Time, End_Time, Vx, Vy, Velocity, Dequiv, Dmin, Axis_Ratio), and each subsequent row represents all parameters for a single raindrop. This format can be directly read and analyzed by tools such as Excel, Python (Pandas library), and MATLAB. JSON (JavaScript Object Notation) File: This format is better suited for expressing hierarchical structures. It can store all raindrop data as an array, with each raindrop's information being an object containing various key-value pairs. This is very convenient for network transmission and programmatic reading. The output data file should contain a complete set of parameters for all processed raindrops from a single rainfall observation.
[0176] Visualization and Statistical Information Output: In addition to raw data files, the system can generate intuitive visualization charts and statistical summaries to help users quickly grasp the overall rainfall characteristics. Visualization Charts: Raindrop spectral distribution map, showing the number or volume percentage of raindrops with different equivalent diameters; velocity-diameter scatter plot, showing the relationship between the final velocity and diameter of raindrops, which can be compared with classic theoretical models (such as the Gunn-Kinzer relationship); trajectory overlay map, drawing the trajectory of all raindrops on a background image; Statistical Summary: Outputs statistical information for this rainfall event, such as: total number of raindrops, average diameter, median diameter, average velocity, and rainfall intensity (requires integration with other sensors or estimation methods).
[0177] Data storage and transmission: Local storage: Structured data files and visualization results are stored in a designated storage path on the central processing unit and archived according to information such as observation time. Remote transmission: Key observation results and data files are transmitted to a remote center via communication units, enabling remote monitoring and centralized management of the data.
[0178] The dynamic grayscale triggered high-speed area array imaging rainfall observation system of the present invention mainly consists of an optical imaging unit 100, a backlight illumination unit 200, a central processing unit 300, a control unit 400, a communication unit 500, a power supply unit 600, and a remote center 700. The principle block diagram of the observation system is shown below. Figure 2 The specific composition, technical details, and collaborative working mechanisms of each unit are as follows:
[0179] The optical imaging unit 100 comprises a core component including an area scan camera 1 and a telecentric lens 2. The area scan camera 1, acting as an image sensor, requires a high frame rate and is preferably a global shutter CMOS sensor. It connects to the central processing unit 300 via a high-speed interface such as USB 3.0 or Camera Link. Its high frame rate shortens the shooting interval and increases the sampling rate, ensuring that multiple (e.g., dozens) images can be captured continuously within the extremely short time of a single raindrop's fall, thus enabling analysis of the continuous process of the action. The telecentric lens 2 is a key optical component for achieving accurate measurement. Its unique optical design ensures that the magnification remains constant within a certain object distance range, thereby ensuring that raindrops at different spatial positions have a consistent size ratio in the image, laying the foundation for accurate size measurement. The combination of the area scan camera 1 and the telecentric lens 2 constitutes a backlight imaging system for high-speed, distortion-free imaging. As raindrops fall, the telecentric lens 2 images the silhouette of the raindrops onto the sensor of the area array camera 1 at a constant magnification, effectively eliminating perspective errors. This means that raindrops at different spatial positions (such as near and far ends of the lens) will appear as the same pixel size in the image as long as their physical size is the same, laying a solid foundation for subsequent accurate morphological parameter calculations (such as equivalent diameter).
[0180] The aperture of telecentric lens 2 should ideally be 100-200mm; a larger aperture provides a wider field of view. The smaller the telecentricity, the better, typically ≤ 0.1 degrees. Lens distortion should be extremely low, usually <0.1%. Telecentric lenses have a fixed magnification, generally 0.05× to 2.0×. Lower magnification lenses, such as 0.05× to 0.5×, are suitable for large-field-of-view inspections. A 150mm aperture, 0.05× magnification double telecentric lens is recommended. For example, the VSvision BT-1237 series or the OPT TC series telecentric lenses can be selected. The target face diagonal of the area array camera 1 and the magnification of the telecentric lens 2 together determine the system's field of view. The area array camera 1 should be paired with the telecentric lens 2. The sensor size should be as large as possible to ensure a sufficiently large target surface compatible with a large-aperture lens, such as 1 / 1.2 inch or 1 inch. The resolution should meet the basic requirements for field of view coverage and measurement accuracy. A global shutter should be used to capture high-speed raindrops without distortion. The parameters for the area array camera 1 and telecentric lens 2 are as follows: the optical lens uses a 150mm aperture, 0.05× magnification dual telecentric lens; the image sensor size of the area array camera 1 is 1 / 1.2 inch, and the resolution is set to 1920×480. This combination achieves a spatial resolution of 11.3 lp / mm, a pixel-to-pixel scaling factor of approximately 0.044 mm / pixel, an exposure time of 0.1 ms, and a measured frame rate of 396 fps using ROI technology. Its high frame rate ensures continuous multi-frame capture of a single falling raindrop, thereby accurately calculating its trajectory and speed. At the same time, the extremely short exposure time (0.1ms) can effectively freeze the instantaneous posture of raindrops and avoid motion blur.
[0181] The backlight illumination unit 200, whose core component includes a parallel backlight source 3, employs a high-density, uniformly arranged monochromatic LED array as the light source. The monochromatic light source effectively avoids the dispersion phenomenon caused by composite light (white light), ensuring sharp and clear edges of the raindrop silhouette, thereby improving the accuracy of subsequent edge detection and dimensional measurement. The monochromatic parallel backlight source can be selected from green LEDs with a center wavelength of 520nm or infrared LEDs with a wavelength of 850nm. The backlight illumination unit 200 is equipped with optical components such as a diffuser plate and a brightness enhancement film, which can transform the discrete LED point light source into a high-quality surface light source with highly uniform brightness and no hot spots or dark areas, providing stable and uniform parallel background light for the optical imaging unit 100. The size of the parallel backlight source 3 should be larger than the aperture of the telecentric lens 2 to ensure uniform brightness at the edge of the field of view. Matching a sufficiently large parallel backlight source provides excellent incident light conditions, ensuring that the edges and center of the image acquired by the lens are equally clear and accurate, fully utilizing the performance of the telecentric lens. The backlight unit 200 can be a square with a side length of 200~300mm, for example, a square with a side length of 250mm, or a rectangle with a height slightly smaller than its width, for example, 250mm wide and 200mm high. The size of the backlight unit 200 should preferably be 1.5 to 2 times the diameter of the telecentric lens 2 to ensure uniform light source when installing the telecentric lens 2.
[0182] The observation area 4 is located between the optical imaging unit 100 and the backlight illumination unit 200. Raindrops fall freely through the observation area 4. As opaque objects, the raindrops, illuminated by the parallel backlight source 3, are imaged on the area array camera 1 using the principle of backlighting. This results in a high-contrast, sharp-edged, dark silhouette image on the camera 1 via the telecentric lens 2. This high-contrast imaging effect is a prerequisite for the subsequent Canny edge detection algorithm to accurately extract the raindrop contours.
[0183] The Central Processing Unit (CPU) 300, acting as the brain of the device, has a built-in computing and control system configured to perform image acquisition control, dynamic grayscale trigger judgment, raindrop image processing, motion and morphological parameter calculation, and result output. The CPU 300's built-in computing and control system software employs a modular design, comprising four core modules: image acquisition, image processing, morphological analysis, and user interface. (See...) Figure 3 ;
[0184] Image acquisition module: Based on the camera SDK, camera parameters (resolution, exposure time, gain, etc.) are dynamically configured. Images are accurately acquired through a dynamic grayscale triggering mechanism. A multi-threaded architecture ensures efficient system operation at high frame rates. The system monitors the image sequence in real time, only instructing the saving of the image sequence when a grayscale change that meets certain conditions is detected.
[0185] Image processing module: Converts images to grayscale, transforms acquired color images into grayscale images, and uses the Canny edge detection algorithm to accurately extract raindrop contours in each frame, enhancing boundary information;
[0186] Morphological analysis module: This is the core of the algorithm. It matches raindrops across frames using a centroid matching algorithm, performing centroid calculation, cross-frame matching, and motion velocity calculation. v x , v y , v ) and calculation (equivalent diameter) D equiv Minimum circumcircle diameter D min Shaft ratio AR Multidimensional morphological parameters such as )
[0187] User interface module: It adopts a graphical design and is easy to operate. The interface includes a parameter setting area, a system status display area, and a visualization result display area. Users can adjust camera parameters, start or stop data acquisition, calculate speed and equivalent diameter, and view the speed and diameter analysis results of raindrops through the interface.
[0188] The Central Processing Unit 300 serves as the intelligent core of this observation system, employing a microcomputer. Existing microcomputers are relatively small, typically around 150mm in length, width, and height, suitable for field detection equipment. Despite its small size, it is an embedded high-performance computing platform deeply customized for high-speed machine vision, edge computing, and field industrial applications. Its core requirements are to achieve a balance across five dimensions: computing performance, interface bandwidth, storage speed, system stability, and environmental adaptability. This ensures the entire rainfall observation system can reliably and continuously complete fully automated, high-precision tasks from "imaging" to "results" 24 / 7, meeting the system's needs in high-speed image acquisition, real-time processing, and long-term stable operation in the field. Core hardware configuration:
[0189] A high-performance multi-core CPU is essential for real-time image processing of hundreds of frames per second (including complex algorithms such as grayscale conversion, differential calculation, Canny edge detection, contour analysis, and multi-object tracking). The CPU should possess powerful multi-core parallel computing capabilities to smoothly execute intensive computational tasks. A dedicated or high-performance integrated GPU is also crucial, as image processing algorithms (such as convolution and matrix operations) heavily rely on parallel computing. A dedicated graphics card or high-performance integrated graphics card with CUDA or OpenCL support can significantly accelerate related operations in libraries such as OpenCV, which is key to achieving real-time processing.
[0190] It features a rich array of high-speed peripheral interfaces, providing high-speed data interfaces such as USB 3.0 / 3.1 or Camera Link to meet the data transfer bandwidth requirements of the area scan camera 1, which can reach hundreds of MB / s. It also provides GPIO (General Purpose Input / Output) or relay control interfaces for sending commands to the control unit 400 to precisely control the switching of the backlight illumination unit 200. Storage and expansion interfaces include M.2 NVMe or SATA 3 interfaces to support high-speed solid-state drives for quickly writing triggered image sequences and calculation results. Multiple USB ports and Ethernet ports are available for connecting rain sensors, debugging equipment, and accessing the 4G / 5G or fiber optic modules of the communication unit 500.
[0191] A high-capacity, high-speed storage system is required, with at least 8GB of DDR4 memory, and 16GB or higher is recommended. This large memory is used to create a circular buffer for temporary storage of rapidly acquired continuous image sequences, ensuring dynamic triggering and preventing data loss. Non-volatile storage should be provided, using a high-speed solid-state drive (SSD) with a capacity sufficient for extended fieldwork (e.g., 512GB or 1TB), to store the operating system, processing programs, saved trigger image sequences, and the final structured observation data results.
[0192] The software development environment fully supports languages such as Python and C++, and stably runs core image processing and scientific computing libraries such as OpenCV, NumPy, and SciPy, which is the foundation for implementing all algorithm modules.
[0193] The control unit 400 integrates a rainfall sensor 5, which is used to sense the start and end of rainfall and to automatically control the device to start or go into standby mode. The control unit 400 is connected to the central processing unit 300. When the rainfall sensor 5 detects rainfall, it automatically sends a signal to the central processing unit 300 to activate the observation system. The rainfall sensor 5 is a device for detecting whether rainfall has occurred. The sensing probe contains two sets of parallel electrodes spaced apart and not connected to each other. The electrodes are made of conductive materials, such as metal or a special conductive coating. The control unit 400 uses a comparator to determine the change in resistance. In the absence of rainfall, the electrodes are insulated, and the resistance between them is extremely high, almost infinite. The comparator's input receives the signal from the electrodes; due to the high resistance, the comparator outputs a low voltage. When raindrops fall on the electrodes, because water is conductive, it forms a conductive path between the electrodes, causing a significant decrease in resistance, and the comparator outputs a high voltage. The control unit 400 determines whether rainfall has occurred based on the comparator's output voltage. The probe of the rainfall sensor 5 is installed on the upper part of the observation device at a slight tilt, so that the accumulated water can be quickly drained when the rain stops.
[0194] The control unit 400 is an embedded hardware system based on a microcontroller (MCU). Its core functions are "sensing" and "controlling," acting as a bridge between the central processing unit 300 and the external physical world (rain sensor, backlight). A low-power MCU with sufficient GPIO (general purpose input / output) pins and communication interfaces (such as UART, I2C) is selected, such as STMicroelectronics' STM32 series, Espressif's ESP32 series, or Microchip's AVR series. The rain sensor 5 is connected to a voltage comparator, which outputs a high / low level digital signal to the MCU, thereby converting the analog signal into a reliable digital switching signal. The driver circuit for controlling the backlight unit 200 includes a relay or solid-state relay (SSR) and a transistor / MOSFET driver circuit. The MCU's GPIO pins have weak driving capabilities (typically only a few mA), making it unable to directly control the relay coil (requiring tens of mA) or the backlight (requiring larger current). The function of this driver circuit is to use a small current control (MCU pin) to control the switching of a large current (backlight power supply). The connection between the control unit 400 and the central processing unit 300 adopts the asynchronous serial port (UART) protocol. The MCU of the control unit 400 is connected to the serial port (or USB to serial port) of the central processing unit 300 (such as a microcomputer) through the UART interface.
[0195] In standby mode, the microcontroller (MCU) of control unit 400 continuously monitors the signal from rain sensor 5 via its GPIO pins. When rainfall begins, the signal from rain sensor 5 changes and is detected by the MCU. After confirming the validity of the rainfall signal (through simple software debouncing or delayed confirmation), the MCU immediately sends a predefined digital code, such as "RAIN_START," to central processing unit 300 via UART serial port. Upon receiving the "RAIN_START" signal, central processing unit 300 initiates the entire observation process. Subsequently, it sends control commands, such as "LIGHT_ON," to the MCU of control unit 400 via the same UART serial port. After parsing the "LIGHT_ON" command, the MCU of control unit 400 immediately controls a designated GPIO pin to output a high level. This high-level signal drives the relay drive circuit, causing the relay to engage, thereby connecting the power supply circuit of backlight illumination unit 200 and illuminating the parallel backlight 3. Simultaneously, central processing unit 300 controls the area array camera 1 of optical imaging unit 100 to enter working state. When the rainfall ends, the rain sensor 5 will not output a signal for a period of time. The MCU will send a "RAIN_STOP" signal to the central processing unit 300. After completing the subsequent data processing, the central processing unit 300 will continue to monitor the dynamic grayscale trigger signal. When the system does not detect raindrops for a preset time period (e.g., 5 to 10 minutes), it will determine that the rainfall event has ended. The central processing unit 300 will send a "LIGHT_OFF" instruction to the control unit 400. After receiving the instruction, the MCU of the control unit 400 will set the control pin to a low level, the relay drive circuit will stop working, the relay will be disconnected, the backlight will be turned off, and the system will enter a low-power standby state.
[0196] The communication unit 500 serves as the "data bridge" and "nerve center" connecting the field observation device and the remote management center, responsible for the remote transmission of observation data and the reception of remote control commands. At its core, the communication unit 500 consists of one or more industrial-grade communication modules, connected to the central processing unit 300 via standard interfaces (such as USB or Mini-PCIe). The communication unit 500 employs a wireless communication module, supporting industrial-grade wireless routers or modem modules with 4G LTE or 5G networks, and is equipped with a SIM card slot. This is the primary method for providing internet access to devices deployed in remote, wired network environments. The module should possess excellent signal reception capabilities and anti-interference characteristics. The communication module connects to the central processing unit 300 via a high-speed bus (such as USB 3.0 or PCIe), and is recognized as a network device by the operating system, thus establishing a physical link. The central processing unit 300 packages and transmits the output structured result data (such as the ID, velocity, equivalent diameter, axial ratio, and other parameter sets for each raindrop) to the remote center 700 via the communication unit 500. The central processing unit 300 periodically or on demand sends "heartbeat packets" or status reports of the observation device to the remote center 700 via the communication unit 500. These reports include system operating time, battery level (power supply unit 600 status), network signal strength, camera temperature, and error logs, for remote health diagnosis. The management software of the remote center 700 sends control commands to the observation device through the same communication link. After receiving the command data packet, the communication module of the communication unit 500 passes it to the control program running on the central processing unit 300 for parsing. After the observation device is powered on, the communication unit 500 automatically dials or connects to the network and establishes a secure connection (such as TLS / SSL encryption) with the server of the remote center 700. The central processing unit 300 places the processed data into a transmission queue, and the communication unit 500 uploads the data according to a preset strategy (such as timed, quantitative, or immediate transmission upon the emergence of new pattern events). The communication unit 500 constantly listens for commands from the remote center 700, and upon receiving them, immediately forwards them to the central processing unit 300 for execution and feeds back the execution results to the remote center.
[0197] To ensure the long-term, stable, and unattended operation of the observation device in the field, the power supply unit 600 adopts a green energy solution based on solar power and is equipped with an intelligent energy storage and management system. The power supply unit 600 is a complete off-grid power supply system, mainly composed of four parts: energy harvesting, energy storage, power management, and load distribution. Energy Harvesting: The photovoltaic panels 6 use monocrystalline or polycrystalline silicon solar panels, which have high conversion efficiency and long lifespan. Their power (Wp) needs to be determined based on the average daily peak sunshine hours at the device's location, the device's average power consumption, and maximum power consumption, ensuring that daily charging needs are met under most sunshine conditions. During installation, the optimal tilt angle must be considered to maximize solar radiation reception, and a robust structure with corrosion resistance and wind and vibration resistance must be provided. Energy Storage: The battery 7 preferably uses deep-cycle lead-acid batteries (such as gel batteries, which are maintenance-free and high-temperature resistant) or lithium iron phosphate batteries. Its capacity (Ah) must meet the energy requirements for the device to continue operating normally under continuous no-sunlight weather (such as 3-5 days). Battery capacity is the decisive factor determining the device's continuous operation capability in the field. Power Management: The device is a solar charge controller, a key component connecting the photovoltaic panel 6 and the battery 7. It optimizes the operating point of the photovoltaic panel in real time to achieve maximum power generation efficiency, and manages charging (including strong charging, absorption charging, float charging, etc.) to prevent overcharging. Load Distribution: It can automatically connect or disconnect the load according to the battery voltage (when charging cannot reach the rated value during continuous cloudy days), preventing the battery from being over-discharged and thus extending its lifespan.
[0198] The remote center 700 serves as the "cloud brain" and command hub of the entire dynamic grayscale triggered rainfall observation system. It is responsible for centralized monitoring, data management, intelligent analysis, and remote control of single or multiple observation devices distributed in the field. Through the communication unit 500, it establishes a connection with the observation devices deployed in the field, achieving the following core functions:
[0199] Data aggregation and storage: Receives structured result data (a set of parameters such as the movement speed, equivalent diameter, and axial ratio of each raindrop), system status information (heartbeat, power, and error logs) and optional raw image data uploaded from one or more observation devices;
[0200] Status monitoring and alarms: Real-time monitoring of the operational status of all networked observation devices. When a device malfunction (such as camera failure, low battery, or communication interruption) or data anomaly report is received, it can automatically trigger audible and visual alarms, email, or SMS alerts to notify management personnel for timely intervention.
[0201] Remote control and configuration: Sending control commands to designated monitoring devices to achieve unmanned operation and maintenance. Examples include remotely starting / stopping data acquisition, dynamically updating algorithm parameters (such as trigger thresholds), system restarts, and firmware upgrades.
[0202] Data Analysis and Visualization: Deeply analyze and visualize the massive amounts of raindrop observation data received, and generate professional reports on the microphysical characteristics of rainfall.
[0203] This invention employs unattended operation, and the automated workflow is as follows:
[0204] Sleep Standby and Rain Sensing: When there is no rain, the system enters a low-power standby state, maintaining only the rain sensor and basic logic circuitry, greatly saving energy. The rain sensor 5 monitors the environment in real time, and when it detects rain, it immediately sends a start signal to the central processing unit 300.
[0205] Automatic wake-up and system initialization: Upon receiving the start signal, the central processing unit 300 immediately executes automatic system startup, turns on the backlight illumination unit 200 to provide uniform background light for the observation area 4, turns on the optical imaging unit 100, and the area array phase 1 and telecentric lens 2 enter the ready state. All software services are automatically loaded, and the system enters the working state;
[0206] Intelligent Triggering and Core Observation: After system initialization, the central processing unit 300 immediately executes steps S1-S2, the "Dynamic Grayscale Triggering" process. It analyzes the image in real time, and once it determines that raindrops have entered the field of view, it automatically enters working mode, starting to capture image sequences, process data, and calculate the raindrop's movement speed and morphological parameters (steps S3-S6).
[0207] Results storage and continuous monitoring: All calculated data and representative images are directly saved to the central processing unit 300;
[0208] Rainfall End Judgment and Automatic Shutdown: If the rain sensor 5 has no signal output for a period of time, the MCU will send a signal to the central processing unit 300. After completing subsequent data processing, the central processing unit 300 will continue to monitor the dynamic grayscale trigger signal. When the system does not detect raindrops for more than a preset time (e.g., 5-10 minutes), it will determine that the rainfall event has ended. The central processing unit 300 will send a command to the control unit 400, the relay drive circuit of the control unit 400 will stop working, the relay will be disconnected, the backlight will be turned off, and the system will enter a low-power standby state.
[0209] The system automatically executes the shutdown procedure: sequentially shutting down the area array camera 1 and the backlight illumination unit 200, and causing it to re-enter a low-power standby state, waiting for the next rainfall sensor to wake up.
[0210] Example 1: To better illustrate the structure of the observation device portion of the system in this application, this example is used for explanation. The dimensions and specifications of each part are for reference only and are not intended to limit the scope of this application. See the structural diagram of the observation device. Figures 4-8The upper part of the device is the observation section, with an optical imaging unit 100 consisting of an area array camera 1 and a telecentric lens 2 on one side, and a backlight illumination unit 200 consisting of a parallel backlight source 3 on the other side, see... Figure 4 , Figure 5 The optical imaging unit 100 and the backlight illumination unit 200 are enclosed by opaque materials on all sides, forming a light shield 8 to prevent natural light from affecting the observation. (See...) Figure 6 , Figure 7 The observation area 4 is located between the optical imaging unit 100 and the backlight illumination unit 200, see... Figure 4 , Figure 5 The top and bottom openings of observation area 4 allow raindrops to fall. Sunshades 9 are installed on both sides of observation area 4. (See...) Figure 8 The light shield 8 and light shield 9 can be made of aluminum alloy plate or opaque plastic plate, with a rough coating on the inner wall, which can be made by mixing coarse sand with glue. The surface of the coating is painted with black matte paint to reduce reflection. The light shield 8 on top of the optical imaging unit 100 and the backlight illumination unit 200 is designed to be openable. The top light shield 8 is fixed to the side light shield 8 with screws, and the connection part is sealed with a rubber gasket for waterproofing. The area array camera 1, the telecentric lens 2, and the parallel backlight 3 can be installed by removing the top light shield 8. The observation area 4 is located at the upper edge of the light shield 8 and light shield 9, and is provided with a water guide eaves 10. The water guide eaves 10 slope outward to prevent water accumulated in the light shield 8 and light shield 9 from flowing into the observation area 4 and causing misjudgment. See Figure 4 , Figure 5 , Figure 8 The observation unit is supported by a stainless steel or aluminum alloy square tube frame 11. The observation unit is fixed to the frame 11, which encloses a space. One side has a waterproof equipment box housing the central processing unit 300, control unit 400, and communication unit 500. The other side houses the battery 7 of the power supply unit 600. (See...) Figure 5 The battery 7 should be protected against rain. The photovoltaic panel 6 is placed next to the device, facing due south, with the elevation angle determined according to the local latitude. The optical imaging unit 100 and the backlight illumination unit 200 are movable to adjust the observation area 4. The observation area 4 is set to approximately 100mm. The depth of field range of the optical imaging unit 100 can be determined using a focus test chart to determine the specific size of the observation area 4. The area array camera 1 and the telecentric lens 2 can be moved along the center of the lens in the optical imaging unit 100. It is advisable that the foremost lens of the telecentric lens 2 is 100-150mm from the edge of the observation area 4, and the surface of the parallel backlight 3 is 150-200mm from the edge of the observation area 4, to prevent raindrops from drifting and falling on the telecentric lens 2 and the parallel backlight 3.
[0211] Example 2, Image Acquisition. Area Scan Camera 1 Configuration Parameters: Exposure time 0.1ms; Resolution 1920×480; Gain set to 0 or a fixed value as low as possible to avoid introducing amplification noise and ensure image signal-to-noise ratio. Pixel Dynamic Range Mono 12 to retain more grayscale levels. Gamma correction off to ensure a linear relationship between image grayscale values and received light intensity. White balance fixed at the default value or "manually locked" to avoid fluctuations in overall image brightness caused by automatic camera adjustment, which could interfere with the stability of the dynamic grayscale triggering algorithm. Trigger mode set to continuous acquisition. Telecentric Lens 2 Configuration Parameters: Aperture F8~F16. A smaller aperture is chosen to obtain a greater depth of field, ensuring that raindrops at different points within the observation area are clearly imaged. Although the impact of aperture on depth of field is relatively weakened under parallel backlighting, its optimized setting is still valuable. The system works in conjunction with high-brightness backlighting and precise exposure time control to jointly ensure image quality. Precise focusing (working distance) ensures that the object plane of observation area 4 is clearly imaged on the camera sensor target surface. The method involves placing a standard calibration object (such as a ruler) at the actual location where the raindrop falls (the center of the observation area) and adjusting the lens focus ring until the image is sharpest. This embodiment presets a trigger threshold based on the real-time displayed grayscale change value. T The frame rate was set to 1.2 to ensure clear capture of the raindrop's falling process. The system successfully achieved high frame rate dynamic grayscale triggering acquisition, with the measured time interval between adjacent frames being approximately 2.52 ms, consistent with the theoretical frame interval (1 / 396 s ≈ 2.52 ms), demonstrating the accuracy and real-time performance of the triggering mechanism. Raindrop falling image acquisition results are shown below. Figure 9 , Figure 9 For a single raindrop at different locations captured in 10 images, from Figure 9 It can be seen that the position and shape of the raindrop are constantly changing during the falling process. The raindrop is shaped like a convex lens. The irregular gray quadrilateral in the middle of the raindrop image is the image of the backlight source on the raindrop lens.
[0212] Example 3: Raindrop detection, tracking, and velocity-morphology calculation. The efficient processing flow for raindrop targets in consecutive frames of this invention has been clearly and intuitively verified, see [link to example]. Figure 10Specifically, the system first extracts the contours of raindrops precisely using the Canny edge detection algorithm in each frame, with each raindrop defined by a closed contour. Then, it calculates the geometric center (centroid) of each contour through contour analysis and marks it with a numbered colored marker (0, 1, 2, 3, and 4 in the image), thus completing the identification and localization of all raindrop targets within a single frame. By analyzing the relative displacement of the centroids of all raindrops between two consecutive frames and based on the principle of motion continuity such as minimum displacement vector, the system achieves accurate matching of the same raindrop target in different frames. In the image, markers of the same color represent the positions of the same raindrop in different frames: the dark red 0, green 1, pinkish-purple 2, and yellow 3 raindrops detected in the first frame (a) all found corresponding markers of the same color in the second frame (b). The changes in the positions of each marker clearly show the trajectory of the falling raindrops. The newly appearing red raindrop No. 4 (marked as (N)) in the second frame (b) represents a new target entering the field of view. The system can distinguish it from existing targets and number it independently. Figure 10 This demonstrates intuitively that the entire algorithm, from Canny edge detection and contour centroid localization to motion-based cross-frame matching, can stably and accurately track multiple raindrop targets continuously, providing a reliable data foundation for subsequent calculations of each raindrop's velocity, trajectory, and morphological evolution. The results of velocity calculations for multiple raindrops, yielding their horizontal and vertical falling velocities, total velocity, and morphological parameters, are shown in the table below:
[0213] .
[0214] The specification and drawings of this application are merely one specific embodiment and are not restrictive. Those skilled in the art can make many other modifications based on the teachings of this application without departing from the spirit and scope of the claims, all of which are within the scope of protection of this application.
Claims
1. A high-speed area array imaging rainfall observation method with dynamic grayscale triggering, characterized in that, include: S1. Image Acquisition and Grayscale Conversion: On one side of the observation area is an optical imaging unit consisting of a global shutter area scan camera and a telecentric lens; on the other side is a backlight illumination unit. The observation area lies between the optical imaging unit and the backlight illumination unit, forming a backlight silhouette imaging system. The area scan camera continuously acquires images of the observation area and converts the acquired color images into grayscale images in real time. Based on the grayscale images, the average grayscale value is further calculated to describe the overall brightness characteristics of the image. The calculation formula is as follows: , Among them, gray[ i ] is the th element in the grayscale image i The grayscale value of each pixel n This represents the total number of pixels in the image. S2. Dynamic Triggering and Sequence Saving: Real-time calculation of the average grayscale difference between the current frame and the previous frame, and calculation of the average grayscale value based on the background frame difference value sequence. μ bg and grayscale standard deviation σ bg Set the preset trigger threshold T Set as T =μ bg +K·σ bg ,in K This is a preset coefficient; when the average grayscale difference value exceeds a preset trigger threshold... T When raindrops are detected entering the field of view, a sequence of consecutive images starting from the time of detection is saved, and a timestamp is added to each frame. The process continues until the average grayscale difference value drops back to 0.
8. T The system then prepares to respond to the next trigger to prevent a single event from being judged repeatedly. The method for calculating the average gray-level difference value is as follows: The absolute difference method is used, combined with spatial interval sampling of image pixels, to calculate the average absolute value of the gray-level difference of the sampled pixels. The calculation formula is: , Among them, gray[ j ] and gray prev [ j [The following are the references to the current frame and the previous frame, respectively.] j The grayscale value of each sampled pixel. m This represents the total number of sampling points; S3. Raindrop contour extraction: Apply the Canny edge detection algorithm frame by frame to the saved image sequence to identify and extract the contours of all raindrops in each frame; S4. Raindrop Matching and Tracking: Calculate the centroid coordinates and circumscribed geometric parameters of each raindrop profile. The centroid coordinates are obtained by calculating image moments. , in, M 00 It is the zeroth moment of the profile. M 10 and M 01 These are the first-order moments; the circumscribed geometric parameters include the contour area, the circumscribed rectangle, and the minimum circumscribed circle diameter. Based on a weighted comprehensive evaluation of three criteria—centroid spatial proximity, contour area consistency, and physical rationality of motion direction—the Hungarian algorithm is used to perform global optimal matching of raindrops in multiple consecutive frames of images, thereby achieving cross-frame matching and tracking of the same raindrop. Criterion 1: Centroid Spatial Proximity: Calculating Raindrops i With raindrops j Euclidean distance between the centroids: , in, Cx i and Cy i Representing points respectively i In two-dimensional space x coordinates and y coordinate; Cx j and Cy j Representing points respectively j In two-dimensional space x coordinates and y coordinate; Set maximum search radius R max Only when d ij < R max At that time, the raindrop pair is considered a potential matching pair; the R max Estimated based on the maximum expected velocity of raindrops and frame interval; Criterion 2, Profile Area Consistency: Calculating Raindrops i With raindrops j Relative differences in area: , in, A i , A j raindrops i and raindrops j The outline area; setting the maximum area change rate threshold. T A Only when Δ A ij < T A In this case, the raindrop pair is considered a valid match in terms of area. Criterion 3, Physical rationality of motion direction: For raindrops that have been successfully tracked for more than two frames, fit the current motion velocity vector based on its historical centroid coordinates, calculate the deviation between the predicted position and the actual position of the candidate raindrop in the next frame, and this deviation should be within a preset reasonable range to eliminate false matches caused by raindrop intersections and overlaps. The Hungarian algorithm is used to find the globally optimal matching. Its cost matrix is composed of a linear or nonlinear weighted combination of the three criteria mentioned above. The goal is to find the globally optimal matching pair. The successfully matched observed raindrops are associated with the tracker, and the tracker's state is updated with the latest features of the raindrops. Kalman filtering is used for smooth estimation. If a tracker fails to find a match for several consecutive frames, it determines that the corresponding raindrop has left the field of view and terminates the tracking. Initialize the raindrop profiles in the current frame that do not match any existing trackers as new trackers; The sequence of centroid coordinates of the same raindrop in different frames that are successfully matched constitutes the raindrop's falling trajectory. S5. Motion speed calculation: Based on the centroid pixel displacement Δ of the same successfully matched raindrop across consecutive frames. x ,Δ y Image acquisition time interval Δ t and spatial calibration scaling factor S w and S h Calculate the velocity components of raindrops in the horizontal and vertical directions. v x and v y and combined speed v The spatial calibration scaling factor S w and S h Based on the actual width of the image x Axial direction and actual image height y The calculation formula for axis direction and resolution setting is as follows: , , in, W and H The actual width and height of the image, in mm; W pixels and H pixels Width and height in pixels; S6. Morphological parameter calculation: Based on the identified raindrop contour pixel information, calculate the equivalent diameter of the raindrop. D equiv Minimum circumcircle diameter D min and shaft ratio a / b Multidimensional morphological parameters; S7. Output Results: Summarize and output the set of motion velocity and morphological parameters of all measured raindrops.
2. The method for observing rainfall using dynamic grayscale triggering of a high-speed area array imaging system according to claim 1, characterized in that, In step S1, the grayscale conversion effectively preserves the brightness information of the image while removing color information by weighted summing of the three color channels, thereby achieving the conversion from a color image to a grayscale image. The conversion formula is as follows: , in, R , G , B These represent the values of the red, green, and blue color channels of a pixel, respectively.
3. The method for observing rainfall using dynamic grayscale triggering of a high-speed area array imaging system according to claim 1, characterized in that, The Canny edge detection algorithm in step S3 includes the following sub-steps in sequence: S31. Gaussian Filtering: Gaussian filtering uses a Gaussian kernel to perform convolution operations on a grayscale image to smooth noise. Gaussian filtering combines the image with a Gaussian kernel through convolution, and its mathematical expression is: , in, σ It is the standard deviation of the Gaussian kernel; e and π These are the natural constant and pi (π). These are the normalization coefficients; S32. Gradient Calculation: Calculate the gradient magnitude and direction for each pixel. The formula for calculating the gradient magnitude is: , in, I For image I The gradient magnitude; I x For image I exist x An upward gradient; I y For image I exist y Gradient in direction; Gradient four-quadrant direction angles θ The calculation formula is: , S33. Non-maximum suppression: By comparing the gradient magnitude of each pixel with the gradient magnitude of two pixels in its neighborhood along the gradient direction, only the pixels with the local maximum value of the gradient magnitude in the gradient direction are retained, and the non-edge pixels in the gradient magnitude are removed, thus refining the edges to make them clearer. S34, Dual-threshold hysteresis connection: Apply two thresholds, high and low, to filter strong edge points and weak edge points, and connect the weak edges connected to the strong edges to form a complete edge contour.
4. The high-speed area array imaging rainfall observation method based on dynamic grayscale triggering according to claim 1, characterized in that, In step S5, the raindrop velocity is calculated based on the spatial calibration scaling factor. S w and S h Then, the speed of the raindrops is calculated based on the changes in their positions and time intervals in consecutive frames; The horizontal velocity component of the raindrop is: , The vertical velocity component of the raindrop is: , The resultant velocity of the raindrops is: , Where, Δ x and Δ y Δ represents the pixel displacement of the raindrop centroid in the horizontal and vertical directions, respectively. t This represents the image acquisition time interval.
5. The method for high-speed area array imaging rainfall observation based on dynamic grayscale triggering according to claim 1, characterized in that, The equivalent diameter mentioned in step S6 D equiv The calculation formula is: , in, A The actual physical area of the raindrop's outline, in mm. 2 ; minimum circumcircle diameter D min The radius is calculated by fitting the minimum circumcircle of the raindrop profile. An OpenCV function is used to fit the minimum circumcircle of the raindrop profile and returns the radius. r and the coordinates of the center of the circle ( x , y The minimum circumcircle diameter is obtained by doubling the radius. D min Based on the raindrop closed contour obtained by Canny edge detection in step S3, least squares ellipse fitting is performed to return the center coordinates of the ellipse. x , y ), shaft length ( w , h ) and rotation angle β ,in w and h These are the diameters of the ellipse along the major and minor axes, respectively, in pixels. Since the axis lengths returned by OpenCV are related to the ellipse's orientation, the major axis needs to be determined by comparison. a With short axis b : , The shaft ratio is calculated using the following formula: , When AR=1, the raindrop is an ideal sphere; when AR>1, the raindrop stretches along its long axis, and the larger the value, the more significant the deformation.
6. A dynamic grayscale-triggered rainfall observation system for implementing the method of any one of claims 1-5, characterized in that, The observation device mainly consists of an optical imaging unit (100), a backlight illumination unit (200), a central processing unit (300), a control unit (400), a communication unit (500), a power supply unit (600), and a remote center (700); The optical imaging unit (100) includes an area array camera (1) and a telecentric lens (2) for high-speed, distortion-free imaging; The backlight illumination unit (200) includes a parallel backlight source (3) to provide uniform background light for the optical imaging unit (100); The observation area (4) is between the optical imaging unit (100) and the backlight illumination unit (200). Raindrops fall freely through the observation area (4). As opaque objects, the raindrops are illuminated by the parallel backlight source (3) and, using the principle of backlight imaging, form a silhouette image with clear edges on the area array camera (1) through the telecentric lens (2). The central processing unit (300) is configured to perform image acquisition control, dynamic grayscale trigger judgment, raindrop image processing, motion and morphological parameter calculation and result output; The control unit (400) is equipped with a rain sensor (5) to detect when rain occurs and to automatically control the device to turn on or standby. The control unit (400) is connected to the central processing unit (300) and receives instructions from the central processing unit (300) to control the backlight unit (200) to turn on or off through the control unit (400). The communication unit (500) is connected to the central processing unit (300) and transmits the observation results to the remote center (700), which can remotely control the operation of the observation device. The power supply unit (600) is equipped with a photovoltaic panel (6) and a storage battery (7) to provide power to the observation device.
7. A dynamic grayscale triggered rainfall observation system as described in claim 6, characterized in that, The area array camera (1) is connected to the central processing unit (300) and uses ROI technology to improve the acquisition frame rate and perform continuous image acquisition; the telecentric lens (2) maintains a constant magnification under parallel backlight illumination, effectively eliminating perspective errors, thereby ensuring that raindrops in different spatial positions have a consistent size ratio in the image.
8. A dynamic grayscale triggered rainfall observation system as described in claim 6, characterized in that, The backlight unit (200) adopts a monochromatic parallel backlight source and uses a high-brightness LED array as the light source. The LED array is equipped with a diffuser plate and a brightness enhancement film, which transforms the discrete LED point light source into a high-quality surface light source with uniform brightness and no hot spots or dark areas.
9. A dynamic grayscale triggered rainfall observation system as described in claim 6, characterized in that, The central processing unit (300) has a built-in computing control system, which includes four core modules: image acquisition, image processing, morphological analysis and user interface. The image acquisition module uses the SDK to dynamically configure parameters, accurately acquires images through a grayscale change trigger mechanism, and adopts a multi-threaded architecture to ensure efficient operation of the system at high frame rates. The image processing module performs grayscale conversion on the image and uses the Canny edge detection algorithm to extract raindrop contours and enhance boundary information; The morphology analysis module uses a centroid matching algorithm to match raindrops across frames, calculates their velocity, and extracts multi-dimensional morphological parameters such as equivalent diameter, minimum circumcircle diameter, and axis ratio. The user interface module adopts a graphical design, which includes a parameter setting area, a system status display area, and a visualization result display area. Users can adjust camera parameters, start or stop data acquisition, calculate speed and equivalent diameter, and view the speed and diameter analysis results of raindrops through the interface.