Unmanned aerial vehicle tracking method based on color recognition
By using the HSV color algorithm and the K++ algorithm, low-cost, accurate, and real-time target tracking for UAVs is achieved, solving the problem of high computational complexity in existing technologies and improving the efficiency and accuracy of UAV tracking.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2026-04-17
AI Technical Summary
Existing drone tracking methods rely on positioning systems and face/body shape recognition systems, resulting in excessive computing power for airborne embedded systems and making it difficult to achieve low-cost, accurate, real-time target tracking.
Using the HSV color algorithm and K++ algorithm, images are acquired through a camera, converted into grayscale images for edge detection, the average value of RGB color components is calculated, the center point of the Gaussian distribution is obtained, and a tracking trajectory is generated, which reduces computational complexity and improves tracking efficiency.
It can effectively determine the consistency of specified colors, generate accurate tracking trajectories, reduce the computational complexity of UAV target tracking systems, and improve real-time tracking capabilities.
Smart Images

Figure CN121884167A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of unmanned aerial vehicle (UAV) technology, and more specifically to a UAV tracking method based on color recognition. Background Technology
[0002] With the rapid development of drones, there are countless application examples of drone analytics in various fields, such as traffic engineering systems, drone bridge inspection platforms, drone-based traffic analysis, and oil pipeline patrol and factory inspection. In recent years, several target monitoring strategies for target discrimination and tracking have been proposed. Low-cost computational complexity, accurate target tracking, real-time operation speed, and embedded system implementation solutions have become essential issues.
[0003] Currently, there are many methods for tracking drones based on positioning systems, face and body shape recognition systems. However, using this method will inevitably increase the computing power of the drone's onboard embedded system. Summary of the Invention
[0004] This invention addresses the problems existing in drone tracking mentioned above by proposing a drone tracking method based on color recognition. Based on the HSV color algorithm, the RGB color image captured by the camera is converted into a grayscale image. Edge detection is performed on the grayscale image, and the number of pixels is calculated by averaging the three color components r_i, g_i, and b_i. Finally, the calculated value is assigned to (R, G, B). The center point of the Gaussian distribution of pixel blocks on the specified color image is obtained through the K++ algorithm, enabling the drone to generate a tracking trajectory based on the center point of the Gaussian distribution on the image.
[0005] The objective of this invention is achieved through the following technical solution: a drone tracking method based on color recognition, employing a built-in high-bitrate camera and a built-in data processing device, comprising the following steps:
[0006] S1: The user pre-sets the color of the body of the object to be tracked to a specified color;
[0007] S2: The drone uses a camera to continuously acquire images and segment them into different frames;
[0008] S3: Based on the HSV color algorithm, obtain the target object by matching the specified color from the image of each current frame;
[0009] S4: The drone's system converts the RGB pixel values of the target object on the image that matches the specified color into the HSV color space and divides it into many non-overlapping blocks;
[0010] S5: Specifically, the center points of the Gaussian distribution of pixel blocks in a specified color image are obtained using the K++ algorithm.
[0011] S6: Convert pixel blocks with Gaussian distribution points into PCGF to represent attributes. By comparing the PCGF of the previous frame and the current frame, the calculation is continuously repeated and the point is captured.
[0012] S7: The drone generates a tracking trajectory based on the center point of the Gaussian distribution on the image for tracking.
[0013] Preferably, obtaining the target object by matching the specified color specifically means:
[0014] S31: Convert the RGB color image captured by the camera into a grayscale image, and perform edge detection on the grayscale image;
[0015] S32: Based on the detected slope of the line, the line is classified into: horizontal line, vertical line, positive slope line and negative slope line;
[0016] S33: Compare the number of line segments in the sets of lines with positive slopes and negative slopes, take the median of the larger set, and convert the slope to an angle.
[0017]
[0018] S34: Determine the color monitoring area based on the angle, and fit the color monitoring area into a rectangular region;
[0019] S35: Define the height H1 and width W1 of the rectangular area to define the boundary of the color monitoring area;
[0020] S36: Create a region mask image to store the color monitoring region;
[0021] S37: Let I(R1, G2, B2) represent the colors in the RGB region of the monitoring area. Verification is performed using the following formula based on edge detection theory:
[0022]
[0023]
[0024]
[0025] N r N g Nb and Nb are the number of pixels used to perform the averaging operation on the three color components r_i, g_i, and b_i, respectively. Finally, the value of I(R1, G1, B1) is (R1, G1, B1).
[0026] S38: Obtain the setting value with the largest single value and determine whether it is consistent with the specified color.
[0027] Preferably, the RGB pixel image of the target object is converted to the HSV color space and divided into many non-overlapping blocks, specifically:
[0028] S41: Sets the X and Y coordinate feature parameters, identifies the object's height and sets it as height Hobj and width W. obj The characteristic parameters, according to the height H obj and width W obj Generate a lock box;
[0029] S42: The drone analyzes the feature values of the locked box and its surrounding pixels, and sets the locked box as the initial frame image;
[0030] S43: The drone places 12 pixels around the initial frame image, and the object window and zoom area are divided into non-overlapping 6×6 pixel blocks;
[0031] S44: Set a new window and set its height and width to (Hobj+24) and (Wobj+24) respectively;
[0032] S45: Matches the specified color Figure 3 All RGB colors are converted to HSV colors, and hue and saturation are processed.
[0033] Preferably, obtaining the Gaussian distribution center point of the pixel block on the specified color image specifically involves:
[0034] S51: Determine the distance from each pixel to the center point, and the D value of each pixel. n Used to determine a new set of center points, the higher center value D n It becomes the new central value KI;
[0035] S52: Calculate the center value of each group for the following lighting fixtures at least four times, and provide the initial conditions for the GMM algorithm.
[0036]
[0037]
[0038] S53: The GMM classifies each pixel of a color patch into a specific group using the following formulas:
[0039] ω k,t+1 =(1-α) ω )ω k,t +α ω
[0040] μ k,t+1 =(1-α) k,t )μ k,t +α k,t·px(i)
[0041]
[0042] Compared with the prior art, the present invention has the following beneficial effects: 1. Based on the HSV color algorithm, the RGB color image captured by the camera is converted into a grayscale image, edge detection is performed on the grayscale image, and the number of pixels is calculated by averaging the three color components r_i, g_i, and b_i. Finally, the calculated value is given to (R, G, B). After obtaining the set value with the largest single value, it can effectively determine whether it is consistent with the set specified color; 2. The center point of the Gaussian distribution of the pixel block on the specified color image is obtained by the K++ algorithm, and the UAV can generate a tracking trajectory according to the center point of the Gaussian distribution on the image for tracking. Attached Figure Description
[0043] Figure 1 This is a preliminary schematic diagram of the present invention;
[0044] Figure 2 This is a preliminary schematic diagram of the present invention;
[0045] Figure 3 This is a schematic diagram showing the expanded effective monitoring range of the drone camera of the present invention;
[0046] Figure 4 This is a schematic diagram illustrating the usage state of the present invention. Detailed Implementation
[0047] The present invention will be further described below with reference to the embodiments illustrated in the accompanying drawings:
[0048] like Figures 1 to 4 As shown, a drone tracking method based on color recognition, as a preferred embodiment, mainly adopts a general method in drones. The image features of each frame are obtained by capturing them through a camera. These features are further used to obtain the position of the object. Specifically, it mainly uses the PCGF algorithm, which is an effective general method. The PCGF algorithm can minimize the computational complexity and improve the efficiency of the drone target tracking control system. The PCGF is composed of color models derived from hue, saturation, and brightness.
[0049] S1: The user pre-sets the color of the body of the object to be tracked to a specified color.
[0050] S2: The drone uses a camera to continuously acquire images and segment them into different frames.
[0051] S3: Based on the HSV color algorithm, obtain the target object by matching the specified color from the image of each current frame. Specifically:
[0052] S31: Convert the RGB color image captured by the camera into a grayscale image, and perform edge detection on the grayscale image;
[0053] S32: Based on the detected slope of the line, the line is classified into: horizontal line, vertical line, positive slope line and negative slope line;
[0054] In step S32, horizontal and vertical lines correspond to straight lines with a slope of 0 and infinity, while alternating positive and negative slope lines refer to straight lines with a slope greater than 0 and a slope less than 0, respectively.
[0055] S33: Compare the number of line segments in the sets of lines with positive slopes and negative slopes, take the median of the larger set, and convert the slope to an angle.
[0056]
[0057] S34: Determine the color monitoring area based on the angle, and fit the color monitoring area into a rectangular region;
[0058] S35: Define the height H1 and width W1 of the rectangular area to define the boundary of the color monitoring area;
[0059] S36: Create a region mask image to store the color monitoring region:
[0060] S37: Let I(R1, G2, B2) represent the colors in the RGB region of the monitoring area. Verification is performed using the following formula based on edge detection theory:
[0061]
[0062]
[0063]
[0064] Nr, Ng, and Nb are used to calculate the number of pixels for averaging the three color components r_i, g_i, and b_i, respectively. Finally, the value of I(R1, G1, B1) is (R1, G1, B1).
[0065] S38: Obtain the setting value with the largest single value and determine whether it is consistent with the specified color.
[0066] S4: The drone's system converts the RGB pixel image of the target object on an image that matches a specified color to the HSV color space and divides it into many non-overlapping blocks, specifically:
[0067] S41: As Figures 3 to 4 The image shown is captured by the camera and has a specified color. The top left corner of the image has X and Y coordinate features, and the height of the object is identified and set as height H.obj and width W obj The characteristic parameters, according to the height H obj and width W obj Generate a lock box;
[0068] In step S41: Figure 3 The purpose of the X and Y coordinates in the code is to locate the current coordinates of the continuously moving target and transmit them to external devices. Figure 3 The purpose of expanding the capture area by 72 pixels outwards is to prevent the target object from escaping while it is moving.
[0069] S42: The drone analyzes the feature values of the locked box and its surrounding pixels, and sets the locked box as the initial frame image;
[0070] S43: As Figure 4 As shown, the drone places 12 pixels around the initial frame image, and the object window and zoom area are divided into non-overlapping 6×6 pixel blocks.
[0071] S44: Set a new window and set its height and width to (Hobj+24) and (Wobj+24) respectively;
[0072] The setting of expanding the new window outward in step S44 can optimize the complexity and computational cost of object tracking;
[0073] S45: Matches the specified color Figure 3 All RGB colors are converted to HSV colors, and hue and saturation are processed.
[0074] S5: Combination Figure 3 and Figure 4 The K++ algorithm is used to obtain the Gaussian distribution center points of pixel blocks in a specified color image.
[0075] S51: Determine the distance from each pixel to the center point, and the D value of each pixel. n Used to determine a new set of center points, the higher center value D n It becomes the new central value KI;
[0076] S52: Calculate the center value of each group for the following lighting fixtures at least four times, and provide the initial conditions for the GMM algorithm.
[0077]
[0078]
[0079] Where x represents the input vector data, K represents the total number of features in a single Gaussian model (four feature values used to represent a single block), k is the group index value of a single Gaussian model, and W...k Let φ(x|θ) represent the input whose probability belongs to the k-th single Gaussian model, and let φ(x|θ) be the input. k ) represents the Gaussian distribution probability density of the k-th Gaussian model;
[0080] S53: The GMM classifies each pixel of a color patch into a specific group using the following formulas:
[0081] ω k,t+1 =(1-α) ω )ω k,t +α ω
[0082] μ k,t+1 =(1-α) k,t )μ k,t +α k,t ·px(i)
[0083]
[0084] Where, α k,t =α ω / ω k,t ω k,t Let μk,t represent the probability value of the k-th single Gaussian model in frame t, μk,t represent the mean model of the single Gaussian model, σ2k,t represent its standard deviation, and αw represent the learning rate.
[0085] In step S53, the principle is to transform the HSV histogram and then select an index of a non-zero value to represent the initial cluster center point K0 and a. After the original cluster center point K0, the second, third and fourth cluster points K1, K2 and K3 are found. K1 is the result of calculating the distance from the non-zero index to the center point K0.
[0086] S6: Convert pixel blocks with Gaussian distribution points into PCGF to represent attributes. By comparing the PCGF of the previous frame and the current frame, the calculation is continuously repeated and the point is captured.
[0087] In step S6, the object's movement speed cannot exceed the drone camera's shooting speed, so the pixel differences between one frame and another are almost similar, allowing the position of the specified object to be continuously determined.
[0088] S7: The drone generates a tracking trajectory based on the center point of the Gaussian distribution on the image for tracking.
[0089] The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to substitute them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.
Claims
1. A drone tracking method based on color recognition, characterized in that, The method employs a built-in high-bitrate camera and a device with built-in data processing capabilities, including the following steps: S1: The user pre-sets the color of the body of the object to be tracked to a specified color; S2: The drone uses a camera to continuously acquire images and segment them into different frames; S3: Based on the HSV color algorithm, obtain the target object by matching the specified color from the image of each current frame; S4: The drone's system converts the RGB pixel values of the target object on the image that matches the specified color into the HSV color space and divides it into many non-overlapping blocks; S5: Specifically, the center points of the Gaussian distribution of pixel blocks in a specified color image are obtained using the K++ algorithm. S6: Convert pixel blocks with Gaussian distribution points into PCGF to represent attributes. By comparing the PCGF of the previous frame and the current frame, the calculation is repeated and the point is captured. S7: The drone generates a tracking trajectory based on the center point of the Gaussian distribution on the image for tracking.
2. The UAV tracking method based on color recognition according to claim 1, characterized in that, The specific steps for obtaining a target object that matches a specified color are as follows: S31: Convert the RGB color image captured by the camera into a grayscale image, and perform edge detection on the grayscale image; S32: Based on the detected slope of the line, the line is classified into: horizontal line, vertical line, positive slope line and negative slope line; S33: Compare the number of line segments in the sets of lines with positive slopes and negative slopes, take the median of the larger set, and convert the slope to an angle. S34: Determine the color monitoring area based on the angle, and fit the color monitoring area into a rectangular region; S35: Define the height H1 and width W1 of the rectangular area to define the boundary of the color monitoring area; S36: Create a region mask image to store the color monitoring region; S37: Let I(R1, G2, B2) represent the colors in the RGB region of the monitoring area. Verification is performed using the following formula based on edge detection theory: where N r , N g and Nb are the number of pixels used for averaging the r_i, g_i, b_i color components, respectively, and the value of I(R1, G1, B1) is (R1, G1, B1). S38: Obtain the setting value with the largest single value and determine whether it is consistent with the specified color.
3. The UAV tracking method based on color recognition according to claim 1, characterized in that, The RGB pixel image of the target object is converted to the HSV color space and divided into many non-overlapping blocks, specifically: S41: Set the coordinate characteristic parameters of X, Y, and identify the height of the object and set it as the height H obj and the width W obj of the characteristic parameters, generate a lock frame according to the height H obj and the width W obj ; S42: The drone analyzes the feature values of the locked box and its surrounding pixels, and sets the locked box as the initial frame image; S43: The drone places 12 pixels around the initial frame image, and the object window and zoom area are divided into non-overlapping 6×6 pixel blocks; S44: Set a new window and set its height and width to (Hobj+24) and (Wobj+24) respectively; S45: Convert all RGB colors on Figure 3 that match the specified colors to HSV colors, and process hue and saturation.
4. The UAV tracking method based on color recognition according to claim 1, characterized in that, The specific steps for obtaining the Gaussian distribution center point of pixel blocks on a specified color image are as follows: S51: determine the distance of each pixel point to the center point, D of each pixel n For determining a new set of center points, higher center value D n Become new center value KI; S52: Calculate the center value of each group for the following lighting fixtures at least four times, and provide the initial conditions for the GMM algorithm. S53: The GMM classifies each pixel of a color patch into a specific group using the following formulas: w k,t+1 = (1 - a w )w k,t + a w m k,t+1 =(1-a k,t )m k,t +a k,t ·px(i)