Snowflake identification method based on machine vision and computer equipment thereof

The machine vision-based snowflake recognition method addresses resolution and trajectory prediction issues by edge detection and Kalman filter tracking, ensuring accurate snowflake identification and tracking in complex weather.

CN120318598AActive Publication Date: 2025-07-15CHINESE ACAD OF METEOROLOGICAL SCI

Patent Information

Application Number
CN202510787018.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-07-15
Estimated Expiration
2045-06-13

AI Technical Summary

Technical Problem

Traditional snowflake recognition methods are insufficient in resolution and sampling frequency, making it difficult to capture tiny snowflake particles, and the image recognition effect is poor under complex weather conditions, affecting data accuracy; snowflake trajectory prediction depends on environmental parameters and is difficult to obtain in real time.

Method used

Using a machine vision-based method, the snowflake particle outline is extracted through edge detection, combined with a Kalman filter to predict the snowflake position and match the trajectory, and a similarity matrix and dynamic threshold are used to determine whether the snowflake particles belong to the trajectory.

Benefits of technology

Accurately position the edges of snowflakes, separate irregular contour features, improve the accuracy of snowflake classification, update trajectories in real time, reduce noise interference, and improve the accuracy and robustness of snowflake recognition and trajectory prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120318598A_ABST
    Figure CN120318598A_ABST
Patent Text Reader

Abstract

The invention provides a snowflake identification method based on machine vision and computer equipment thereof. A single-frame image is selected from the video as a to-be-identified snowflake image, edge detection and snowflake particle contour extraction are performed on the to-be-identified snowflake image, and the snowflake particle contours meeting a preset screening condition are used as effective snowflake particles. The snowflake edge is accurately positioned, irregular contour features of snowflakes are separated, feature information can be further extracted, and a quantitative basis is provided for snowflake classification. After the feature information is extracted, the trajectory of the snowflakes can be predicted. If the effective snowflake particles belong to the snowflake trajectory, the snowflake trajectory is updated. According to the method, the snowflake trajectory can be accurately predicted, and errors of the predicted trajectory can be timely found and corrected by judging whether the effective snowflake particles are matched with the snowflake trajectory or not when prediction deviation occurs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a meteorological recognition method, and in particular to a snowflake recognition method based on machine vision and its computer device. Background Art

[0002] The detection and analysis of snowflake particles play a crucial role in the fields of meteorological monitoring, environmental science, industrial refrigeration, and scientific research. In the field of meteorological monitoring, each snowflake is a microscopic recorder of the atmospheric environment. Its unique shape, precise size, and spatial distribution contain information on key meteorological elements such as atmospheric temperature, humidity, and air flow movement. In the scope of environmental science, snowflake particles have become "natural detectors" for tracking atmospheric pollutants. When snowflakes fall, they will adsorb dust, pollen, heavy metal particles, and various chemical pollutants in the air. The types and concentrations of these pollutants can be clearly presented through the detection and analysis of snowflakes. In the field of industrial refrigeration, the research on the characteristics of snowflake particles is also of great importance. In industries such as food freezing and cold chain logistics, understanding the shape and size distribution of snowflakes helps to optimize the design and operating parameters of refrigeration equipment. At the level of scientific research, snowflake particles provide a unique perspective for exploring the microscopic world. Physicists explore the crystal growth law and the principle of phase change of substances by studying the crystallization process of snowflakes. However, the traditional methods for identifying snowflakes still have several limitations.

[0003] On the one hand, the traditional snowflake recognition methods are limited by the resolution and sampling frequency of the equipment, and have insufficient ability to capture tiny snowflake particles, easily missing small-sized snowflakes. Moreover, in complex weather conditions such as strong winds and heavy snow, snowflakes block and overlap each other, which will seriously interfere with the image recognition effect, resulting in large data deviations and affecting the accuracy of subsequent analysis.

[0004] On the other hand, when the traditional snowflake recognition methods predict the trajectory of snowflakes, they are based on traditional physical models. Although this method can construct the snowflake motion equation, it relies on a large number of accurate environmental parameters and snowflake attribute data, and in practice, these data are difficult to obtain and update in real time. Summary of the Invention

[0005] An object of the present invention is to overcome at least one defect in the prior art and provide a snowflake recognition method based on machine vision.

[0006] A further object of the present invention is to recognize snowflakes by performing edge detection on snowflake images and extracting effective snowflake particles.

[0007] Another further object of the present invention is to verify whether the predicted snowflake trajectory is correct by predicting the snowflake position and matching the effective snowflake particles with the snowflake trajectory.

[0008] In particular, the present invention provides a snowflake recognition method based on machine vision, including: selecting a single-frame image from a video as the object to be processed as the snowflake image to be recognized; performing edge detection on the snowflake image to be recognized to extract the snowflake particle contour; taking the snowflake particle contour that meets the preset screening conditions as an effective snowflake particle, and extracting the feature information of the effective snowflake particle.

[0009] Optionally, after the step of extracting the feature information of the effective snowflake particle, it further includes: obtaining the predicted position of the snowflake in the single-frame image, where the predicted position of the snowflake is predicted based on the snowflake trajectory in the image before the single-frame image; performing matching within a set range of the predicted position of the snowflake to determine whether the effective snowflake particle belongs to the snowflake trajectory; if so, updating the snowflake trajectory.

[0010] Optionally, the step of obtaining the predicted position of the snowflake includes: determining the motion state of the snowflake particles in the frame before the single-frame image according to the snowflake trajectory, where the motion state includes position, velocity, and acceleration; using a Kalman filter to perform predictive calculations on the motion state in the previous frame to obtain the predicted motion state of the snowflake particles in the single-frame image; extracting the predicted position of the snowflake from the predicted state.

[0011] Optionally, the step of performing matching within a set range of the predicted position of the snowflake includes: obtaining the search radius of the snowflake particle; adjusting the search radius according to the velocity and acceleration in the predicted motion state; searching for effective snowflake particles centered on the predicted position of the snowflake according to the adjusted search radius; if an effective snowflake particle is found, it is determined that the effective snowflake particle belongs to the snowflake trajectory.

[0012] Optionally, in the case where the effective snowflake particle does not belong to the snowflake trajectory, it further includes: counting the number of consecutive lost frames of the snowflake trajectory to obtain the number of lost frames; determining whether the number of lost frames exceeds a preset threshold; if so, creating a new snowflake trajectory; if not, outputting the statistical information of the trajectory state of the snowflake trajectory.

[0013] Optionally, the step of performing matching within a set range of the predicted position of the snowflake includes: constructing a similarity matrix between the snowflake trajectory and the effective snowflake particle; storing the similarity matrix in the form of a two-dimensional array; determining whether the effective snowflake particle matches the snowflake trajectory according to the two-dimensional array; where the step of determining whether the effective particle matches the snowflake trajectory according to the two-dimensional array includes: determining whether the similarity matrix is less than the dynamic threshold; the dynamic threshold is adjusted according to the length of the snowflake trajectory and the number of consecutive lost frames; if so, outputting a similarity of 0; if not, outputting the value of the similarity matrix as the similarity.

[0014] Optionally, the step of performing edge detection on the snowflake image to be recognized includes: recognizing a grayscale image corresponding to the snowflake image to be recognized; performing image preprocessing on the grayscale image by means of noise reduction and contrast enhancement; performing binary segmentation on the preprocessed grayscale image to generate a binary image; and performing edge detection on the binary image.

[0015] Optionally, after the step of generating the binary image, it further includes: judging whether there is a discontinuous area in the binary image; if so, performing a closing operation on the binary image, and judging whether there are obvious noise points in the binary image; if so, performing a dilation operation on the binary image.

[0016] Optionally, after the step of performing edge detection on the snowflake image to be recognized, it further includes: judging whether the snowflake image meets the preset minimum blur requirement; if so, judging whether there are still valid snowflake particles in the snowflake image; if so, extracting the feature information in the snowflake image, where the feature information includes the geometric features, brightness features, and blur features of the valid snowflake particles; if not, performing adaptive adjustment on the snowflake image and re-judging whether the snowflake image meets the preset minimum blur requirement.

[0017] Optionally, the present invention further provides a computer device, including: a memory, a processor, and a computer program stored on the memory, and the processor executes the computer program to implement the steps of the snowflake recognition method based on machine vision according to any one of the above.

[0018] The snowflake recognition method based on machine vision provided by the present invention selects a single-frame image from a video as the snowflake image to be recognized, performs edge detection and snowflake particle contour extraction on the snowflake image to be recognized, and uses the snowflake particle contour that meets the preset screening conditions as valid snowflake particles. This method can accurately locate the snowflake edge. Even in a complex environmental background, it can separate the irregular contour features of the snowflake (such as branches, edges, symmetry, etc.), avoiding false detections caused by similar gray levels in traditional threshold segmentation. Moreover, after extracting the snowflake particle contour, feature information (such as area, perimeter, roundness, fractal dimension, etc.) can be further extracted, providing a quantitative basis for snowflake classification (such as columnar, star-shaped, flaky, etc.).

[0019] Furthermore, after extracting the feature information, the method of the present invention can also predict the trajectory of the snowflake. The prediction of the snowflake trajectory can be achieved by obtaining the predicted position of the snowflake in a single-frame image and performing matching within a set range at the predicted position of the snowflake to determine whether the valid snowflake particle belongs to the snowflake trajectory. If the valid snowflake particle belongs to the snowflake trajectory, the snowflake trajectory should be updated. This method can correctly predict the trajectory of the snowflake, and when the prediction deviates, it can timely detect and correct the error in the predicted trajectory by judging whether the valid snowflake particle and the snowflake trajectory match.

[0020] Those skilled in the art will better understand the above and other objects, advantages and features of the present invention from the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings. Description of the Drawings

[0021] Some specific embodiments of the present invention will be described in detail hereinafter with reference to the accompanying drawings in an illustrative rather than restrictive manner. The same reference numerals in the drawings denote the same or similar components or parts. Those skilled in the art should understand that these drawings are not necessarily drawn to scale. In the drawings: Figure 1 is a schematic flowchart of a snowflake recognition method according to an embodiment of the present invention; Figure 2 is a schematic flowchart of steps for predicting the trajectory of a snowflake according to an embodiment of the present invention; Figure 3 is a schematic flowchart of steps for obtaining the predicted position of a snowflake according to an embodiment of the present invention; Figure 4 is a schematic flowchart of steps for performing matching within a set range of the predicted position of a snowflake according to an embodiment of the present invention; Figure 5 is a schematic flowchart of steps in the case where valid snowflake particles do not belong to the snowflake trajectory according to an embodiment of the present invention; Figure 6 is a schematic flowchart of steps for performing matching within a set range of the predicted position of a snowflake according to an embodiment of the present invention; Figure 7 is a schematic flowchart of steps for performing edge detection on a snowflake image to be recognized according to an embodiment of the present invention; Figure 8 is a schematic flowchart of steps after generating a binary image according to an embodiment of the present invention; Figure 9 is a schematic flowchart of steps after performing edge detection on a snowflake image to be recognized according to an embodiment of the present invention; Figure 10 is a schematic flowchart of a snowflake recognition and trajectory prediction method according to an embodiment of the present invention; Figure 11 is a schematic diagram of a computer program product according to an embodiment of the present invention; Figure 12 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention; and Figure 13 is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed Embodiments

[0022] Those skilled in the art should understand that the embodiments described below are only a part of the embodiments of the present invention, rather than all the embodiments of the present invention. These embodiments are intended to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention. Based on the embodiments provided by the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts should still fall within the protection scope of the present invention.

[0023] It should be noted that the logic and / or steps represented in the flowchart or described in other ways herein can be considered as a definite sequence list of executable instructions for implementing logical functions, which can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device), or used in combination with these instruction execution systems, apparatus, or devices.

[0024] The present invention provides a snowflake recognition method based on machine vision, as Figure 1 shown, the recognition method at least includes the following steps S101 to S103.

[0025] Step S101: Select a single-frame image from the video to be processed as the snowflake image to be recognized. Selecting a single-frame image from a continuous-frame video for processing has a smaller computational cost compared to directly processing the continuous-frame video, which is convenient for focusing on the snowflake morphology at a specific moment and avoiding interference caused by the dynamic changes of snowflakes.

[0026] Step S102: Perform edge detection on the snowflake image to be recognized and extract the snowflake particle contour. Edge detection can significantly distinguish snowflake particles from the background and highlight the contour boundary of the snowflakes, facilitating subsequent contour analysis. Among them, methods such as the Sobel operator or the Laplacian operator can be used when performing edge detection on snowflakes. When performing edge detection, the gradient magnitude is calculated using the Sobel operator to detect the edge direction. The calculation formula of the Sobel operator is:

[0027] where, and represent the gradient values in the horizontal and vertical directions respectively. G represents the gradient magnitude, which is used to characterize the intensity of the edge.

[0028] When performing edge detection, the Laplacian operator is used to enhance the high-frequency features and protrude the edge. The calculation formula of the Laplacian operator is:

[0029] where, is the second derivative of a pixel point and is used to detect high-frequency edge information.

[0030] Step S103: Use the snowflake particle contours that meet the preset screening conditions as valid snowflake particles, and extract the feature information of the valid snowflake particles. Among them, the preset screening conditions can be contour closure screening, contour symmetry evaluation, gray level uniformity, etc. This step can filter out incomplete, overlapping, or blurred snowflake contours (such as occluded particles) to ensure that the analysis object is an independent and identifiable valid individual. During the process of extracting valid snowflake particles, the features such as the area, perimeter, equivalent diameter, and brightness of the snowflake particles should also be calculated. The formula for calculating the particle area is:

[0031] where A represents the pixel area of the snowflake particle, and contour refers to the set of pixel points within the particle contour.

[0032] The formula for calculating the perimeter is:

[0033] where P is the perimeter of the snowflake particle, ( , ) are the coordinates of the contour points.

[0034] The formula for calculating the equivalent diameter is:

[0035] where is the equivalent diameter of the snowflake particle, which is calculated from the area of the snowflake particle.

[0036] The formula for calculating the maximum Feret diameter is:

[0037] The maximum Feret diameter refers to finding the longest distance between two points given the coordinates of all vertices of the known Feret figure. The Feret figure is a special convex polygon where any two opposite sides are parallel and of equal length.

[0038] The brightness feature comes from the direct processing of the image and includes multiple parameters such as mean, standard deviation, skewness, kurtosis, and blurriness formulas. The calculation formulas are as follows:

[0039] where μ is the mean, is the standard deviation, Skewness is the skewness, Kurtosis is the kurtosis, Blurriness is the blurriness, is the Laplacian variance of the image and is used to evaluate the sharpness of the particle edge.

[0040] As Figure 7 shown, the steps of edge detection for the snowflake image to be recognized may at least include step S701 to step S704.

[0041] Step S701, identify the grayscale image corresponding to the snowflake image to be recognized. The morphological recognition of snowflakes mainly relies on brightness differences (such as the light and dark contrast between snowflakes and the background). Using a grayscale image can exclude color interference. It provides a unified input format for subsequent preprocessing and edge detection, and avoids algorithm instability caused by color channel differences.

[0042] Step S702, perform image preprocessing on the grayscale image by methods of noise reduction and contrast enhancement. Removing noise in the image (such as sensor noise, environmental interference) can avoid misjudging noise as the snowflake edge and improve the detection accuracy. The methods of noise reduction can adopt Gaussian filtering or median filtering, etc., which can suppress interference while retaining real edges when recognizing the grayscale image. Enhancing the contrast can expand the brightness difference between snowflakes and the background, making the edge area more obvious and facilitating the subsequent detection algorithm to capture. The contrast can be enhanced by histogram equalization to improve the overall contrast of the image, or by adaptive thresholding to enhance local details.

[0043] The formula for Gaussian filtering noise reduction is:

[0044] Where is the standard deviation of the Gaussian kernel, which determines the smoothness of the filter.

[0045] The formula for contrast enhancement is:

[0046] Where I(x,y) represents the pixel value, μ is the average value of the global brightness of the image, k is the enhancement coefficient, and the usually selected range is between 1.5 and 2.0. For low-contrast images, the k value can be 1.8 or higher to significantly improve the contrast of the image. For images with normal contrast, the k value can be 1.5 to achieve moderate contrast enhancement.

[0047] Step S703, perform binary segmentation on the preprocessed grayscale image to generate a binary image. Performing binary segmentation on the image can completely separate the target from the background, eliminate the ambiguity caused by gray-scale gradients. It is convenient for the edge detection algorithm to directly locate. Moreover, the algorithm complexity of calculating the binary image is low, which is more suitable for real-time processing scenarios. Using the binary image for edge detection can also eliminate large-area background regions in advance and reduce the invalid calculation range.

[0048] In the binarization segmentation stage, the goal is to generate a binary image to achieve a clear separation between particles and the background. The process of binarization segmentation includes static threshold segmentation and adaptive threshold segmentation. The formula for static threshold segmentation is:

[0049] where I(x, y) represents the pixel value after binarization. T represents the global fixed threshold.

[0050] The formula for adaptive threshold segmentation is:

[0051] where local_mean(x, y) is the mean value within the local window. δ is the offset value.

[0052] Step S704: Perform edge detection on the binary image. By detecting the pixels in the binary image, the contour edges of the snowflakes can be accurately extracted, providing a basis for subsequent edge detection.

[0053] After generating the binary image, it is also possible to check whether there are disconnected regions or obvious noise points in the binary image. As Figure 8 shown, the steps after generating the binary image may further include Step S801 to Step S804.

[0054] Step S801: Determine whether there are disconnected regions in the binary image.

[0055] Step S802: If so, perform a closing operation on the binary image.

[0056] Step S803: Determine whether there are obvious noise points in the binary image.

[0057] Step S804: If so, perform a dilation operation on the binary image.

[0058] The closing operation and the dilation operation solve the problems of possible contour breaks and noise interference remaining in the binarization process, making the snowflake targets in the image closer to the real form. This process significantly improves the accuracy of edge detection and the reliability of subsequent analysis. It is an important means of refined processing in the image preprocessing link, especially suitable for scenarios where the snowflake contour recognition is sensitive to morphological features.

[0059] After performing edge detection on the snowflake image, it is also necessary to monitor whether the snowflake image meets the preset blurriness and whether there are still valid snowflake particles in the snowflake image. As Figure 9 shown, the steps after performing edge detection on the snowflake image to be recognized at least include Step S901 to Step S904.

[0060] Step S901: Determine whether the snowflake image meets the preset minimum blur requirement. Detecting the blur of the image can screen out images with blurred edges caused by focus failure, motion blur, etc., avoiding ineffective processing. Among them, the preset minimum blur requirement can be determined according to historical data, or the minimum blur can be dynamically adjusted according to specific circumstances during the process of identifying the snowflake trajectory.

[0061] Step S902: If so, determine whether there are still valid snowflake particles in the snowflake image.

[0062] Step S903: If so, extract the feature information in the snowflake image. Among them, the feature information includes the geometric features, brightness features, and blur features of the valid snowflake particles.

[0063] Step S904: If not, perform adaptive adjustment on the snowflake image. And re-determine whether the snowflake image meets the preset minimum blur requirement. Through adaptive adjustment (such as enhancing contrast or sharpening edges), the blur problem caused by uneven illumination, scattering, etc. can be improved. After the adaptive processing, re-determine whether the snowflake image meets the preset minimum blur requirement. This can eliminate the influence of blurred images on the detection of snowflake contours.

[0064] After the step of extracting the feature information of the valid snowflake particles, the trajectory of the snowflake particles can also be predicted, as Figure 2 shown, the steps of predicting the trajectory of the snowflake particles at least include Step S201 to Step S203.

[0065] Step 201: Obtain the predicted position of the snowflake in a single-frame image. The predicted position of the snowflake is predicted based on the snowflake trajectory before the single-frame image. Predicting the snowflake position based on the snowflake trajectory before the single-frame image can limit the subsequent matching range to the adjacent area of the predicted position, avoiding undifferentiated search of the entire image, greatly reducing the calculation amount, especially suitable for high-resolution images or real-time processing scenarios.

[0066] Step S202: Perform matching within the set range of the predicted position of the snowflake to determine whether the valid snowflake particles belong to the snowflake trajectory. Performing matching within the set range of the predicted position can avoid the interference of similar features in the background (such as light spots and textures similar to the shape of snowflakes), and only verify the existence of the target within a reasonable area.

[0067] Step S203: If the valid snowflake particles belong to the snowflake trajectory, update the snowflake trajectory. If the valid snowflake particles belong to the existing trajectory, immediately update the trajectory parameters, which can maintain the continuity of the target in multiple frames and avoid tracking interruption caused by local occlusion and noise interference.

[0068] The position is predicted using the snowflake trajectory before a single-frame image to limit the subsequent matching range, avoiding non-discriminatory full-image search to reduce the computational load. Meanwhile, matching within the set range can avoid interference from similar background features, accurately determine whether an effective snowflake particle belongs to the trajectory, and if so, update the trajectory parameters in a timely manner, enhancing the anti-interference ability while improving the computational efficiency, ensuring the continuity and reliability of the snowflake trajectory in multiple-frame images, and being applicable to high-resolution or real-time processing scenarios.

[0069] As Figure 3 shown, the steps for obtaining the snowflake prediction position may include step S301 to step S303.

[0070] Step S301: Determine the motion state of the snowflake particles in the frame before the single-frame image according to the snowflake trajectory. The motion state includes position, velocity, and acceleration. Abstract the snowflake motion state into position, velocity, and acceleration to form a computable state vector, providing a basis for subsequent calculation by the Kalman filter model. Avoid rough tracking relying only on pixel positions, and more accurately describe the physical motion characteristics of snowflakes through multi-dimensional parameters (such as the trend of velocity change).

[0071] Step S302: Use the Kalman filter to perform prediction calculations on the motion state in the previous frame to obtain the predicted motion state of the snowflake particles in the single-frame image. For the position measurement error in the single-frame image caused by noise (such as snowflake blurring, partial occlusion), the predicted state filtered by the Kalman filter can smooth the trajectory fluctuations and output an estimated value closer to the true motion trajectory.

[0072] Step S303: Extract the snowflake prediction position from the predicted state.

[0073] The Kalman filter is a recursive algorithm mainly used for state estimation of dynamic systems. By combining the predicted value and the observed value of the current state, the Kalman filter can optimize the estimation of the system state in the presence of noise. Using the Kalman filter to estimate and predict the motion state (position, velocity, acceleration) of snowflake particles can achieve continuous tracking of the trajectory.

[0074] In the above steps, the motion state of the snowflake particles consists of position, velocity, and acceleration, and the state vector can be defined as:

[0075] Where, , represents the current position. , represents the velocity component. , represents the acceleration component.

[0076] The Kalman filter assumes that the particles move with a uniform acceleration, and the position is determined by the velocity and acceleration. Its state transition equation is:

[0077] where, F is the state transition matrix, is the process noise. The state transition matrix F is:

[0078] where, is the time interval between the current frame and the previous frame. This model assumes that: the change in position is determined by the velocity and acceleration. The change in velocity is determined by the acceleration. The acceleration remains constant.

[0079] Process noise reflects the random disturbances in the dynamic system. The process noise covariance matrix Q is defined as:

[0080] where, q is a scalar (tunable parameter) of the process noise intensity. The magnitude of Q controls the sensitivity of the model to the changes in acceleration and velocity.

[0081] There is also a certain relationship between the motion state of the snowflake particles and the observed values, which can be expressed by representing the two-dimensional position of the snowflake particles in the current frame, that is:

[0082] The observation equation can describe the relationship between the observed values and the motion state of the snowflakes, that is:

[0083] where, H is the measurement matrix, defined as:

[0084] where, is the measurement noise, representing the observation error. The measurement noise covariance matrix R is defined as:

[0085] where, , is the variance of the position observation value.

[0086] The specific working steps of the Kalman filter are divided into two steps, namely prediction and update. The formula for determining the predicted state is:

[0087] where, is the measured state vector.

[0088] The defining formula for the prediction error covariance is as follows:

[0089] Where is the predicted error covariance matrix. is the error covariance matrix of the previous frame.

[0090] And the main task in the update stage is to calculate the Kalman gain:

[0091] Where is the Kalman gain, which is used to balance the predicted value and the observed value.

[0092] The formula for state update is:

[0093] Where is the updated state vector. is the residual between the observed value and the predicted value.

[0094] The formula for updated error covariance is:

[0095] Where I represents the identity matrix.

[0096] The Kalman filter predicts the position of snow particles in the next frame by analyzing historical trajectory data, thereby narrowing the range of matching searches. In terms of noise smoothing, the Kalman filter combines the observed value and the predicted value to reduce the impact of noise during the detection process. In addition, the Kalman filter also has the fault tolerance ability for missing detections. That is, when a particle is not detected in a certain frame, the trajectory is updated using the predicted value to ensure the continuity of the trajectory.

[0097] As Figure 4 shown, the steps of matching within the set range of the predicted position of the snowflake may include step S401 to step S405.

[0098] Step S401, obtain the search radius of the snowflake particles.

[0099] Step S402, adjust the search radius according to the speed and acceleration in the predicted motion state.

[0100] Step S403, search for valid snowflake particles centered on the predicted position of the snowflake according to the adjusted search radius.

[0101] Step S404, determine whether valid snowflake particles are searched.

[0102] Step S405: If a valid snowflake particle is found, it is determined that the valid snowflake particle belongs to the snowflake trajectory.

[0103] This series of steps combines the historical motion states (position, velocity, acceleration) of the snowflake trajectory, uses the Kalman filter to predict the position and motion state of snowflake particles in a single-frame image, dynamically adjusts the search radius based on the predicted velocity and acceleration, matches and searches for valid snowflake particles within the surrounding range of the predicted position, and at the same time uses the search results to update the snowflake trajectory, forming a coherent mechanism for snowflake particle tracking and state update. The method of matching within the set range of the predicted position of the snowflake reduces the search range of snowflake particles in a single-frame image, improves the matching efficiency and accuracy, and avoids blind search of the entire image. At the same time, real-time updating of the trajectory ensures continuous tracking of the snowflake motion, effectively solves the problem of correlation matching of snowflakes between consecutive frames in a video sequence, and enhances the robustness and real-time performance of snowflake tracking. This method is applicable to scenarios that require precise capture of snowflake dynamics (such as meteorological monitoring, image synthesis, etc.), and can provide reliable position and state data support for subsequent analysis or applications based on snowflake motion.

[0104] Such as Figure 5 shown, the steps in the case where the valid snowflake particle does not belong to the snowflake trajectory may include Step S501 to Step S504.

[0105] Step S501: Continuously count the number of lost frames of the snowflake trajectory to obtain the number of lost frames. Record the number of times that no valid snowflake particles are matched in consecutive frames of the trajectory, quantifying the continuity of the trajectory. This provides a measurable basis for subsequent judgment of whether the trajectory is invalid, avoids misjudging the end of the trajectory based on a single-frame loss, and enhances the accuracy and robustness of the trajectory state assessment.

[0106] Step S502: Determine whether the number of lost frames exceeds a preset threshold. The preset threshold is used as a criterion for judging the continuity of the trajectory, which can distinguish whether the trajectory has short-term fluctuations or long-term failures. For example, snowflake particles may be lost in a single frame or a few consecutive frames due to temporary occlusion (such as interference from other objects), but if the preset threshold is not exceeded, the system will not easily terminate the trajectory, thus reducing misjudgment.

[0107] Step S503: If so, create a new snowflake trajectory. When the number of lost frames exceeds the preset threshold, it is determined that the original trajectory has failed. At this time, return to Step S302 to re-predict the single-frame predicted motion state of the snowflake particles and create a new snowflake trajectory.

[0108] Step S504, if not, then output the statistical information of the trajectory state of the snowflake trajectory. When the number of lost frames does not exceed the preset threshold, the statistical information of the trajectory state should be recorded so as to analyze the reason why the effective snowflake particles do not belong to the snowflake trajectory based on the statistical information. The statistical information can be parameters such as the average equivalent diameter or total area of the snowflake particles that can reflect the position or size of the snowflake particles. The statistical information can also include parameters such as the speed or acceleration of the snowflake particles.

[0109] When matching within the set range of the predicted position of the snowflake, a similarity matrix can be constructed for matching. The similarity matrix can be stored in the form of a two-dimensional array, and it is judged whether the effective snowflake particles match the snowflake trajectory according to the two-dimensional array. As the storage carrier of the similarity matrix, the two-dimensional array has become an ideal choice for the snowflake trajectory matching problem due to its efficient storage and calculation characteristics, flexible matching strategy compatibility, and engineering scalability. The two-dimensional array can transform the abstract similarity calculation into structured data operations, providing underlying data support for trajectory recognition tasks with high requirements for real-time performance, accuracy, and robustness.

[0110] As Figure 6 shown, the steps of matching within the set range of the predicted position of the snowflake can at least include Step S601 to Step S605.

[0111] Step S601, construct a similarity matrix between the snowflake trajectory and the effective snowflake particles. Transform the relationship between the snowflake trajectory and the effective particles into a two-dimensional array in the form of a mathematical matrix, providing a computable quantitative basis for subsequent matching.

[0112] Step S602, store the similarity matrix in the form of a two-dimensional array. The two-dimensional array has a simple structure and fast access speed, which is suitable for the computer to quickly read and process. Especially in real-time prediction scenarios, it can reduce latency. When dealing with the matching of a large number of snowflake trajectories and effective particles, applying the two-dimensional array can effectively improve the matching rate.

[0113] Step S603, judge whether the similarity matrix is less than the dynamic threshold. Using a dynamic threshold instead of a fixed value can automatically adjust the matching standard according to real-time data characteristics (such as snowflake density, environmental noise), improving the robustness of the algorithm in different scenarios. Moreover, through threshold screening, invalid matches with extremely low similarity (such as background noise or non-snowflake particles) can be excluded, reducing the subsequent calculation amount and improving efficiency. The dynamic threshold can be determined by the position, speed, and acceleration of the snowflake particles, and can also be adaptively adjusted according to weather factors.

[0114] Step S604, if so, output a similarity of 0. For cases below the threshold, directly mark them as 0 to avoid misjudging noise as valid snowflakes and reduce the frequency of false alarms. Moreover, not further analyzing values below the threshold can effectively improve the matching rate between snowflake trajectories and valid snowflake particles.

[0115] Step S605, if not, output the value of the similarity matrix as the similarity. For matches above the threshold, retain the original similarity value to provide accurate data for subsequent matching calculations.

[0116] When calculating the similarity, the total similarity between two particles is composed of the weighted sum of multiple feature similarities. The calculation formula for the total similarity is:

[0117] where, is the position similarity., is the feature similarity. , is the weight of the position and feature similarities, which satisfies + = 1 and can be specifically adjusted according to experiments. The position similarity is calculated based on the Euclidean distance between two points. The calculation formula is:

[0118] where, = and = are the position coordinates of trajectory i and particle j. is the Euclidean distance. is the scale parameter of the position similarity, used to control the influence of distance on the similarity.

[0119] The feature similarity combines the similarities of multiple features, including shape features (Hu moments), brightness features, and geometric features. The similarity of each feature has a separate formula and weight. Hu moments are a commonly used shape descriptor that can describe the rotational, scaling, and mirror invariance of an object. Assume that the Hu moments of the i-th trajectory are Hi and the Hu moments of the j-th particle are Hj. The calculation formula for Hu moments is:

[0120] where, Hi - Hj It is the Euclidean distance of Hu moments. α is a scaling parameter used to control the influence of Hu moments on similarity. Further, the brightness feature describes the average brightness and brightness distribution of snow particles. The brightness similarity between two particles is calculated based on the difference in average brightness, and the calculation formula is:

[0121] where is the Euclidean distance. is the scale parameter of position similarity.

[0122] The geometric features include the area and perimeter of snow particles, which are used to describe the size of the particles. The geometric feature similarity is based on the relative ratio of areas, and its calculation formula is:

[0123] where Ai and Aj are the areas of trajectory i and particle j respectively.

[0124] The comprehensive feature similarity is the weighted sum of shape, brightness, and geometric feature similarities, and its calculation formula is:

[0125] The similarity matrix S is a two-dimensional matrix representing the similarity between all trajectories and particles in the current frame. The similarity matrix S can be expressed as:

[0126] where n is the number of trajectories in the previous frame. m is the number of particles detected in the current frame. S represents the total similarity between trajectory i and particle j.

[0127] To find the best match between trajectories and particles, the Hungarian algorithm can also be used to solve the minimum-cost bipartite graph matching problem. Since the Hungarian algorithm solves the minimum-value problem, the input of the Hungarian algorithm can be the negative value of the similarity matrix S. The core process of this method first involves the initialization phase: input a negative similarity matrix C. Subsequently, enter the step of finding the optimal match: by applying the Hungarian algorithm, determine the matching combination between trajectories and particles to minimize the total cost. Finally, output the matching result. Then return the matching pair (i,j), while excluding those matches with a similarity lower than the preset similarity threshold. To enhance the robustness of the matching, the similarity threshold will be dynamically adjusted according to the status of the trajectories. The default value of the similarity threshold can be set to 0.6. For newly generated and short-length trajectories, a higher similarity threshold needs to be set for strict matching. For stable and long-length trajectories, a lower similarity threshold can be set to improve fault tolerance. For the situation of consecutive frame losses and unstable trajectory status, the similarity threshold should be reduced to avoid trajectory loss.

[0128] In some alternative embodiments, such as Figure 10 shown, the steps of the snowflake recognition and trajectory prediction method at least include step S1001 to step S1006.

[0129] Step S1001, image preprocessing. The process of image preprocessing includes steps such as identifying the grayscale image corresponding to the snowflake image to be recognized and performing binary segmentation on the grayscale image.

[0130] Step S1002, snowflake particle detection. In the process of detecting snowflake particles, it also includes steps of judging the lowest blurriness of the snowflake and performing adaptive adjustment on the snowflake.

[0131] Step S1003, feature extraction. By extracting the geometric features, brightness features, and blurriness features of effective snowflake particles, it can provide a data basis for subsequent prediction of snowflake trajectories and feature similarity matching.

[0132] Step S1004, Kalman filter motion prediction. Using the Kalman filter for filtering can predict a trajectory with smooth fluctuations in the trajectory and output an estimated value closer to the true motion trajectory.

[0133] Step S1005, feature similarity matching. The steps of feature similarity matching include constructing a similarity matrix and judging whether the effective snowflake particles match the snowflake trajectory successfully according to the value of the similarity matrix.

[0134] Step S1006, trajectory dynamic management. Trajectory management can provide an optimized trajectory processing function for the motion mode of small particles by features such as the area threshold of small particles, the maximum matching distance of small particles, and the minimum similarity required for matching, such as checking for trajectory intersections.

[0135] This embodiment also provides a computer program product 10, a computer-readable storage medium 20, and a computer device 30. Figure 11 is a schematic diagram of the computer program product 10 according to an embodiment of the present invention, Figure 12 is a schematic diagram of the computer-readable storage medium 20 according to an embodiment of the present invention, Figure 13 is a schematic diagram of the computer device 30 according to an embodiment of the present invention. The computer program product 10 includes a computer program 11, and when the computer program 11 is executed by a processor 32, it implements the steps of any one of the above-mentioned snowflake recognition methods based on machine vision. The computer-readable storage medium 20 stores the above-mentioned computer program 11, and when the computer program 11 is executed by a processor 32, it implements the steps of any one of the above-mentioned embodiments of the snowflake recognition method based on machine vision. The computer device 30 may include a memory 31, a processor 32, and a computer program 11 stored on the memory 31 and running on the processor 32.

[0136] The computer program 11 for performing the operations of the present invention can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, status setting data, configuration data of an integrated circuit, or source code or object code written in any combination of one or more programming languages and procedural programming languages. The computer program 11 can be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., using an Internet service provider via the Internet). In some embodiments, to perform aspects of the present invention, an electronic circuit, including, for example, a programmable logic circuit, a field-programmable gate array (FPGA), or a programmable logic array (PLA), can execute computer-readable program instructions by utilizing the status information of the computer-readable program instructions to personalize the electronic circuit.

[0137] For the purposes of the description of this embodiment, the computer program product 10 is a related product containing the computer program 11. For the purposes of the description of this embodiment, the computer-readable storage medium 20 is a tangible device capable of retaining and storing the computer program 11, which can be any device that can contain, store, communicate, propagate, or transport the program 11 for use by or in connection with an instruction execution system, apparatus, or device. More specific examples (non-exhaustive list) of the computer-readable storage medium 20 include the following: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanically encoded device, and any suitable combination of the above.

[0138] The computer device 30 can be, for example, a server, a desktop computer, a laptop computer, a tablet computer, or a smart phone. In some examples, the computer device 30 can be a cloud computing node. The computer device 30 can be described in the general context of computer system executable instructions, such as program modules, executed by a computer system. Generally, program modules can include routines, programs, object programs, components, logic, data structures, etc. that perform particular tasks or implement particular abstract data types. The computer device 30 can be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.

[0139] The computer device 30 can include a processor 32 adapted to execute stored instructions and a memory 31 that provides temporary storage space for the operation of the instructions during operation. The processor 32 can be a single-core processor, a multi-core processor, a computing cluster, or any number of other configurations. The memory 31 can include random access memory (RAM), read-only memory, flash memory, or any other suitable storage system.

[0140] The computer device 30 can also include a network adapter / interface and an input / output (I / O) interface. The I / O interface allows data to be input and output with external devices that can be connected to the computer device. The network adapter / interface can provide communication between the computer device and a network, which is typically shown as a communication network.

[0141] At this point, those skilled in the art should recognize that although numerous exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications consistent with the principles of the present invention can still be directly determined or derived from the disclosure of the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and construed to cover all such other variations or modifications.

Claims

1. A snowflake recognition method based on machine vision, characterized in that Including: Select a single-frame image from the video to be processed as the snowflake image to be recognized; Perform edge detection on the snowflake image to be recognized and extract the snowflake particle contour; Take the snowflake particle contour that meets the preset screening conditions as the effective snowflake particle, and extract the feature information of the effective snowflake particle.

2. The snowflake recognition method based on machine vision according to claim 1, characterized in that, After the step of extracting the feature information of the effective snowflake particle, it further includes: Obtain the snowflake prediction position in the single-frame image, and the snowflake prediction position is predicted based on the snowflake trajectory before the image in the single-frame image; Perform matching within the set range of the snowflake prediction position to determine whether the effective snowflake particle belongs to the snowflake trajectory; If so, update the snowflake trajectory.

3. The snowflake recognition method based on machine vision according to claim 2, characterized in that, The step of obtaining the snowflake prediction position includes: Determine the motion state of the snowflake particles in the frame before the single-frame image according to the snowflake trajectory, and the motion state includes position, speed, and acceleration; Use a Kalman filter to perform prediction calculations on the motion state in the previous frame to obtain the predicted motion state of the snowflake particles in the single-frame image; Extract the snowflake prediction position from the predicted state.

4. The method for snowflake recognition based on machine vision according to claim 2, characterized in that The step of performing matching within the set range of the snowflake prediction position includes: Obtain the snowflake particle search radius; Adjust the search radius according to the speed and acceleration in the predicted motion state; Search for the effective snowflake particles centered on the snowflake prediction position according to the adjusted search radius; If the effective snowflake particle is searched, it is determined that the effective snowflake particle belongs to the snowflake trajectory.

5. The snowflake recognition method based on machine vision according to claim 2, wherein, In the case where the effective snowflake particle does not belong to the snowflake trajectory, it further includes: Perform continuous lost frame counting on the snowflake trajectory to obtain the number of lost frames; Judge whether the number of lost frames exceeds the preset threshold; If so, create a new snowflake trajectory; If not, output the statistical information of the trajectory state of the snowflake trajectory.

6. The snowflake recognition method based on machine vision according to claim 2, characterized in that, The step of performing matching within the set range of the snowflake prediction position includes: Construct a similarity matrix between the snowflake trajectory and the effective snowflake particle; Store the similarity matrix in the form of a two-dimensional array; Judge whether the effective snowflake particle matches successfully with the snowflake trajectory according to the two-dimensional array; where The step of judging whether the effective particle matches successfully with the snowflake trajectory according to the two-dimensional array includes: Judge whether the similarity matrix is less than the dynamic threshold; the dynamic threshold is adjusted according to the length of the snowflake trajectory and the number of consecutive lost frames; If so, output a similarity of 0; If not, output the value of the similarity matrix as the similarity.

7. The method for snowflake recognition based on machine vision according to claim 1, characterized in that, The step of performing edge detection on the snowflake image to be recognized includes: Identify the grayscale image corresponding to the snowflake image to be recognized; Perform image preprocessing on the grayscale image by means of noise reduction and contrast enhancement; Perform binary segmentation on the preprocessed grayscale image to generate a binary image; Perform edge detection on the binary image.

8. The snowflake recognition method based on machine vision according to claim 7, characterized in that After the step of generating the binary image, it further includes: Judge whether there is a disconnected area in the binary image; If so, perform a closing operation on the binary image, and determine whether there are obvious noise points in the binary image; If so, perform a dilation operation on the binary image.

9. The snowflake recognition method based on machine vision according to claim 1, characterized in that, After the step of performing edge detection on the snowflake image to be recognized, the following steps are further included: determine whether the snowflake image meets a preset minimum blur requirement; If so, determine whether there are still the effective snowflake particles in the snowflake image; If so, extract the feature information in the snowflake image, where the feature information includes geometric features, brightness features, and blur features of the effective snowflake particles; If not, perform adaptive adjustment on the snowflake image, and re-determine whether the snowflake image meets the preset minimum blur requirement.

10. A computer device, comprising a memory, a processor, and a computer program stored on the memory, characterized in that, The processor executes the computer program to implement the steps of the machine vision-based snowflake recognition method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Real-time snowfall intensity estimation method based on video analysis

    CN105957057A

  • Video image processing method and device and electronic equipment

    CN111353954A

  • Meteorological parameter detection system based on snowflake shape analysis

    CN111626088A

  • Constraint-fused real-time snow simulation method based on position dynamics

    CN118410742A

  • Snowfall intensity detecting method

    KR101430932B1

Cited By

  • Particle micro-explosion combustion event detection and particle classification method based on multi-factor scoring

    CN121708519A