A fish body target tracking method and device based on contour matching

By using a contour matching-based method and employing background subtraction and template matching techniques, the tracking difficulties caused by fish occlusion were resolved, enabling accurate acquisition of fish movement information and supporting water quality monitoring.

CN116128920BActive Publication Date: 2025-11-18ZHEJIANG UNIV OF TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211489742.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-25
Publication Date
2025-11-18
Estimated Expiration
2042-11-25

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively address the issue of fish body occlusion during fish tracking, leading to target loss and frequent ID switching, which affects the accuracy of water quality monitoring.

Method used

A contour matching-based method is adopted to extract the fish body contour through background subtraction and color features. Combined with occlusion detector and template matching technology, the position and orientation of the occluded target are determined, and the Kalman filter is used for target tracking.

Benefits of technology

It enables accurate tracking even when fish are obscured, improves the accuracy of fish movement information acquisition, and provides important data support for water quality monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116128920B_ABST
    Figure CN116128920B_ABST
Patent Text Reader

Abstract

The application discloses a fish body target tracking method and device based on contour matching, and comprises the following steps: 1, sampling video image frames, establishing a background model under the current environment, and extracting a target contour by using background difference and target color feature; 2, inputting all detected target images into an occlusion detector, if the output is one, it indicates that the current target is in an independent state, if the output is two or more, it indicates that the current target is in an occlusion state; the fish body target in the independent state enters step 3 processing, and the fish body target in the occlusion state enters step 4 processing; 3, acquiring the posture direction of the independent target contour; 4, for the fish body target image judged as the occlusion state by the occlusion detector, a template matching method is used to determine the position and direction of the tracking target in the occlusion image; 5, matching the detected target and the tracking target by using the position and direction similarity; and accurate tracking of the occlusion target is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of biological water quality monitoring, deep learning, target tracking, and image processing, and specifically to a method and device for fish target tracking based on contour matching. Background Technology

[0002] Real-time water quality monitoring plays a crucial role in addressing water pollution, and low-cost biological water quality early warning technologies have gradually developed in recent years. Fish-based biological water quality early warning technologies primarily monitor the state of fish in continuously changing aquatic environments to indirectly characterize water pollution levels. Fish movement patterns reflect their activity levels; therefore, tracking fish is a vital step in achieving biological water quality early warning.

[0003] The main challenge in fish tracking lies in the agile and unpredictable movement of fish, and the tendency for multiple fish to occlude each other for extended periods, leading to target loss and frequent ID switching. Current methods to address target occlusion during tracking include patent publication CN112862853A ("A Multi-Target Trajectory Tracking and Fusion Method and System Based on Trajectory Prediction"), which only predicts the forward and reverse directions of occluded trajectories. Due to the complexity of fish movements and the prolonged occlusion, accurate trajectory prediction is difficult. Another method, patent publication CN111968159A ("A Simple and Universal Fish School Video Image Trajectory Tracking Method"), uses image erosion to divide overlapping fish contours into two parts. This method is effective for minor occlusion, but it fails to effectively segment targets when fish contours intersect.

[0004] To address this issue, this application proposes a template-matching-based method for tracking fish occlusion trajectories. This method determines the orientation of the occluded fish target from the occlusion contour, and then associates the target with the occluded information to achieve accurate tracking. This method solves the occlusion problem during fish tracking and plays a crucial role in obtaining subsequent fish movement information for water quality monitoring. Summary of the Invention

[0005] The purpose of this invention is to propose a method and apparatus capable of addressing the frequent occlusion of fish targets in biological water quality early warning scenarios. This invention samples input video signals of fish movement, obtains the fish target contour using background subtraction and fish body features, initializes tracking information for all targets before tracking, and uses an occlusion detector to determine whether a target is occluded during tracking. For independent targets, the fish target's movement direction is obtained by modeling the fish body contour, and then positional similarity is used to match the corresponding tracking target. For occluded targets, the fish's position information is extracted from the occluded contour using template matching, and then the corresponding tracking trajectory is associated with the target using positional similarity.

[0006] To achieve the above-mentioned objectives, this invention proposes a fish target tracking method based on contour matching, comprising the following steps:

[0007] Step 1: Sample video image frames, establish a background model for the current environment, and extract the target contour using background subtraction and target color features. The specific process is as follows:

[0008] Step 1.1: Acquire several frames of video images and establish a background model using statistical methods.

[0009] Step 1.2: Perform difference processing on the current frame image and the background model, and then binarize them to obtain the binarized image of the target background after difference.

[0010] Step 1.3: Convert the current frame image to the HSV color gamut, and set color filtering intervals according to the color characteristics of the target fish. After color filtering, the pixels within and outside the intervals of the current frame image will be binarized to obtain a binary image with filtered color features.

[0011] Step 1.4: Perform a bitwise AND operation on the binary image after background subtraction and the binary image after color feature filtering to obtain the target binary image. Then, perform an opening operation on this binary image to remove noise and obtain all target contours. Use the target contour boxes as detection boxes.

[0012] Step 2: Input all detected target images into the occlusion detector, which is a convolutional network. Its function is to output the number of fish bodies in the target image. If the output is one, it means that the current target is in an independent state; if the output is two or more, it means that the current target is in an occluded state. Fish bodies in an independent state proceed to Step 3 for processing, while fish bodies in an occluded state proceed to Step 4 for processing.

[0013] Step 3: Obtain the pose orientation of the independent target contour. The specific steps are as follows:

[0014] Step 3.1: Traverse the occlusion network identified as independent targets in Step 2 and find the largest inscribed circle of the fish's outline. The center of the largest inscribed circle is denoted as (x...). cir y cir The radius of the largest inscribed circle is denoted as r.

[0015] Step 3.2: Determine the head point of the fish's outline. Draw a straight line l through any tangent point coordinates and the center of the inscribed circle. Experimental observations show that during the fish's movement, the head and tail points are always on opposite sides of line l. Therefore, divide the points in the outline set into sets C1 and C2 based on their location on different sides of line l. The maximum distance from the points in the two sets to the center of the inscribed circle is determined by the distance from the head point (x...). head y head ) and tail point (x) tail y tail The point that is shorter than the center of the inscribed circle is defined as the head point.

[0016] Step 3.3: Determine the fish's body orientation. Draw a straight line through the center of the inscribed circle and the head point. Define the angle α between the direction from the center of the inscribed circle to the head point and the positive x-axis, rotated counterclockwise. The formula for calculation is:

[0017]

[0018] Step 4: For fish target images identified as occluded by the occlusion detector, template matching is used to determine the position and orientation of the tracking target in the occluded image. The specific steps are as follows:

[0019] Step 4.1: Determine the set of tracking targets to be matched that are involved in occlusion. For each tracking target involved in occlusion, generate a corresponding matching template set. The matching template is the fish body contour represented by a binary image. For the i-th tracking target T′ involved in occlusion... i The template has dimensions of m×m, and its outline area is equal to the area of ​​the outline recorded in the target tracking information. Its initial direction is the attitude direction recorded in the target tracking information. If the currently tracked target T′ i The direction of movement is α′ i Set the minimum deflection angle to β0 for each rotation, and perform n rotations in both clockwise and counterclockwise directions. After each rotation, add the resulting template to the template set corresponding to the target. The rotation angle for each template in the resulting template set can be represented by the set {α′}. i -nβ0,…,α′ i -β0, α′ i , α′ i +β0,…,α′ i Let's represent it as +nβ0}. This yields 2i+1 matching templates.

[0020] Step 4.2: Obtain the binary image of the occluded target contour. The size of this image is denoted as w×h, ensuring w > m and h > m. For the i-th tracked target T′ involved in occlusion in Step 4.1... i The resulting 2i+1 matching templates are used to perform sliding matching on the occluded contours sequentially using a sliding window. Each matching process is a convolution operation, and each template generates a corresponding feature map, ultimately generating a total of 2i+1 feature maps.

[0021] Step 4.3: Determine the position and orientation of the occluded target within the occlusion contour. For the i-th tracked target T′ involved in occlusion... i The algorithm iterates through all values ​​on all generated feature maps and finds the maximum value. The position of the maximum value in the corresponding matching template is taken as the target's location, and the bounding box position of the matching template at the maximum value is taken as the target's detection box position. The rotation angle corresponding to the matching template at the maximum value is the target's detection direction.

[0022] Step 5: Match the detected target and the tracked target using positional and orientation similarity. The specific steps are as follows:

[0023] Step 5.1: Track the i-th target T i The data in the middle records the target information of the previous frame, and its position information is denoted as... Let x and y represent the x and y coordinates of the center point of the detection frame, and the length and width of the detection frame, respectively, with the direction denoted as y. The input is given to a Kalman filter for prediction, and the output position prediction result is: This indicates the aspect ratio of the detection box, and the orientation prediction result is...

[0024] Step 5.2: Calculate the cost matrix of the orientation information between the tracked target and the detected target. For the i-th tracked target T i and the j-th detection target D j The cost between two targets consists of positional distance and directional distance, where the positional distance d1 is 1 minus the tracking target T. i Predicted bounding box and detected target D j The corresponding IOU values ​​between detection boxes, with directional distance d2 being the tracking target T. i Predicted direction and detection target D j Detection direction The cosine distance between them. The i-th tracked target T. i and the j-th detection target D j The cost formula between them, c ij It can be represented as:

[0025] c ij=λd1+(1-λ)d2

[0026] Where λ is the weighting parameter.

[0027] Step 5.3: Using the cost matrix between the tracked target and the detected target obtained in Step 5.2, a relevant matching algorithm (KM algorithm, Hungarian matching algorithm, etc.) is used to match all detected targets in the current frame.

[0028] Step 6: Update the tracking information for all targets, including target outline area, target bounding box position, target orientation, target status (occluded or isolated), etc.

[0029] This invention provides a fish target tracking device based on contour matching, comprising: a chassis, an industrial computer, a display screen, a camera, a fish tank, an LED light source, and a fish target of suitable size. To minimize the impact of ambient light changes, the fish tank is placed in a dark room, and the camera and light source are fixed above the fish tank. Water is continuously flowing in from the inlet and out from the outlet to achieve a real-time changing water quality environment. The camera captures video sequences, and the tracking algorithm runs on the industrial computer. The output results are displayed on the monitor.

[0030] The beneficial effects of this invention are: by using the posture and position information of the fish as parameters for trajectory matching, and then using template matching to determine the target position and fish orientation in the occluded contour, this invention solves the problem that current detection-based multi-target tracking algorithms have difficulty tracking under occlusion conditions. This tracking algorithm achieves good tracking results. Attached Figure Description

[0031] Figure 1 This is a flowchart of the method of the present invention;

[0032] Figure 2 This is a schematic diagram of fish body contour feature extraction using the method of the present invention;

[0033] Figure 3 This is a diagram of the occlusion discrimination network structure of the method of the present invention;

[0034] Figure 4 This is a schematic diagram of the fish body posture orientation modeling in this invention;

[0035] Figure 5 This is a schematic diagram of the template matching method of the present invention;

[0036] Figure 6 This is a schematic diagram of the matching results of the present invention;

[0037] Figure 7 This is a diagram of the apparatus of the present invention;

[0038] In the picture: 1. Display screen; 2. Industrial computer; 3. Chassis; 4. LED light source; 5. Camera; 6. Fish tank; 7. Water inlet; 8. Water outlet. Detailed Implementation

[0039] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0040] In this embodiment, three medium-sized red crucian carp were selected as water quality indicators for monitoring. Crucian carp, as a common water quality indicator, has been widely used in environmental monitoring.

[0041] A fish target tracking method based on contour matching includes the following steps:

[0042] Step 1: Sample video image frames, establish a background model for the current environment, and extract the target contour using background subtraction and target color features. (See attached image.) Figure 2 As shown, it specifically includes:

[0043] Step 1.1: Establish a background model using statistical methods. For the n captured images, I k Let the image be the k-th frame. Calculate its corresponding mean image. The value of the pixel at (i, j) in the mean image is:

[0044]

[0045] Calculate the standard deviation of pixels at each pixel location in n frames of an image:

[0046]

[0047] Iterate through all pixels of the n-th frame image. If the pixel at position (i, j) in the k-th frame image satisfies |I k If (i,j)-M(i,j)|<V(i,j), then add that pixel to the background model library. The average of all pixel values ​​corresponding to each pixel position in the background model library is used as the final pixel value of the background model, thus obtaining the final background model.

[0048] Step 1.2: Perform difference processing on the current frame image and the background image generated in Step 1, and then binarize them to obtain the binarized image of the target background after difference processing, as shown in the attached figure. Figure 2 As shown by label S21 in the figure.

[0049] Step 1.3: Convert the current frame image to the HSV color gamut. Based on the color characteristics of the target fish, set the H (hue), S (saturation), and V (brightness) color ranges. In this embodiment, based on the color characteristics of the red crucian carp, the H value range is set to (0, 20), the S value range to (72, 255), and the V value range to (0, 255). After color filtering, the current frame image will be binarized, with pixels within and outside the color ranges combined to obtain a binary image after color feature filtering, as shown in the attached figure. Figure 2 As shown in S22.

[0050] Step 1.4: Perform a bitwise AND operation between the background-subtracted binary image and the color-feature-filtered binary image to obtain the target binary image, as shown in the attached figure. Figure 2 As shown in S23, the binary image of the target is opened to remove noise and obtain all target contours. The smallest bounding rectangle of the target contour is used as the detection box.

[0051] Step 2: Input all detected target images into the occlusion detector. The occlusion detector is a convolutional class network. In this embodiment, the VGG16 network is selected, and its structure is shown in the attached figure. Figure 3 As shown in the diagram, this network function outputs the number of fish bodies in the target image. If the output is one fish body, it indicates that the current target is in an independent state; if the output is two or more fish bodies, it indicates that the current target is in an occluded state. Independent fish bodies proceed to step 3, while occluded fish bodies proceed to step 4.

[0052] Step 3: Obtain the pose orientation of the independent target contour, as shown in the attached figure. Figure 4 As shown, the specific steps are as follows:

[0053] Step 3.1: Traverse all targets identified as independent by the classification network in Step 2, and find the largest inscribed circle of all fish body contours in the current frame. For each contour, it can be represented as a point set C = {(x1, y1), (x2, y2), (x3, y3), ..., (x...} n, y n )}. Iterate through the points in the current contour point set, obtaining the minimum and maximum values ​​of the coordinates along the x-axis and y-axis, respectively, which are x min x max y min y max Traverse the set of candidate points for the largest inscribed circle, where the x-coordinate and y-coordinate ranges are respectively (x, y) min x max ), (y min y maxThe `pointPolygonTest` function from the OpenCV library is used to calculate the shortest distance from all candidate points to the contour. This function determines whether a point's coordinates lie within a contour; if the point is within the contour, it returns the shortest distance from that point to the contour; otherwise, it returns a negative number. The coordinates of the candidate point corresponding to the maximum distance among all distances are then taken, along with the coordinates of the contour point. The contour point coordinates are the coordinates of the tangent point of the maximum inscribed circle, and the candidate point coordinates corresponding to this maximum distance are the center (x, y) of the maximum inscribed circle of the contour. cir y cir The maximum distance corresponds to the radius r of the largest inscribed circle.

[0054] Step 3.2: Determine the head point of the fish's outline. Draw a straight line l through the coordinates of the tangent point and the center of the inscribed circle. Experimental observations show that during the fish's movement, the head and tail points are always on opposite sides of line l. Therefore, divide the points in the outline set into sets C1 and C2 based on their location on different sides of line l. The maximum distance from the points in the two sets to the center of the inscribed circle is determined by the distance from the head point (x...). head y head ) and tail point (x) tail y tail The point that is shorter than the center of the inscribed circle is defined as the head point.

[0055] Step 3.3: Determine the direction of the fish's movement. Draw a straight line through the center of the inscribed circle and the head point, and denote it as the direction line of the fish's movement. dir The angle between the direction from the center of the inscribed circle to the head point and the positive x-axis, rotated counterclockwise, is defined as the fish body direction α, which ranges from [0, 2π]. The calculation formula is:

[0056]

[0057] Step 4: For fish target images identified as occluded by the occlusion detector, template matching is used to determine the position and orientation of the tracking target in the occluded image, as shown in the attached diagram. Figure 5 As shown. The specific steps are as follows:

[0058] Step 4.1: Determine the set of tracking targets to be matched that are involved in occlusion. For each tracking target involved in occlusion, generate a corresponding matching template set. The matching template is the fish body contour represented by a binary image. For the i-th tracking target T′ involved in occlusion... i The template has dimensions of m×m, and its outline area is equal to the area of ​​the outline recorded in the target tracking information. Its initial direction is the attitude direction recorded in the target tracking information. If the currently tracked target T′ i The direction of movement is α′ iSet the minimum deflection angle to β0 for each rotation, and perform n rotations in both clockwise and counterclockwise directions. After each rotation, add the resulting template to the template set corresponding to the target. The rotation angle for each template in the resulting template set can be represented by the set {α′}. i -nβ0,…,α′ i -β0, α′ i , α′ i +β0,…,α′ i The expression is represented as +nβ0}. Finally, we can obtain 2i+1 matching templates, as shown in the appendix. Figure 5 As shown in S51.

[0059] Step 4.2: Obtain the binary image of the occluded target contour. The size of this image is denoted as w×h, ensuring w > m and h > m. For the i-th tracked target T′ involved in occlusion in Step 4.1... i The resulting 2i+1 matching templates are then used to perform sliding matching on the occluded contours sequentially using a sliding window approach. Each matching process involves a convolution operation, generating a corresponding feature map for each template, ultimately producing a total of 2i+1 feature maps, as shown in the attached figure. Figure 5 As shown in S52.

[0060] Step 4.3: Determine the position and orientation of the occluded target within the occlusion contour. For the i-th tracked target T′ involved in occlusion... i It iterates through all values ​​on all generated feature maps and finds the maximum value. The position of the maximum value in the corresponding matching template is taken as the target location, and the bounding box position of the matching template at the maximum value is taken as the detection box position of the current target, as shown in the attached figure. Figure 5 As shown in S53, the rotation angle corresponding to the matching template where the maximum value is located is the detection direction of the current target.

[0061] Step 5: Match the detected target and the tracked target using positional and orientation similarity. The specific steps are as follows:

[0062] Step 5.1: Track the i-th target T i The data in the middle records the target information of the previous frame, and its position information is denoted as... Let x and y represent the x and y coordinates of the center point of the detection frame, and the length and width of the detection frame, respectively, with the direction denoted as y. It is then input into a Kalman filter for prediction.

[0063] Kalman filtering consists of two processes: prediction and update. The state prediction formula and covariance prediction formula of Kalman filter are shown below:

[0064] x′=Fx+Bu

[0065] P′=FPFT +Q

[0066] In the formula, the state variable x is the position information of the detection box at time t, which can be represented as [c x c y w, a, α, v x v y v w v a v α ], which represent the center coordinates of the detection box, the width of the detection box, the aspect ratio of the detection box, the orientation of the target, and their respective rates of change. F is the state transition matrix; B is the control matrix, u is the control vector; P is the covariance matrix of x at time t; Q represents the noise matrix of the covariance matrix.

[0067] The formulas for updating the gain matrix, observations, and error covariance in a Kalman filter are as follows:

[0068] K = P'H T (HP′H T +R) -1

[0069] x = x′ + K(z - Hx′)

[0070] P=(1-KH)P′

[0071] Where H represents the mapping matrix, which maps x and P in the state space to the measurement space; R represents the covariance matrix of the observation noise; z represents the actual measurement value; and K is the Kalman gain.

[0072] The output location prediction result is The direction prediction result is

[0073] Step 5.2: Calculate the cost matrix of the orientation information between the tracked target and the detected target. For the i-th tracked target T i and the j-th detection target D j The cost between two targets consists of positional distance and directional distance, where the positional distance d1 is 1 minus the tracking target T. i Predicted bounding box and detected target D j The corresponding IOU values ​​between detection boxes, with directional distance d2 being the tracking target T. i Predicted direction and detection target D j Detection direction The cosine distance between them. The i-th tracked target T. i and the j-th detection target D j The cost formula between them, c ij It can be represented as:

[0074]

[0075] d1 = 1 - IOU ij

[0076]

[0077] c ij =λd1+(1-λ)d2

[0078] in, Let i be the predicted direction for the i-th target. For the detection direction of the j-th target, IOU ij λ is the cross-union ratio between the predicted bounding box and the detected bounding box, and λ is the weighting parameter.

[0079] Step 5.3: Calculate the cost matrix using the cost formula between the tracked target and the detected target obtained in Step 5.2, and use a relevant matching algorithm (KM algorithm, Hungarian matching algorithm, etc.) to complete the matching of all detected targets in the current frame. In this embodiment, the Hungarian matching algorithm is selected to match the detected targets. The steps of the Hungarian algorithm are shown in Table 1.

[0080] After calculating the distance between the detected and tracked targets, a matching algorithm is used to match all detected and tracked targets. Common matching algorithms include the KM algorithm and the Hungarian algorithm. This embodiment uses the Hungarian algorithm, with the distance between the tracked target and the detected contour as the matching matrix C. i,j To match targets in the current frame, the Hungarian algorithm takes a cost matrix as input and outputs the optimal target allocation scheme. The execution flow of the Hungarian algorithm is shown in Table 1.

[0081] Table 1. Steps of the Hungarian Algorithm

[0082]

[0083]

[0084] Step 6: Update the tracking information for all targets, including target outline area, target bounding box position, target orientation, target status (occluded or isolated), etc.

[0085] Appendix Figure 6 The process and results of target tracking using this method under two occlusion scenarios are demonstrated. The method has good tracking performance when a small number of fish targets are occluded.

[0086] The present invention describes a fish target tracking device based on contour matching, as shown in the attached figure. Figure 7As shown, the device includes: a display screen 1, an industrial computer 2, a chassis 3, an LED light source 4, a camera 5, a fish tank 6, a water inlet 7, and a water outlet 8. To minimize the impact of ambient light changes, the fish tank is placed in a dark room, and the camera and light source are fixed above the fish tank. The water to be monitored continuously flows in from the inlet and out from the outlet, realizing a real-time changing water quality environment. The camera captures video sequences, and a tracking algorithm runs on the industrial computer. The output results are displayed on the monitor.

Claims

1. A fish target tracking method based on contour matching, characterized in that, Includes the following steps: Step 1: Sample video image frames, establish a background model for the current environment, and extract the target contour using background subtraction and target color features; Step 2: Input all detected target images into the occlusion detector. The occlusion detector is a convolutional network whose function is to output the number of fish bodies in the target image. If the output is one, it means that the current target is in an independent state. If the output is two or more, it means that the current target is in an occluded state. Fish bodies in an independent state are processed in Step 3, and fish bodies in an occluded state are processed in Step 4. Step 3: Obtain the pose orientation of the independent target contour; Step 4: For fish target images identified as occluded by the occlusion detector, use template matching to determine the position and orientation of the tracking target in the occluded image; The specific steps of step 4 are as follows: Step 4.1: Determine the set of tracking targets to be matched that are involved in occlusion. For each tracking target involved in occlusion, generate a corresponding matching template set. The matching template is the fish body contour represented by a binary image. For the i-th tracking target T' involved in occlusion... i The template has a size of m×m, and its outline area is equal to the area of ​​the outline recorded in the target tracking information. Its initial direction is the fish body posture direction recorded in the target tracking information. If the current tracking target T' i The direction of movement is α' i Set the minimum deflection angle to β0 for each rotation, and rotate the template n times in both clockwise and counterclockwise directions. After each rotation, add the resulting template to the template set corresponding to the target. The rotation angle corresponding to each template in the resulting template set is represented by the set {α'}. i -nβ0,···,α' i -β0,α' i ,α' i +β0,···,α' i Using +nβ0} to represent, we get 2i+1 matching templates; Step 4.2: Obtain the binary image of the occluded target contour, denoted as w×h, ensuring w>m and h>m; for the i-th tracked target T' involved in occlusion in Step 4.1 i The resulting 2i+1 matching templates are used to perform sliding matching on the occluded contours in a sliding window manner. Each matching process is a convolution operation, and each template generates a corresponding feature map. Finally, a total of 2i+1 feature maps are generated. Step 4.3: Determine the position and orientation of the occluded target in the occlusion contour: For the i-th tracked target T' involved in occlusion i It iterates through all values ​​on all feature maps it generates and finds the maximum value; the position of the maximum value in the corresponding matching template is taken as the target position, and the bounding box position of the matching template at the maximum value is taken as the detection box position of the current target; the rotation angle corresponding to the matching template at the maximum value is the detection direction of the current target. Step 5: Match the detected target and the tracked target using positional and orientation similarity; Step 6: Update the tracking information for all targets, including target outline area, target bounding box position, target orientation, and target status.

2. The fish target tracking method based on contour matching according to claim 1, characterized in that, The specific steps of step 1 are as follows: Step 1.1: Acquire several frames of video images and establish a background model using statistical methods; Step 1.2: Perform difference processing on the current frame image and the background model, and then binarize them to obtain the binarized image of the target background after difference. Step 1.3: Convert the current frame image to the HSV color gamut, and set color filtering intervals according to the color features of the target fish. After color filtering, the current frame image will be binarized into pixels within the interval and pixels outside the interval to obtain a binary image with filtered color features. Step 1.4: Perform a bitwise AND operation on the binary image after background subtraction and the binary image after color feature filtering to obtain the target binary image; then perform an opening operation on the binary image to remove noise from the image and obtain all target contours, and use the target contour boxes as detection boxes.

3. The fish target tracking method based on contour matching according to claim 1, characterized in that, The specific steps of step 3 are as follows: Step 3.1: Traverse the occlusion network determined to be independent targets in Step 2, find the largest inscribed circle of the fish's outline, and denote the center of the largest inscribed circle as (x... cir ,y cir The radius of the largest inscribed circle is denoted as r; Step 3.2: Determine the head point of the fish's outline: Draw a straight line l through any tangent point coordinates and the center of the inscribed circle. During the fish's movement, the head and tail points are always on opposite sides of line l. Therefore, divide the points in the outline set into sets C1 and C2 according to their location on different sides of line l. The maximum distance from the points in the two sets to the center of the inscribed circle is respectively the head point (x... head ,y head ) and tail point (x) tail ,y tail The point that is shorter than the center of the inscribed circle is defined as the head point. Step 3.3: Determine the fish's posture direction: Draw a straight line through the center of the inscribed circle and the head point. Define the angle between the direction from the center of the inscribed circle to the head point and the positive x-axis direction, rotated counterclockwise, as the fish's direction α. ​​The formula for calculating this angle is:

4. The fish target tracking method based on contour matching according to claim 1, characterized in that, The specific steps of step 5 are as follows: Step 5.1: Track the i-th target T i The data in the middle records the target information of the previous frame, and its position information is denoted as... Let x and y represent the x and y coordinates of the center point of the detection frame, and the length and width of the detection frame, respectively, with the direction denoted as y. The input is given to a Kalman filter for prediction, and the output position prediction result is: This indicates the aspect ratio of the detection box, and the orientation prediction result is... Step 5.2: Calculate the cost matrix of the orientation information between the tracked target and the detected target: For the i-th tracked target T i and the j-th detection target D j The cost between two targets consists of positional distance and directional distance, where the positional distance d1 is 1 minus the tracking target T. i Predicted bounding box and detected target D j The corresponding IOU values ​​between detection boxes, with directional distance d2 being the tracking target T. i Predicted direction and detection target D j Detection direction The cosine distance between them; the i-th tracked target T i and the j-th detection target D j The cost formula between them, c ij Represented as: c ij =λd1+(1-λ)d2 Where λ is the weight parameter; Step 5.3: Using the cost matrix between the tracked target and the detected target obtained in Step 5.2, the correlation matching algorithm is used to match all detected targets in the current frame.

5. A fish target tracking device based on contour matching, characterized in that, The system includes a chassis, an industrial computer, a display screen, a camera, a fish tank, and an LED light source. A fish target is placed inside the fish tank, which is set in a dark room. The camera and LED light source are fixed above the fish tank. The water source to be detected continuously flows in from the inlet of the fish tank and flows out from the outlet, realizing a real-time changing water quality environment. The camera captures video sequences, and a tracking algorithm runs on the industrial computer to implement the fish target tracking method based on contour matching as described in claim 1, and the output results are displayed on the monitor.

Citation Information

Patent Citations

  • Simple and universal fish school video image trajectory tracking method

    CN111968159A

  • Multi-target trajectory tracking and fusion method and system based on trajectory prediction

    CN112862853A

  • Fish group individual target tracking method based on visual attention model

    CN106529434A

  • Multi-target tracking method for synchronous moving target

    CN113723190A