A method for video recognition and analysis based on body features

By using a shape-feature-based video recognition method, the problem of unstable video recognition under varying lighting and noisy environments in existing technologies has been solved. This method achieves efficient and accurate target shape analysis and automated retrieval, and is suitable for complex scenarios such as security monitoring and behavior recognition.

CN120808238BActive Publication Date: 2026-02-03BEIJING SIHAI TONGDA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511073903.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-01
Publication Date
2026-02-03
Estimated Expiration
2045-08-01

AI Technical Summary

Technical Problem

Existing video recognition technologies struggle to achieve real-time and accurate target shape recognition and analysis under varying lighting conditions, noisy environments, and complex backgrounds. Furthermore, unstable feature extraction leads to errors and low computational efficiency.

Method used

A video recognition method based on shape features is adopted. Through two-dimensional pixel coordinate mapping, mirror extension boundary, median filtering, four-neighbor connected component analysis, polar angle sorting, Euclidean distance resampling, three-point difference curvature estimation, and spectrum analysis, a standardized spectrum amplitude feature vector is formed to realize the inter-frame similarity calculation.

Benefits of technology

It improves the robustness and accuracy of video recognition, reduces the need for manual parameter tuning, adapts to complex backgrounds and dynamic scenes, ensures the stability and comparability of feature extraction, and enhances the ability to recognize and retrieve shapes across frames and scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120808238B_ABST
    Figure CN120808238B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of video recognition and analysis, and discloses a video recognition and analysis method based on shape features. Video frame pixels are mapped to a two-dimensional coordinate system with the upper left corner as the origin, a gray image is mirror-extended and subjected to median filtering; a binary image is constructed based on a gray threshold value, and a target region is extracted through four-neighborhood connected domain analysis; a neighborhood search and polar angle sorting closed tracking contour is adopted, equal-distance resampling points are generated based on Euclidean distance and an interpolation method; a three-point difference algorithm is used to estimate the curvature of the resampling points, and a numerical protection is adopted to avoid zero denominator; a discrete Fourier transform is performed on the curvature sequence to extract the frequency spectrum, and then the normalized amplitude is used to form a standardized feature vector; finally, interframe similarity is calculated based on the feature vector, and the most similar frame is automatically searched. Through phased processing, unified data standards, edge noise suppression, uniform sampling, feature stability improvement and cross-frame comparability are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of video recognition and analysis, in particular to a video recognition and analysis method based on shape features. BACKGROUND

[0002] With the rapid development of video monitoring, intelligent transportation, virtual reality and other fields, there are higher and higher requirements for automatic recognition and analysis of target shapes in videos. The existing technology mainly uses means such as gray scale or color segmentation, edge detection, contour extraction, and frequency domain analysis to describe and classify moving objects or human body contours.

[0003] Firstly, the gray scale segmentation method based on global or local threshold (such as fixed threshold segmentation, Otsu algorithm, etc.) is extremely sensitive to light changes and background complexity. When the background light or target reflection causes the gray scale distribution to drift, the segmentation result is prone to foreground loss, background false detection, etc., and manual adjustment of the threshold parameter is required to ensure the accuracy of the segmentation, which is difficult to meet the needs of real-time and large-scale video stream processing. Secondly, the commonly used edge detection operators (such as Canny, Sobel) have obvious performance degradation in high noise environment. Although various filters (median filtering, Gaussian filtering) can be used for preprocessing, noise suppression and edge preservation are often difficult to balance. In actual scenes, the gray scale or texture contrast between the foreground and background is insufficient, which will also lead to edge breakage or false alarm, thereby affecting the complete extraction of the contour. Thirdly, the connected component analysis and contour tracking algorithm (such as eight-connected / four-connected component labeling, chain code encoding) is not robust enough for small spot noise or contour breakage. For complex shapes or multi-target scenes, the connected component region often contains interfering objects, making it difficult to accurately select the region of interest; chain tracking is prone to tracking failure at discontinuous boundaries or concave places, and needs to use post-processing steps such as polar angle sorting or centroid sorting, which increases the algorithm complexity. In the parameterization and resampling of the contour, the existing scheme usually directly uses the original contour points or simplified polygon fitting, without ensuring that the sampling points are evenly distributed along the contour. This leads to uneven curvature estimation, amplification of curvature discontinuity or noise peaks, and affects the stability and comparability of the features. At the same time, most curvature estimation methods (such as second-order derivative or curvature kink difference) may have zero denominator or numerical explosion when the adjacent three points are approximately collinear, which needs to be specially processed for extreme geometric configurations, otherwise it is easy to cause false decisions. In the aspect of frequency domain feature extraction, methods such as discrete Fourier contour descriptor (Fourier Descriptor) require fixed length input or pre-set shape alignment method, and rely on empirical coefficients in amplitude normalization and scale normalization. The feature dimensions between different target sizes or different resolution video frames are difficult to compare directly, and truncation, zero padding or dynamic time warping are often used, which has a significant impact on the calculation efficiency and real-time performance.

[0004] To this end, the present application aims to propose a method of video recognition and analysis based on shape features, which gradually converts the original video frames into representative normalized spectral feature vectors, effectively extracts the essential features of the target shape through a series of rigorous image processing and feature parameterization steps, and finally uses them as criteria for inter-frame retrieval and comparison. SUMMARY

[0005] The present application provides a method of video recognition and analysis based on shape features, which solves the problems mentioned in the background art.

[0006] The present application provides the following technical solutions: a method of video recognition and analysis based on shape features, comprising:

[0007] Map each pixel in the video frame to a two-dimensional pixel coordinate system with the upper left corner of the image as the origin, and mirror the extended boundary and median filter the input grayscale image;

[0008] Construct a binary image according to the pixel grayscale threshold, and extract all connected domain regions using four-neighbor connected domain analysis, and select the target region as the region of interest;

[0009] Detect the target boundary pixels using a neighborhood search algorithm, and realize closed tracking of the contour points through polar angle sorting to form a continuous set of boundary points;

[0010] Calculate the contour cumulative length by Euclidean distance, determine the equidistant resampling points, and generate equidistantly distributed contour sampling points based on the interpolation algorithm;

[0011] Estimate the curvature of the resampled contour points using a three-point difference algorithm, and perform numerical protection processing for the zero denominator situation that may occur during calculation;

[0012] Apply discrete Fourier transform to the estimated curvature sequence to obtain the spectral information of the contour curvature;

[0013] Extract the amplitude information from the spectral results and perform normalization processing to form a standardized spectral amplitude feature vector;

[0014] Based on the normalized spectral amplitude feature, calculate the shape similarity between different video frames, and realize retrieval and comparison according to the preset similarity criterion, and output the video frame with the most similar shape feature to the reference frame.

[0015] Optionally, the mapping of each pixel in the video frame to a two-dimensional pixel coordinate system with the upper left corner of the image as the origin, and the mirror extension boundary and median filtering of the input grayscale image, specifically includes:

[0016] Construct a two-dimensional pixel coordinate system ,origin Located in the top left corner of the image, The positive axis extends along the width of the image connected to the origin in a direction away from the origin. The positive axis extends along the image height edge connected to the origin in a direction away from the origin, with units of pixels; where... Image width; Image height;

[0017] Get the Frame input grayscale image in pixels The grayscale value at that location is denoted as ;in, For video frame indexing;

[0018] Set image extension boundaries: For those outside the range The coordinates are filled with the nearest boundary pixel value; For the first The grayscale value of the frame after mirror boundary expansion;

[0019] For each point Calculate the first Frame in pixel proceed at the place The result after median filtering ;in, To retrieve the value from the set;

[0020] Calculate the first Frame pixels The grayscale value after median filtering and rounding: .

[0021] Optionally, the step of constructing a binary image based on a pixel grayscale threshold, extracting all connected component regions using four-neighbor connected component analysis, and selecting the target region as the region of interest specifically includes:

[0022] Calculate the first Maximum grayscale value of all pixels in a frame ;

[0023] Calculate the first Minimum grayscale value of all pixels in a frame ;

[0024] Set the first The global binary segmentation threshold for the frame is ;

[0025] Constructing a binary graph: ;in, For the first Frame pixels The binary value;

[0026] Using four neighbor pairs Perform connected component labeling to obtain the set of connected components. ;in, For the first Frame number One connected component; For the first The number of pixels in each connected component; For the first The number of connected components in a frame binary graph;

[0027] The four neighboring regions include , ;

[0028] like If the condition is met, the process will terminate and output "No foreground".

[0029] Otherwise, take , ;in, Index of the largest connected component; For the first The frame target region is the connected component with the most pixels.

[0030] like If the condition is not met, the process will terminate and output that the number of points in the region is insufficient.

[0031] Optionally, the step of using a neighborhood search algorithm to detect target boundary pixels and using polar angle sorting to achieve closed tracking of contour points, forming a continuous set of boundary points, specifically includes:

[0032] Set the boundary point set:

[0033] ;in, For the first Each boundary pixel coordinate, Number the outline points; For the first Frame outline point set; To detect the current pixel The offset vector used to determine whether the four neighbors are background. This is the horizontal offset. This is the vertical offset;

[0034] Calculate the first Number of frame outline points ;

[0035] like If the output is insufficient contour points, the process will terminate and output the result.

[0036] From any point Departure, in offset order:

[0037] Select the next boundary point in sequence until returning to the previous point. Record sequence ;in, For the first The first frame outline The coordinates of the points;

[0038] like Then proceed with steps S301 to S302:

[0039] S301. Calculate the centroid:

[0040] , , ;in, For the first Centroid coordinates of frame contour points;

[0041] S302, Polar Angle Sort:

[0042] ;in, For the first The polar angle of a contour point relative to the centroid; Given the arctangent function in the four quadrants, output ;

[0043] according to From childhood to adulthood Reorder the sequences to obtain a closed sequence.

[0044] Optionally, the step of calculating the cumulative length of the contour using Euclidean distance, determining equidistant resampling points, and generating equidistantly distributed contour sampling points based on an interpolation algorithm specifically includes:

[0045] Take the circular index Calculate the first Frame number Euclidean distance between one contour point and the next contour point :

[0046] ;

[0047] Calculate the first The cumulative arc length corresponding to each contour point , ;

[0048] Calculate the first Total perimeter of frame outline ;

[0049] Assume the number of sampling points is the same as the number of origin points: , ; wherein, is the number of points after equidistant resampling of the frame profile; is the target arc length position after equidistant resampling; is the resampling point number;

[0050] For each , find the index such that , calculate ; wherein, is the normalized proportion of the sampling point between and ;

[0051] Interpolated sampling point: ,

[0052] ; wherein, is the coordinate of the equidistant resampling point;

[0053] Obtain .

[0054] Optionally, the three-point difference algorithm is used to estimate the curvature of the resampled profile points, and numerical protection processing is performed on the possible zero denominator situation in the calculation process, specifically including:

[0055] Set the numerical protection threshold ;

[0056] Periodic boundary extension: ,

[0057] ;

[0058] Define the difference quantity:

[0059] , ;

[0060] , ;

[0061] ; wherein, is the left and right difference of the point; is the up and down difference of the point; and are three-point second-order differences; is the difference modulus square sum;

[0062] If , ; otherwise ; wherein is the curvature of the th sampling point in the th frame.

[0063] Optionally, the estimated curvature sequence is applied with a discrete Fourier transform to obtain spectral information of the profile curvature, specifically comprising:

[0064] Setting an imaginary unit ;

[0065] Calculating the number of spectral components in the th frame ;

[0066] Calculating the th curvature spectral complex component in the th frame :

[0067] ; wherein is the spectral component number.

[0068] Optionally, the amplitude information is extracted from the spectral result and normalized to form a normalized spectral amplitude feature vector, specifically comprising:

[0069] Calculating the amplitude of the th spectral component in the th frame ;

[0070] Constructing the amplitude vector in the th frame ;

[0071] Calculating the sum of squares of all spectral component amplitudes in the th frame ;

[0072] If , terminate and output the spectral energy is too low;

[0073] Otherwise, normalize to: , ; wherein is the normalized result of the th spectral amplitude in the th frame; is the normalized amplitude feature vector in the th frame.

[0074] Optionally, the step of calculating the shape similarity between different video frames based on the normalized spectral amplitude features, and performing retrieval and comparison according to a preset similarity criterion, outputting the video frame with the most similar shape features to the reference frame, specifically includes:

[0075] The minimum spectral dimension shared by the reference frame and the candidate frame is set as follows:

[0076] ;in, For candidate frame index;

[0077] like The output spectrum dimension is insufficient, and the process terminates.

[0078] Calculate reference frame and candidate frames Curvature spectrum Euclidean distance metric :

[0079] ;in, For candidate frame number One normalized amplitude;

[0080] Most similar frame retrieval: ;in, To be consistent with the reference frame The frame number that has the most similar curvature spectrum of the shape.

[0081] The present invention has the following beneficial effects:

[0082] 1. By employing a standardized two-dimensional pixel coordinate system mapping, all subsequent processing is unified into a spatial system with the top-left corner of the image as the origin, achieving seamless access and consistent positioning of multi-source video data. Simultaneously, a mirror boundary expansion technique is introduced to effectively solve common boundary overflow and distortion problems in boundary pixel processing, ensuring that pixels in edge regions participate in the calculation. The application of median filtering suppresses salt-and-pepper noise and occasional pixel interference, improving the overall signal-to-noise ratio of the original image and laying a high-quality foundation for subsequent image segmentation and feature extraction. Compared with the traditional approach of directly processing the original frame, this method emphasizes spatial and pixel-level standardization and robustness, providing a fundamental guarantee for the repeatability and engineering adaptability of subsequent stages of the algorithm. It solves the practical problems often encountered by traditional algorithms when processing boundary, low-quality, or noisy video frames, such as missegmentation, contour breakage, and unstable feature extraction.

[0083] 2、Adopt adaptive global threshold to carry out binaryzation processing, and automatically generate segmentation threshold according to the actual gray distribution of the current frame image, which avoids a large number of manual parameter adjustment. Combined with four-neighborhood connected domain marking technology, not only the target region can be extracted completely, but also the scattered noise spots can be efficiently removed. The maximum connected domain automatic screening mechanism ensures that the extracted region has practical recognition significance. Compared with most existing binary segmentation methods which rely on manual setting or are only suitable for specific scenes, the present application improves the target segmentation accuracy and adaptive ability under complex background and dynamic scene. It reduces the failure of foreground extraction caused by improper threshold setting, solves the pain point that the target region is difficult to accurately lock in complex background, and automatically avoids the interference caused by small spot noise.

[0084] 3、By introducing neighborhood search and polar angle sorting strategy, the target boundary pixels can be accurately locked, and the closed and ordered arrangement of the contour points is ensured. Especially the combination of centroid calculation and polar angle sorting not only enhances the geometric consistency of contour extraction, but also effectively solves the problems of broken chain and unordered point set in chain tracking. Compared with the traditional method which only relies on simple contour tracking or single threshold, the present method improves the tracking closure rate and the spatial distribution continuity of boundary points under complex contour, improves the accuracy of subsequent parameterization and feature extraction, improves the coherence and integrity of target boundary extraction, and eliminates the feature expression distortion caused by chain break or sequence disorder, which adapts to the precise extraction demand of high deformation and complex contour shape.

[0085] 4、On the basis of the contour point set, the arc length accumulation and equidistant resampling mechanism is introduced, which effectively converts the original contour points with uneven spatial distribution into uniformly distributed feature points. This method can reduce the curvature estimation deviation caused by uneven sampling, making the shape description more consistent and comparable. Interpolation sampling ensures the smoothness and continuity of the contour curve, which is helpful for subsequent spectral analysis. Compared with the method of using only original boundary points or simple interval sampling, this scheme shows stronger robustness and universality in describing complex or high curvature change contours. It solves the feature expression distortion caused by uneven contour point sampling density, and improves the basis of shape alignment and feature consistency under multiple frames and multiple targets.

[0086] 5、Three-point difference algorithm is used for local curvature estimation, and a global numerical protection threshold is introduced to solve the problem of numerical zero division or instability. This method is not only more robust in numerical calculation, but also effectively eliminates the curvature mutation caused by discrete sampling. Compared with the traditional second-order derivative or local polynomial fitting curvature algorithm, the present application improves the adaptability to discrete points and boundary points while ensuring accuracy, which is suitable for various complex contours and dynamic change environments. It avoids distortion and collapse caused by zero division or extreme values in curvature calculation, so that the shape feature extraction still performs stably and reliably on high variability data sets.

[0087] 6. The curvature sequence in the time domain is transformed into features in the frequency domain, and Fourier transform is used to capture global and local changes in the shape structure. Spectral analysis can more comprehensively reflect the periodicity and complexity of the contour, effectively avoiding the limitations of single spatial features in expressing details and overall form. Compared to traditional representation methods that rely on edge coordinates or geometric moments, the spectral features of this invention are more stable, noise-resistant, and rotationally invariant, adapting to arbitrary changes in the shape in space. It solves the inconsistency problem introduced by spatial sampling, improves the contrast and uniqueness of shape features across frames and scenes, and is suitable for large-scale retrieval and rapid matching.

[0088] 7. By extracting the amplitude of the spectral features and normalizing them fully, the influence of scale or brightness differences between different video frames and targets is effectively eliminated, resulting in standardized feature vectors. This strategy ensures that the feature representations of different video frames can be directly compared in the same metric space, improving the algorithm's engineering practicality and deployment scalability. Compared with traditional methods that only retain local amplitudes or do not perform normalization processing, this invention ensures the fairness and robustness of the retrieval and comparison process. It eliminates feature bias caused by changes in external parameters, providing a solid foundation for subsequent automated retrieval and intelligent matching.

[0089] 8. A frame similarity metric based on spectral amplitude features was designed. Normalized Euclidean distance is used to measure shape differences, enabling efficient automatic retrieval with reference frames. The minimum distance strategy ensures high consistency in shape features between the output and target frames, simplifying the traditional manual comparison and judgment process. Compared to existing retrieval systems that rely solely on color, texture, or single spatial features, this invention offers higher discriminative power and adaptability, making it widely applicable to complex scenarios such as security monitoring and behavior recognition. It solves practical problems such as recognition errors and low retrieval efficiency caused by insufficient traditional feature representation or single comparison methods, achieving a higher level of automated and intelligent video content analysis. Attached Figure Description

[0090] Figure 1 This is a schematic diagram of the process of the present invention. Detailed Implementation

[0091] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0092] Example, refer to Figure 1 A method for video recognition and analysis based on shape features, comprising:

[0093] Each pixel in the video frame is mapped to a two-dimensional pixel coordinate system with the upper left corner of the image as the origin, and the input grayscale image is mirror-extended boundary and median filtered;

[0094] A binary image is constructed according to a pixel grayscale threshold, and all connected domain regions are extracted using a four-neighbor connected domain analysis, from which a target region is selected as a region of interest;

[0095] The target boundary pixels are detected using a neighborhood search algorithm, and the closed tracking of the contour points is achieved through polar angle sorting to form a continuous boundary point set;

[0096] The contour cumulative length is calculated by the Euclidean distance, the equidistant resampling points are determined, and the equidistantly distributed contour sampling points are generated based on an interpolation algorithm;

[0097] The curvature of the resampled contour points is estimated using a three-point difference algorithm, and numerical protection processing is performed on the zero denominator situation that may occur during calculation;

[0098] The curvature sequence obtained by estimation is applied to discrete Fourier transform to obtain the spectral information of the contour curvature;

[0099] The amplitude information is extracted from the spectral results and normalized to form a standardized spectral amplitude feature vector;

[0100] Based on the normalized spectral amplitude feature, the shape similarity between different video frames is calculated, and retrieval and comparison are realized according to a preset similarity criterion, and the video frame with the most similar shape feature to the reference frame is output.

[0101] Through the phased image processing steps, the problems of non-uniform standards of multi-source data, serious target edge noise interference, unstable feature extraction, and weak automatic retrieval capability in video target recognition are systematically solved. Specifically, the compatibility of video frames from different sources and the image quality are effectively improved through a unified pixel coordinate system and median filtering. The binary segmentation and connected domain screening can automatically remove interference and noise regions to ensure the accuracy of the object of interest. The subsequent contour extraction and resampling eliminate the problem of uneven distribution of sampling points, improving the shape parameterization and feature stability. Through curvature estimation and spectral analysis, the essential features of the shape structure are further mined and expressed, and the normalized feature vector ensures the comparability of cross-frame features. Finally, the technical difficulties of automatic identification and content retrieval of massive data in videos are effectively solved by using inter-frame similarity measurement and automatic retrieval. The overall scheme not only improves the recognition accuracy and system robustness, but also reduces the burden of manual intervention and parameter tuning, providing an efficient and reliable solution for automatic video analysis and monitoring in practical engineering applications.

[0102] The method comprises the following steps: mapping each pixel in the video frame to a two-dimensional pixel coordinate system with the upper left corner of the image as the origin, and performing mirror boundary extension and median filtering processing on the input grayscale image.

[0103] Constructing a two-dimensional pixel coordinate system , the origin is located at the upper left corner of the image, the axis is along the image width connected to the origin in the direction away from the origin, the axis is along the image height connected to the origin in the direction away from the origin, and the unit is pixel; wherein, is the image width; is the image height; unify the reference system of all subsequent spatial variables to ensure consistency of positioning and measurement;

[0104] Obtain the grayscale value of the input grayscale image at pixel of the first frame, denoted as ; wherein, is the video frame index; obtain the original image data to provide input for subsequent processing;

[0105] Set the mirror boundary extension: fill the coordinates outside the range with the nearest boundary pixel value; is the grayscale value of the first frame after mirror boundary extension;

[0106] Calculate the result of the median filtering processing of the first frame at pixel ; wherein, is the median value of the set; suppress salt and pepper noise and ensure that the boundary pixels do not exceed the boundary when filtering; Calculate the grayscale value of the first frame pixel after median filtering and rounding:

[0107] ; convert the grayscale value to an integer to ensure the accuracy of subsequent comparison and threshold operations.

[0108] ​​​By standardizing the pixel coordinate system, video frames from different sources and resolutions are unified into a single reference frame, facilitating subsequent feature calculations and spatial positioning operations, and eliminating compatibility barriers between different cameras and formats. Mirrored boundary expansion automatically fills in gaps caused by algorithm window overflow during image edge processing, effectively preventing computational anomalies when boundary points participate in filtering, thus ensuring no loss of edge information. Median filtering specifically targets common video noise and isolated pixels, smoothing the image and suppressing interference without losing target details, further improving the accuracy and reliability of subsequent target segmentation and contour extraction. Rounding grayscale values ​​ensures good computational compatibility and discreteness for all pixel feature data, providing high-precision and unambiguous input data for subsequent binary segmentation and threshold determination. In summary, this step lays a solid foundation for the entire video recognition process, enabling all downstream algorithms to operate on standard, clear, and low-noise data, improving the overall stability and scalability of the system.

[0109] The process of constructing a binary image based on pixel grayscale thresholds and extracting all connected component regions using four-neighbor connected component analysis, and then selecting the target region as the region of interest, specifically includes:

[0110] Calculate the first Maximum grayscale value of all pixels in a frame ;

[0111] Calculate the first Minimum grayscale value of all pixels in a frame ;

[0112] Set the first The global binary segmentation threshold for the frame is ;

[0113] Automatically determine the global binarization threshold to avoid manual parameter tuning;

[0114] Constructing a binary graph: ;in, For the first Frame pixels The binary values ​​are used to convert the grayscale image into a foreground / background binary image, highlighting the target area.

[0115] Using four neighbor pairs Perform connected component labeling to obtain the set of connected components. ;in, For the first Frame number One connected component; For the first The number of pixels in each connected component; For the first The number of connected domains in the frame binary image; discrete foreground pixels are grouped to provide a basis for subsequent selection of the main region;

[0116] The four-neighborhood includes 、 ;

[0117] If , terminate and output no foreground;

[0118] Otherwise, take , ; wherein, is the maximum connected domain index; is the target region of the frame, i.e., the connected domain with the most pixels;

[0119] If , terminate and output insufficient region points; remove small noise spots, determine the effective target region, and give explicit branch processing for extreme cases.

[0120] By automatically setting the global binary segmentation threshold, the uncertainty of manual parameter selection in traditional segmentation and the poor adaptability to different scenes are effectively avoided, and wide adaptability to different video scenes is achieved. Using four-neighborhood connected domain analysis technology, foreground pixels are automatically grouped, which can quickly and efficiently distinguish the difference between the target region and background noise, laying a solid foundation for subsequent target tracking and recognition. Using the maximum connected domain filtering mechanism, the main target region is effectively focused, and most of the background noise and irrelevant small spots are filtered out, improving the efficiency and accuracy of subsequent processing. Explicit termination and processing branches are given for the cases of no foreground or insufficient region points, improving the system's abnormality detection and robustness. This step not only improves the automation level of target segmentation, but also reduces the probability of misjudgment caused by the influence of background complexity and image noise, and is a prerequisite for the smooth progress of subsequent boundary detection and feature extraction, providing a guarantee for the final realization of high-accuracy video target recognition.

[0121] The target boundary pixels are detected using a neighborhood search algorithm, and the contour points are closed tracked through polar angle sorting to form a continuous boundary point set, specifically including:

[0122] Set the boundary point set:

[0123] ; wherein, is the th boundary pixel coordinate, is the contour point number; is the th frame contour point set; is the offset vector used when detecting whether the four-neighborhood of the current pixel is background, is a horizontal offset amount, is a vertical offset amount; the outer edge pixels of the target region are located, and a contour point set is constructed;

[0124] Calculate the first frame contour point number ;

[0125] If , terminate and output insufficient contour points;

[0126] Starting from any point , in the offset order:

[0127] Select the next boundary point in turn until , record the sequence ; wherein, is the coordinate of the first frame contour point ; obtain the contour point chain closed in order, which is convenient for subsequent parameterization processing;

[0128] If , execute steps S301 to S302:

[0129] S301, calculate the centroid:

[0130] , , ; wherein, is the centroid coordinate of the first frame contour point;

[0131] S302, polar angle sorting:

[0132] ; wherein, is the polar angle of the first contour point relative to the centroid; is the four-quadrant arctangent function, and is output;

[0133] Sort from small to large from new, get the closed sequence;

[0134] Ensure the contour point order is consecutive, and solve the chain tracking failure situation.

[0135] By organically combining neighborhood search and polar angle sorting, not only is accurate detection of pixels on the outer edge of the target region achieved, but the continuity of the sequence of all contour points and the complete closure of the contour chain are also guaranteed. Centroid calculation, as a geometric benchmark, effectively improves the accuracy of polar angle sorting of contour points, ensuring the spatial distribution logic and sequence consistency of boundary points. The introduction of polar angle sorting avoids the sequence disorder and closure failure problems that commonly occur in chain-tracking algorithms under high-complexity contours or contour breaks, improving the stability and standardization of contour structure representation. The resulting sequentially closed contour point chain provides high-quality basic data for subsequent parameterization, resampling, and shape feature calculation, ensuring the integrity and continuity of feature extraction. Through these steps, the system can better adapt to changes in different shape structures and edge complexity, improving the adaptability and fault tolerance of automatic recognition and processing.

[0136] The process of calculating the cumulative length of the contour using Euclidean distance, determining equidistant resampling points, and generating equidistantly distributed contour sampling points based on an interpolation algorithm specifically includes:

[0137] Take the circular index Calculate the first Frame number Euclidean distance between one contour point and the next contour point :

[0138] ; Calculate the distance between adjacent points on the contour chain to provide a basis for parameterization;

[0139] Calculate the first The cumulative arc length corresponding to each contour point , ;

[0140] Calculate the first Total perimeter of frame outline ;

[0141] Convert discrete points into continuous arc length parameters to quantize the profile length;

[0142] Assume the number of sampling points is the same as the number of origin points: , ;in, For the first The number of points after equidistant resampling of the frame contour; For the equidistant resampling The target arc length position; , to number the resampling points; determine each equidistant sampling position to ensure that the subsequent curvature calculation points are evenly distributed;

[0143] For each Find the index make ,calculate ; wherein, is the normalized ratio between the th sampling point and

[0144] Interpolated sampling point: ,

[0145] ; wherein, is the coordinate of the th equidistantly resampled point;

[0146] Equidistantly resample on the original contour, smooth and uniformly distribute the sampling points;

[0147] Obtain ; output the new contour point set for curvature estimation and spectral analysis.

[0148] By converting the original discrete contour points into cumulative arc length parameters, the global shape features of the contour can be effectively quantified, making the parameterization and alignment of complex curves simple and reliable. Equidistant resampling ensures that the distance between each sampling point is uniform, eliminating the feature deviation caused by uneven sampling density of the original contour points, and improving the feature consistency when comparing multiple frames and multiple targets. The introduction of the interpolation algorithm makes the newly generated contour points not only uniformly distributed, but also smooth, effectively reducing the numerical fluctuations of the discrete point set in subsequent curvature estimation. The new contour point set not only represents the geometric shape of the original contour, but also has good mathematical processability, providing a solid data foundation for subsequent curvature analysis and spectral transformation. Overall, this technical solution improves the accuracy and comparability of feature expression, avoids the distortion of parameter extraction caused by unreasonable contour point distribution, and provides a standard and stable feature input for subsequent shape recognition and comparison.

[0149] The curvature of the resampled contour points is estimated using a three-point difference algorithm, and numerical protection processing is performed on the possible zero denominator situation in the calculation process, specifically including:

[0150] Set the numerical protection threshold ; uniformly set the global zero threshold to ensure numerical stability;

[0151] Periodic boundary extension: ,

[0152] ;

[0153] Close the contour to ensure consistency in the start and end points of the difference calculation;

[0154] Define the difference quantity:

[0155] ​​, ;

[0156] , ;

[0157] ; wherein, is the first point left difference; is the first point right difference; and are the three-point second-order differences; is the difference modulus square sum;

[0158] if , then ; otherwise ; wherein, is the curvature of the th frame at the th sampling point;

[0159] The local curvature is estimated by a self-created three-point difference formula, and is used to prevent division by zero and ensure robustness.

[0160] By using the three-point difference method to estimate the local curvature of the equidistant sampling point set, the local structure change of the shape can be more accurately reflected, and the delicacy of the feature description is improved. The strategy of periodic boundary extension ensures that the curvature estimation of the entire contour is also continuous at the beginning and end, eliminating the error caused by the boundary effect. In order to avoid the problem of division by zero or extremely small denominator in the calculation process, a global numerical protection threshold is set to effectively avoid calculation instability and numerical overflow, so that the curvature estimation is always within a controllable range, ensuring the physical reasonableness of the data. Compared with the traditional second-order derivative or polynomial fitting method, this scheme not only has low computational complexity, but also has stronger adaptability to discrete data, improving the robustness of the system and the stability of the actual application. Through this step, the curvature features obtained finally not only have high-resolution shape expression ability, but also will not affect the overall system performance due to calculation problems, laying a solid foundation for subsequent spectral analysis and feature normalization.

[0161] The estimated curvature sequence is applied to the discrete Fourier transform to obtain the frequency spectrum information of the contour curvature, specifically including:

[0162] The imaginary unit is set; and the imaginary basis is provided for the Fourier transform;

[0163] The number of frame spectral components is calculated ; the number of independent frequency components is determined to avoid redundancy symmetry;

[0164] The number of Frame number Each complex component of the curvature spectrum :

[0165] ;in, Number the spectral components; convert the time-domain curvature sequence to the frequency domain and extract the shape details.

[0166] By transforming the curvature sequence from the time domain to the frequency domain, both global and local variation information of the shape structure can be obtained simultaneously, improving the richness and accuracy of feature extraction. Spectral analysis possesses inherent advantages such as resistance to rotation, translation, and noise, effectively expressing the complex periodicity and detailed features of contours, providing strong technical support for subsequent shape comparison between video frames. Compared to traditional methods using only spatial domain features or simple geometric parameters, frequency domain features not only have stronger expressive power but also better adapt to the diversity and dynamic changes of target shapes, effectively avoiding recognition confusion caused by single features. Through this processing step, the system can elevate the expression of shape features to the global level, enhancing the distinguishability and universality of applications, making it an indispensable key technology for high-precision video content retrieval and intelligent recognition.

[0167] The step of extracting amplitude information from the spectrum results and performing normalization processing to form a standardized spectrum amplitude feature vector specifically includes:

[0168] Calculate the first Frame number The amplitude of each spectral component ;

[0169] Construct the first Frame amplitude vector Extract the magnitude of the spectral energy, ignoring phase effects;

[0170] Calculate the first Sum of squared magnitudes of all spectral components in the frame ;

[0171] like The output spectrum energy is too low, and the termination occurs.

[0172] Otherwise, normalization yields: , ;in, For the first Frame number Normalized results of individual spectral amplitudes; For the first Frame normalized amplitude feature vector; eliminate scale differences and output comparable normalized spectral features.

[0173] By uniformly extracting and normalizing the spectral amplitude, the scale and energy differences between video frames caused by external factors such as shooting distance, target size, and illumination intensity are effectively eliminated, ensuring that all feature vectors can be effectively compared in the same metric space. The energy detection mechanism can automatically exclude feature frames with excessively low signal strength or invalid features, further improving the robustness and retrieval accuracy of the system. The normalized feature vectors have good cross-frame comparability and data consistency, simplifying the subsequent similarity calculation and automatic comparison process. Compared with some approaches that only extract local spectral features or do not perform normalization processing, this solution is more suitable for high-precision video content retrieval in large-scale, multi-source, and complex scenarios, strongly supporting the practical application of intelligent video analysis and automatic recognition systems.

[0174] The method involves calculating the shape similarity between different video frames based on the normalized spectral amplitude features, and performing retrieval and comparison according to a preset similarity criterion, outputting the video frame with the most similar shape features to the reference frame. Specifically, this includes:

[0175] The minimum spectral dimension shared by the reference frame and the candidate frame is set as follows:

[0176] ;in, Index the candidate frames; align the spectral dimensions of different frames to ensure the feasibility of distance calculation;

[0177] like The output spectrum dimension is insufficient, and the process terminates.

[0178] Calculate reference frame and candidate frames Curvature spectrum Euclidean distance metric :

[0179] ;in, For candidate frame number A normalized amplitude; quantize the difference in the shape spectrum between two frames for similarity judgment;

[0180] Most similar frame retrieval: ;in, To be consistent with the reference frame The frame number most similar to the curvature spectrum of the shape; automatically retrieve the frame whose curvature spectrum is closest to the reference frame.

[0181] By using normalized spectral amplitude features for similarity calculation between different video frames, the system can automatically quantify the differences between shape features, achieving true automatic content comparison. The dimensional alignment mechanism ensures the alignment and comparability of feature vectors from different frames, avoiding calculation anomalies caused by uneven or inconsistent features. The minimum distance matching rule accurately retrieves the closest target frame for each reference frame, improving retrieval efficiency and accuracy, and is applicable to various practical scenarios such as security monitoring, video archiving, and behavior analysis. Overall, this claim achieves intelligent retrieval and automatic matching of video content based on shape features, breaking through the technical bottleneck of traditional methods relying solely on manual annotation or simple color and texture comparison, and providing solid algorithmic support and engineering foundation for cutting-edge applications such as intelligent video processing and unsupervised recognition.

[0182] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0183] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for video recognition and analysis based on shape features, characterized in that, include: Each pixel in the video frame is mapped to a two-dimensional pixel coordinate system with the top left corner of the image as the origin, and the input grayscale image is subjected to mirror expansion boundary and median filtering. A binary image is constructed based on the pixel grayscale threshold, and all connected regions are extracted using four-neighbor connected component analysis. The target region is then selected as the region of interest. The neighborhood search algorithm is used to detect the target boundary pixels, and the contour points are closed-looped by polar angle sorting to form a continuous set of boundary points. The cumulative length of the contour is calculated using Euclidean distance, and equidistant resampling points are determined. Then, equidistant contour sampling points are generated based on an interpolation algorithm. The three-point difference algorithm is used to estimate the curvature of the resampled contour points, and numerical protection is performed to handle the zero denominator case that may occur during the calculation process. The estimated curvature sequence is subjected to a discrete Fourier transform to obtain the spectral information of the contour curvature. Amplitude information is extracted from the spectrum results and normalized to form a standardized spectrum amplitude feature vector; Based on the normalized spectral amplitude features, the shape similarity between different video frames is calculated, and the retrieval and comparison are realized according to the preset similarity criteria, outputting the video frame with the most similar shape features to the reference frame.

2. The method for video recognition and analysis based on shape features according to claim 1, characterized in that, The process of mapping each pixel in the video frame to a two-dimensional pixel coordinate system with the top-left corner of the image as the origin, and performing mirror expansion boundary and median filtering on the input grayscale image, specifically includes: Construct a two-dimensional pixel coordinate system Ω = {(x,y)|0≤x≤W,0≤y≤H}, with the origin at... Located at the top left corner of the image, the positive x-axis extends away from the origin along the image's width (connected to the origin), and the positive y-axis extends away from the origin along the image's height (connected to the origin), with units in pixels; where W is the image width and H is the image height. Obtain the grayscale value of the input grayscale image in frame t at pixel (x, y), denoted as I. (t) :Ω→[0,255]; where t is the video frame index; Set image extension boundaries: For the grayscale value of the t-th frame after mirror boundary expansion, coordinates that are out of range (x<0 or x>W or y<0 or y>H) are filled with the nearest boundary pixel value. For each point (x, y), calculate the result of performing a 3×3 median filter on pixel (x, y) in frame t. Where median is the midpoint of the set; u and v are the x and y coordinates of the neighboring pixels, respectively; Calculate the grayscale value of pixel (x,y) in frame t after median filtering and rounding:

3. The method for video recognition and analysis based on shape features according to claim 2, characterized in that, The process of constructing a binary image based on pixel grayscale thresholds and extracting all connected component regions using four-neighbor connected component analysis, and then selecting the target region as the region of interest, specifically includes: Calculate the maximum grayscale value of all pixels in frame t. Calculate the minimum grayscale value of all pixels in frame t. Set the global binary segmentation threshold for frame t to be... Constructing a binary graph: Among them, B (t) (x,y) is the binary value of pixel (x,y) in frame t; Using four-neighbor pairs {(x,y)|B (t) Perform connected component labeling on (x,y)} to obtain the set of connected components. in, Let j be the j-th connected component in frame t; Let J be the number of pixels in the j-th connected component; J is the number of connected components in the t-th frame of the binary graph. The four neighboring regions include (x±1,y) and (x,y±1); If J = 0, then terminate and output "No foreground"; Otherwise, take Where, j * For the index of the largest connected component; R (t) Let t be the target region in frame t, i.e., the connected region with the most pixels; If |R (t) If |<3, then terminate and output "Insufficient number of points in the region".

4. The method for video recognition and analysis based on shape features according to claim 3, characterized in that, The method of detecting target boundary pixels using a neighborhood search algorithm and achieving contour point closure tracking through polar angle sorting to form a continuous set of boundary points specifically includes: Set the boundary point set: ; Among them, (x i ,y i ) represents the coordinates of the i-th boundary pixel, where i is the outline point number; C (t) Let be the set of contour points for frame t; (d x ,d y ) to detect the current pixel (x) i ,y i The offset vector used to determine whether the four neighbors are the background, d x d is the horizontal offset. y This is the vertical offset; Calculate the number of contour points N in frame t. (t) =|C (t) |; If N (t) If the number of contour points is less than 3, the process will terminate and output "Insufficient contour points". From any point (x1, y1) ∈ C (t) Departure, in offset order: Select the next boundary point sequentially from (0,-1) to (1,0) to (0,1) to (-1,0) until returning to (x1,y1), and record the sequence. in, Let be the coordinates of the i-th point of the contour in frame t; like Then proceed with steps S301 to S302: S301. Calculate the centroid: Among them, G (t) Let be the centroid coordinates of the contour point in frame t; S302, Polar Angle Sort: Where, θ i θ is the polar angle of the i-th contour point relative to the centroid; atan2(y,x) is the arctangent function in the four quadrants, and the output θ∈(-π,π]; According to θ i From childhood to adulthood Reorder the sequences to obtain a closed sequence.

5. The method for video recognition and analysis based on shape features according to claim 4, characterized in that, The process of calculating the cumulative length of the contour using Euclidean distance, determining equidistant resampling points, and generating equidistantly distributed contour sampling points based on an interpolation algorithm specifically includes: Take the circular index Calculate the Euclidean distance between the i-th contour point in frame t and the next contour point. Calculate the cumulative arc length corresponding to the i-th contour point. Calculate the total perimeter of the outline in frame t. Assume the number of sampling points is the same as the number of origin points: M (t) =N (t) , Among them, M (t) s' is the number of points after isometric resampling of the contour in frame t; m The position of the m-th target arc length in the equidistant resampling; m = {0, 1, ..., M} (t) -1} represents the resampling point number; For each s' m Find index i to make calculate in, For the m-th sampling point and The normalized ratio between; Interpolation sampling points: Among them, (x' m ,y' m () represents the coordinates of the m-th equidistant resampling point; Get {(x' m ,y' m |m=0,1,...,M (t) -1}.

6. The method for video recognition and analysis based on shape features according to claim 5, characterized in that, The three-point difference algorithm is used to estimate the curvature of the resampled contour points, and numerical protection is performed to prevent zero denominator cases from occurring during the calculation process. Specifically, this includes: Let the numerical protection threshold ε = 10 -6 ; Perform periodic boundary extension: Define the difference component: Δ 2 x m =x' m+1 -2x' m +x' m-1 ,Δ 2 y m =y' m+1 -2y' m +y' m-1 ; in, The left and right differences are at point m; The upper and lower differences at point m; Δ 2 x m With Δ 2 y m It is a three-point second-order difference; D m It is the sum of squares of the difference moduli; If D m <ε, then otherwise in, Let be the curvature of the m-th sampling point in the t-th frame.

7. The method for video recognition and analysis based on shape features according to claim 6, characterized in that, The step of applying a discrete Fourier transform to the estimated curvature sequence to obtain the spectral information of the contour curvature specifically includes: Set the imaginary unit Calculate the number of spectral components in frame t. Calculate the complex component of the curvature spectrum of the k-th frame t. Where k = {0, 1, ..., K} (t) -1} is the spectral component number.

8. The method for video recognition and analysis based on shape features according to claim 7, characterized in that, The step of extracting amplitude information from the spectrum results and performing normalization processing to form a standardized spectrum amplitude feature vector specifically includes: Calculate the amplitude of the k-th spectral component in the t-th frame. Construct the amplitude vector of frame t Calculate the sum of squares of the amplitudes of all spectral components in frame t. like Termination and output of spectrum energy is too low; Otherwise, first calculate the normalized scale of the t-th frame. Then, after normalization, we get: in, h is the normalized result of the spectrum amplitude of the k-th frame in the t-th frame; (t) Let be the normalized amplitude eigenvector of the t-th frame.

9. The method for video recognition and analysis based on shape features according to claim 8, characterized in that, The method involves calculating the shape similarity between different video frames based on the normalized spectral amplitude features, and performing retrieval and comparison according to a preset similarity criterion, outputting the video frame with the most similar shape features to the reference frame. Specifically, this includes: The minimum spectral dimension shared by the reference frame and the candidate frame is set as follows: K min =min{K (t) ,K (u) }; where u is the candidate frame index; If K min If the value is less than 1, terminate and output the spectrum dimension if it is insufficient. Calculate the curvature spectrum Euclidean distance metric D for reference frame t and candidate frame u. curv (t,u): in, The normalized magnitude of the k-th candidate frame; Most similar frame retrieval: Among them, u * The frame number is the one most similar to the t-shaped curvature spectrum of the reference frame.

Citation Information

Patent Citations

  • A tuna recognition method based on adaptive fish body bending model

    CN109145808A

  • Robust, adaptive and efficient object detection, classification and tracking

    US20170068858A1