Vertical shaft vortex recognition and tracking algorithm
By applying vertical axis vortex recognition and tracking algorithms with image processing and pattern recognition technology in the MATLAB environment, the problems of low accuracy and tracking efficiency of neutral axis vortex recognition in the prior art are solved, and high-precision and highly adaptable vertical axis vortex recognition and continuous tracking are achieved, which improves the practicality and readability of the technology.
Patent Information
- Application Number
- CN202411563947.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-11-05
AI Technical Summary
The existing vertical axis vortex recognition methods are difficult to accurately capture all the features of vertical axis vortex when processing complex flow fields, and it is difficult to achieve high-precision real-time monitoring based on computing resources and data accuracy limitations, and there is a lack of effective vertical axis vortex tracking algorithms.
A vertical axis vortex recognition and tracking algorithm is provided. By performing environmental configuration and data preparation in the MATLAB environment, image processing and pattern recognition technology are used to identify and track vertical axis vortex, including normalized cross-correlation calculation, center of mass coordinate extraction and adjustment, trajectory tracking and result visualization.
It improves the accuracy and adaptability of vertical axis vortex recognition, realizes continuous tracking and efficient identification of opposite axis vortexes, provides a diverse output form, meets the needs of different users, and improves the practicality and readability of the technology.
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of vertical shaft vortex identification, in particular to a vertical shaft vortex identification and tracking algorithm. Background Art
[0002] There are many existing methods for vertical vortex identification, such as the vortex identification method based on velocity gradient tensor and the vortex identification method based on Rortex, but they have many limitations in practical applications. For example, some methods may not be able to accurately capture all the characteristics of vertical vortices when dealing with complex flow fields; some methods may be limited by factors such as computing resources and data accuracy, making it difficult to achieve high-precision identification in real-time monitoring. In addition, there are relatively few studies on the tracking of vertical vortices, and there is a lack of effective algorithms that can track the evolution of vertical vortices in real time and continuously.
[0003] Based on this, the present invention provides a vertical axis vortex identification and tracking algorithm to solve the above-mentioned technical problems. Summary of the invention
[0004] The purpose of the present invention is to provide a vertical-axis vortex identification and tracking algorithm, which can improve the identification accuracy and enhance the adaptability in vertical-axis vortex identification, and can achieve continuous tracking and improve tracking efficiency in vertical-axis vortex tracking. In terms of result output and visualization, the diversified output forms can meet the needs of different users, thereby improving the practicality of the technology. By drawing the identification results, tracking trajectories, feature analysis charts, etc. of the vertical-axis vortex, intuitive visualization of the results is achieved, which helps to intuitively understand the movement laws of the vertical-axis vortex and improves the readability and ease of use of the technology.
[0005] To achieve the above object, the present invention provides the following technical solutions:
[0006] The present invention provides a vertical axis vortex identification and tracking algorithm, comprising the following steps:
[0007] S1. Environment configuration and data preparation: In the MATLAB environment, clear the workspace variables, close all warning messages, and obtain the paths of the specified folders in the current working directory and the parent directory; read all the vertical axis vortex image files to be detected in the specified format under the specified folder; load the pre-trained vertical axis vortex feature template containing the typical image features of the vertical axis vortex;
[0008] S2, vertical axis vortex identification: read the obtained image, perform normalized cross-correlation calculation, set the matching degree threshold, extract and adjust the centroid coordinates of the connected area, then display the image and mark the vortex position, extract the local image of the vortex, capture the extracted image frame and store it, and then clear the image;
[0009] S3, vertical axis vortex tracking: extract the coordinates of a vertical axis vortex in a frame image, regard it as the tracking object, and use it as the initial position of the tracking; then track the trajectory; then extract the vortex image sequence and visualize the vortex trajectory; finally calculate the area and speed of the vortex and output the result.
[0010] The present invention is further configured as follows: in the step S1, the reading of the designated folder is performed using the dir function.
[0011] The present invention is further configured as follows: in step S41, the specified format file is a file ending with .jpg.
[0012] The present invention is further configured as follows: in step S2, the specific process is as follows:
[0013] S21, image reading: for each frame of image, use the imread function to read the image data and store it in variable A;
[0014] S22, normalized cross-correlation calculation: using the normxcorr2 function to calculate the normalized cross-correlation between the image A and the vertical axis vortex feature template vorxPattern, to obtain a matching degree matrix c;
[0015] S23, setting a matching degree threshold: setting a matching degree threshold, screening out areas with matching degrees higher than the threshold, treating them as potential vertical axis vortex positions, and storing them in a variable cr;
[0016] S24, centroid coordinate extraction and adjustment: extract the centroid coordinates of each connected area in cr, and adjust the centroid coordinates according to the size of the vertical axis vortex feature template vorxPattern to make it correspond to the actual position of the vertical axis vortex, and merge these coordinates and store them in the variable cCen;
[0017] S25, displaying the image and marking the vortex position: displaying the current frame image A through the imshow function, initializing a cell array vortexs for storing the local image area of each vortex, and drawing a rectangular frame to mark the identified vertical axis vortex position;
[0018] S26, extracting a local vortex image: intercepting a vertical axis vortex image in the original image A and extracting a local image region containing the vertical axis vortex centered at the center of mass, and storing the region in a variable vortexs;
[0019] S27, capturing image frames and storing: using the getframe function to capture the image frame of the current axis and store it in the variable F, and storing the adjusted vortex center coordinates, the vortex local image and the captured image frame in the cell array results;
[0020] S28, clear the image for subsequent preparation: clear the current graphics window to prepare for processing the next frame of image.
[0021] The present invention is further configured as follows: in step S22, the matching degree matrix c=nor mxcorr2(vorxPattern, A).
[0022] The present invention is further configured as follows: in step S24, the function used to extract the centroid coordinates of each connected region in cr is a regionprops function.
[0023] The present invention is further configured as follows: in step S3, the specific process is as follows:
[0024] S31, initializing trajectory tracking: extracting the coordinates of a vertical axis vortex in a frame image, treating it as a tracking object, and using it as the initial position of tracking;
[0025] S32, trajectory tracking: initialize an empty array vortexline to store the motion trajectory of the vortex, traverse the images from the 37th frame to the 180th frame, extract the centroid coordinates of all identified vertical axis vortices in the current frame for each frame, calculate the Euclidean distance between the centroids of these vortices and the positions of the vortices in the previous frame, find the vortex with the smallest distance, and use it as the tracking object of the current frame;
[0026] S33, extracting a vortex image sequence: initializing an empty array imgN for storing the image sequence of the tracked vortex, traversing each vortex position in vortexline, extracting a local image of the vortex from the corresponding frame image, and adding it to imgN;
[0027] S34, visualize vortex trajectory: use the montage function to display the morphology of a single vortex over time, and draw the vortex's trajectory over time on the original image;
[0028] S35, calculating the area and speed of the vortex: converting each vortex image in imgN into a grayscale image, then performing binarization processing, and using the regionprops function to calculate the area of each vortex, calculate the change of the vortex position between adjacent frames, and estimate the speed of the vortex;
[0029] S36, result output: plot the relationship between the speed and radius of a single vortex structure into a graph, plot the change of the area of a single vortex structure over time into a graph, and output prompt information.
[0030] The present invention is further configured as follows: in step S32, if the minimum distance is less than a set threshold, the position information of the tracked object is updated and added to the vortexline.
[0031] Compared with the prior art, the present invention has the following beneficial effects:
[0032] (1) In terms of vertical shaft vortex recognition, the present invention not only integrates advanced technologies such as image processing, pattern recognition and artificial intelligence, but can also more accurately extract the characteristics of the vertical shaft vortex, thereby improving the recognition accuracy. Compared with the traditional "rule-based" recognition method, this "feature-based" recognition method is more adaptable to complex and changeable fluid environments. Moreover, by training feature templates, it can adapt to vertical shaft vortex recognition tasks in different scenarios, thereby enhancing the adaptability and versatility of the technology.
[0033] (2) In terms of vertical axis vortex tracking, the present invention realizes continuous tracking of the vertical axis vortex, thereby providing a complete motion trajectory of the vertical axis vortex, which is of great significance for studying the motion law of the vertical axis vortex and predicting its development trend. At the same time, by calculating the Euclidean distance between all identified vertical axis vortices in the current frame and the position of the tracking object in the previous frame, the vertical axis vortex with the smallest distance is found as the tracking object of the current frame. This method can quickly locate the tracking object and improve the tracking efficiency.
[0034] (3) In terms of result output and visualization, the present invention saves the image data, position information, feature parameters, etc. generated during the identification and tracking process to a specified folder and synthesizes them into a video file to facilitate subsequent analysis and display. The diversified output forms can meet the needs of different users and improve the practicality of the technology. In addition, by drawing the identification results, tracking trajectories, feature analysis charts, etc. of the vertical axis vortex, intuitive visualization of the results is achieved, which helps to intuitively understand the movement law of the vertical axis vortex and improves the readability and ease of use of the technology. DETAILED DESCRIPTION
[0035] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0036] Example:
[0037] This embodiment provides a vertical axis vortex identification and tracking algorithm, and an implementation process thereof is as follows:
[0038] 1. Environment configuration and data preparation:
[0039] S11. In the MATLAB environment, first clear the workspace variables, close all warning messages, and obtain the paths of the "Function Module" folders in the current working directory and the parent directory.
[0040] S12. Use the dir function to read all the vertical axis vortex image files ending with ".jpg" in the specified folder. Through the automated image processing process, the efficiency of vertical axis vortex recognition and tracking is greatly improved, the need for manual operation is reduced, and the consistency and accuracy of data processing are ensured.
[0041] S13, loading a pre-trained vertical axis vortex feature template (vorxPattern.mat) containing typical image features of a vertical axis vortex for subsequent image matching and recognition.
[0042] 2. Vertical axis vortex identification:
[0043] S21. Image reading: For each frame of image, use the imread function to read the image data and store it in variable A.
[0044] S22. Normalized cross-correlation calculation: Use the normxcorr2 function to calculate the normalized cross-correlation between the image A and the vertical axis vortex feature template vorxPattern to improve the recognition of similar features in the image and obtain the matching degree matrix c.
[0045] Where c=normxcorr2(vorxPattern, A).
[0046] S23, setting the matching degree threshold: setting the matching degree threshold to 0.6, screening out areas with matching degrees higher than the threshold, treating them as potential vertical axis vortex positions, and storing them in the variable cr, that is, cr=c>0.6.
[0047] S24. Extraction and adjustment of center of mass coordinates: Use the regionprops function to extract the center of mass coordinates of each connected region in cr, that is, the center of mass coordinates of the potential vertical axis vortex region, and adjust the center of mass coordinates according to the template size to make it correspond to the actual position of the vertical axis vortex. These coordinates are combined and stored in the variable cCen. By extracting and adjusting the center of mass coordinates, the actual position of the vertical axis vortex can be accurately located, providing a basis for tracking and analyzing the vortex.
[0048] Where cCen=regionprops(cr,'Centroid').
[0049] S25, displaying the image and marking the vortex position: displaying the current frame image A through the imshow function, initializing a cell array vortexs for storing the local image area of each vortex; and drawing a rectangular frame to mark the identified vertical axis vortex position.
[0050] S26, extracting the local image of the vortex: intercepting the vertical axis vortex image in the original image A and extracting the local image area containing the vertical axis vortex centered at the center of mass, and storing it in the variable vortexs.
[0051] S27. Capture image frame and store: Use the getframe function to capture the image frame of the current axis and store it in the variable F, and store the adjusted vortex center coordinates, the vortex local image and the captured image frame in the cell array results.
[0052] S28, clear the image for subsequent preparation: clear the current graphics window to prepare for processing the next frame of image.
[0053] 3. Vertical axis vortex tracking
[0054] S31, initializing trajectory tracking: outputting a prompt message, indicating that the trajectory tracking calculation of a single vertical axis vortex has begun. Extracting the coordinates of a vertical axis vortex in a certain frame image, treating it as a tracking object, and using it as the initial position of the tracking.
[0055] S32, trajectory tracking: Initialize an empty array vortexline to store the motion trajectory of the vortex, traverse the images from the 37th frame to the 180th frame, extract the centroid coordinates of all identified vertical axis vortices in the current frame for each frame, calculate the Euclidean distance between the centroids of these vortices and the vortex positions of the previous frame, find the vortex with the smallest distance, and use it as the tracking object of the current frame. If the minimum distance is less than the set threshold (20 pixels), update the position information of the tracking object and add it to vortexline.
[0056] S33, extracting vortex image sequence: initialize an empty array imgN to store the image sequence of the tracked vortex; traverse each vortex position in vortexline, extract the local image of the vortex from the corresponding frame image, and add it to imgN.
[0057] S34. Visualize vortex trajectory: Use the montage function to display the morphology of a single vortex over time and draw the vortex's trajectory over time on the original image.
[0058] S35. Calculate the area and speed of the vortex: Convert each vortex image in imgN into a grayscale image, then perform binarization processing, use the regionprops function to calculate the area of each vortex, calculate the change of vortex position between adjacent frames, and estimate the speed of the vortex.
[0059] S36. Result output: The relationship between the speed and radius of a single vortex structure is plotted into a graph, and the change in the area of a single vortex structure over time is plotted into a graph, and a prompt message is output to indicate that the result has been saved as an MP4 video file and the program processing is completed.
[0060] In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0061] The preferred embodiments of the present invention disclosed above are only used to help illustrate the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. Vertical axis vortex identification and tracking algorithm, characterized in that: The following steps are involved: S1. Environment configuration and data preparation: In the MATLAB environment, clear the workspace variables, close all warning messages, and obtain the paths of the specified folders in the current working directory and the parent directory; read all the vertical axis vortex image files to be detected in the specified format under the specified folder; load the pre-trained vertical axis vortex feature template containing the typical image features of the vertical axis vortex; S2, vertical axis vortex identification: read the obtained image, perform normalized cross-correlation calculation, set the matching degree threshold, extract and adjust the centroid coordinates of the connected area, then display the image and mark the vortex position, extract the local image of the vortex, capture the extracted image frame and store it, and then clear the image; S3, vertical axis vortex tracking: extract the coordinates of a vertical axis vortex in a frame image, regard it as the tracking object, and use it as the initial position of the tracking; then track the trajectory; then extract the vortex image sequence and visualize the vortex trajectory; finally calculate the area and speed of the vortex and output the result.
2. The vertical axis vortex identification and tracking algorithm according to claim 1 is characterized in that: In the step S1, the designated folder is read using the dir function.
3. The vertical axis vortex identification and tracking algorithm according to claim 1 is characterized in that: In the step S41, the specified format file is a file ending with .jpg.
4. The vertical axis vortex identification and tracking algorithm according to claim 1 is characterized in that: In step S2, the specific process is as follows: S21, image reading: for each frame of image, use the imread function to read the image data and store it in variable A; S22, normalized cross-correlation calculation: using the normxcorr2 function to calculate the normalized cross-correlation between the image A and the vertical axis vortex feature template vorxPattern, to obtain a matching degree matrix c; S23, setting a matching degree threshold: setting a matching degree threshold, screening out areas with matching degrees higher than the threshold, treating them as potential vertical axis vortex positions, and storing them in a variable cr; S24, centroid coordinate extraction and adjustment: extract the centroid coordinates of each connected area in cr, and adjust the centroid coordinates according to the size of the vertical axis vortex feature template vorxPattern to make it correspond to the actual position of the vertical axis vortex, and merge these coordinates and store them in the variable cCen; S25, displaying the image and marking the vortex position: displaying the current frame image A through the imshow function, initializing a cell array vortexs for storing the local image area of each vortex, and drawing a rectangular frame to mark the identified vertical axis vortex position; S26, extracting a local vortex image: intercepting a vertical axis vortex image in the original image A and extracting a local image region containing the vertical axis vortex centered at the center of mass, and storing the region in a variable vortexs; S27, capturing image frames and storing: using the getframe function to capture the image frame of the current axis and store it in the variable F, and storing the adjusted vortex center coordinates, the vortex local image and the captured image frame in the cell array results; S28, clear the image for subsequent preparation: clear the current graphics window to prepare for processing the next frame of image.
5. The vertical axis vortex identification and tracking algorithm according to claim 4 is characterized in that: In the step S22, the matching degree matrix c=normxcorr2(vorxPattern, A).
6. The vertical axis vortex identification and tracking algorithm according to claim 4 is characterized in that: In step S24, the function used to extract the centroid coordinates of each connected region in cr is the regionprops function.
7. The vertical axis vortex identification and tracking algorithm according to claim 1 is characterized in that: In step S3, the specific process is as follows: S31, initializing trajectory tracking: extracting the coordinates of a vertical axis vortex in a frame image, treating it as a tracking object, and using it as the initial position of tracking; S32, trajectory tracking: initialize an empty array vortexline to store the motion trajectory of the vortex, traverse the images from the 37th frame to the 180th frame, extract the centroid coordinates of all identified vertical axis vortices in the current frame for each frame, calculate the Euclidean distance between the centroids of these vortices and the positions of the vortices in the previous frame, find the vortex with the smallest distance, and use it as the tracking object of the current frame; S33, extracting a vortex image sequence: initializing an empty array imgN for storing the image sequence of the tracked vortex, traversing each vortex position in vortexline, extracting a local image of the vortex from the corresponding frame image, and adding it to imgN; S34, visualize vortex trajectory: use the montage function to display the morphology of a single vortex over time, and draw the vortex's trajectory over time on the original image; S35, calculating the area and speed of the vortex: converting each vortex image in imgN into a grayscale image, then performing binarization processing, and using the regionprops function to calculate the area of each vortex, calculate the change of the vortex position between adjacent frames, and estimate the speed of the vortex; S36, result output: plot the relationship between the speed and radius of a single vortex structure into a graph, plot the change of the area of a single vortex structure over time into a graph, and output prompt information.
8. The vertical axis vortex identification and tracking algorithm according to claim 7 is characterized in that: In step S32, if the minimum distance is less than a set threshold, the position information of the tracked object is updated and added to the vortexline.
Citation Information
Patent Citations
Cross-modal target tracking method based on visual semantics
CN117474950A
Automatic tracking circulation calculation method for moving vortex structure
CN118445922A
Flow field feature extraction tracking method, device and equipment based on physical information fusion
CN118657808A
Trajectory information processing device, trajectory information processing method, and program
JP3930894B1
Oceanic Eddy Detection from Two-Dimensional Sea Level Topography Gradients
US20200160568A1