River water body pollution evaluation method and evaluation system

CN122530680APending Publication Date: 2026-08-07BEIJING ZHONGQI JINGCHENG ENVIRONMENTAL TECHNOLOGY CO LTD SICHUAN BRANCH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING ZHONGQI JINGCHENG ENVIRONMENTAL TECHNOLOGY CO LTD SICHUAN BRANCH
Filing Date
2026-05-20
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

然而,理化检测方法存在明显不足:一方面,单次采样的理化指标只能反映采样瞬间的水质状况,无法体现污染物对水生生物长期、综合的毒性效应;另一方面,多种污染物共存时可能产生协同或拮抗作用,单纯依靠理化指标难以准确评估水体的生态风险

Benefits of technology

[0015]本发明公开了一种河流水体污染评价方法及评价系统,属于计算机视觉与河流水环境监测交叉技术领域。通过水下摄像装置采集河流中多个生物类群的连续影像,针对每个生物个体分别提取运动轨迹形态和身体姿态变化,并将其与预先存储的轨迹模板集合及姿态模板集合进行匹配,从而判定每个个体的正常、亚正常或异常状态,按生物类群统计个体状态等级分布,构建由各生物类群状态比例组成的当前状态矩阵,再将该矩阵与预先存储的多个参考矩阵进行逐元素差异比较,选取总差异值最小的参考矩阵所对应的污染等级作为评价结果输出。本发明综合利用多类生物对污染物的差异化响应信息,不依赖模型训练与数据预处理,可解释性强,适用于河流水体的快速、连续、非接触式污染评价。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122530680A_ABST
    Figure CN122530680A_ABST
Patent Text Reader

Abstract

The application discloses a river water pollution evaluation method and an evaluation system, and belongs to the technical field of computer vision and river water environment monitoring. The application collects continuous images of multiple biological groups in a river through an underwater camera device, respectively extracts motion trajectory forms and body posture changes, and matches the trajectory forms and the body posture changes with a pre-stored trajectory template set and a posture template set, so that the normal, subnormal or abnormal state of each individual is determined, the individual state grade distribution is counted according to the biological groups, a current state matrix composed of state proportions of the biological groups is constructed, the matrix is compared with a plurality of reference matrices in terms of element difference, and the pollution grade corresponding to the reference matrix with the minimum total difference value is selected as an evaluation result output. The application comprehensively utilizes the differential response information of multiple types of organisms to pollutants, does not depend on model training and data preprocessing, has strong interpretability, and is suitable for rapid, continuous and non-contact pollution evaluation of river water.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention discloses a method and system for assessing river water pollution, belonging to the interdisciplinary field of computer vision and river water environment monitoring. Background Technology

[0002] River water pollution assessment is a crucial aspect of water environment monitoring and protection. Traditional water pollution assessment methods primarily rely on physicochemical index detection, such as measuring parameters like dissolved oxygen, chemical oxygen demand, ammonia nitrogen, and heavy metal concentrations after water sampling, and comparing these parameters with national standard thresholds to determine the pollution level. However, physicochemical detection methods have significant limitations: firstly, physicochemical indicators from a single sampling only reflect the water quality at the instant of sampling, failing to reflect the long-term, comprehensive toxic effects of pollutants on aquatic organisms; secondly, the coexistence of multiple pollutants may produce synergistic or antagonistic effects, making it difficult to accurately assess the ecological risk of water bodies solely based on physicochemical indicators.

[0003] In recent years, biomonitoring methods have gradually gained attention. Their basic principle is to utilize the sensitivity of aquatic organisms to pollutants, indirectly assessing the degree of water pollution by observing the survival rate, behavioral changes, or community structure of these organisms. Common biomonitoring methods include acute toxicity tests on fish, benthic invertebrate diversity surveys, and algal growth inhibition tests. However, these methods largely rely on manual observation and recording, resulting in drawbacks such as high subjectivity, time-consuming and labor-intensive processes, and the inability to conduct continuous monitoring.

[0004] With the development of computer vision and image processing technologies, some researchers have attempted to use camera devices to collect images of aquatic organisms in motion and to assess their health status by analyzing their movement trajectories or changes in body morphology. For example, existing literature reports methods for detecting abnormal behavior based on fish swimming trajectories, or for assessing the toxicity level of water bodies using parameters such as swimming speed and turning frequency of small organisms like shrimp and water fleas. However, these existing methods typically analyze only single biological groups, ignoring the important ecological fact that different biological groups have different sensitivities to pollutants—some pollutants may have a small impact on fish but are highly toxic to benthic insect larvae, and evaluations based solely on a single organism may lead to misjudgments. Furthermore, existing methods often use simple motion parameter statistics such as average speed and activity time percentage when analyzing the state of organisms, failing to fully explore the rich information contained in the movement trajectories and changes in body posture of individual organisms, and lacking technical means to integrate and evaluate the distribution of individual states from multiple biological groups. Summary of the Invention

[0005] To achieve the above objectives, this application provides the following technical solution: A method for assessing river water pollution includes the following steps: S1, which uses an underwater camera device to capture continuous images of multiple biological groups in the river; S2, for each biological group, identify the movement trajectory and body posture changes of each individual organism contained in the continuous images; S3. For each biological individual, match the movement trajectory pattern of the biological individual with each trajectory template in the pre-stored trajectory template set, and match the body posture change of the biological individual with each posture template in the pre-stored posture template set. Determine the individual state level of the biological individual based on the matching results. S4. For each biological group, calculate the distribution of individual state levels of all biological individuals within that biological group to obtain the state distribution vector of that biological group. S5, arrange the state distribution vectors of each biological group according to a fixed biological group order to construct the current state matrix; S6. Compare the current state matrix with each of the pre-stored reference matrices element by element, calculate the absolute value of the difference between the elements at the same position in the current state matrix and the reference matrices, and sum the absolute values ​​of the differences at all positions to obtain the total difference value. S7 selects the pollution level corresponding to the reference matrix with the smallest total difference value as the current pollution assessment result of the river water body.

[0006] Furthermore, S2 identifies the movement trajectory patterns of each individual organism within the biological group, including: Perform biological individual detection on each frame of continuous images and obtain the center point pixel coordinates of each biological individual; Connect the center pixel coordinates of the same biological individual in consecutive frames in chronological order to form a trajectory point sequence; Trajectory morphology features are extracted from the trajectory point sequence. These features include the curvature of the trajectory, the turning frequency of the trajectory, and the closure of the trajectory. The curvature is characterized by the change in the turning angle formed by three adjacent points in the trajectory point sequence. The turning frequency is characterized by the number of times the trajectory direction changes per unit time. The closure is characterized by the ratio of the spatial distance between the trajectory start point and the end point to the total length of the trajectory.

[0007] Furthermore, the S2 identifies the changes in body posture of each individual organism within the biological group, including: For each biological individual detected in each frame of a continuous image, the contour is extracted to obtain the set of outer contour boundary points of the biological individual. Calculate the geometric parameters of the set of outer contour boundary points in each frame, including the elongation of the contour, the roundness of the contour, and the area of ​​the convex hull defect of the contour. The geometric parameters of multiple consecutive frames are arranged in chronological order to form a posture change sequence, where elongation represents the degree to which the organism's body is stretched, roundness represents the degree to which the organism's outline is close to a circle, and convex hull defect area represents the degree to which the organism's body is bent or contracted.

[0008] Further, S3 includes: The movement trajectory pattern of an individual organism is matched with each trajectory template in the trajectory template set. The difference between the trajectory direction angle sequence of the individual organism and the direction angle sequence of each trajectory template is calculated. The trajectory template with the smallest difference is selected as the matching trajectory template, and the movement type corresponding to the matching trajectory template is recorded. The changes in the body posture of an individual organism are matched with each posture template in the posture template set. The difference between the sequence of changes in the outline elongation rate, the sequence of changes in the outline roundness, and the sequence of changes in the convex hull defect area of ​​the individual organism and the corresponding sequence of each posture template is calculated. The difference of the three sequences is weighted and summed to obtain the comprehensive difference. The posture template with the smallest comprehensive difference is selected as the matching posture template, and the posture type corresponding to the matching posture template is recorded. Based on the combination of the motion type of the matching trajectory template and the posture type of the matching posture template, the individual status level of the organism is determined by referring to the preset status level mapping table. When the matching trajectory template is a straight swimming trajectory and the matching posture template is a body extension mode or a body still mode, the status level is normal. When the matching trajectory template is a curved swimming trajectory and the matching posture template is a body contraction mode, the state level is subnormal. When the matching trajectory template is a spiral swimming trajectory or a stationary swing trajectory and the matching posture template is a body twisting mode, the status level is abnormal. Other combinations correspond to subnormal or abnormal states depending on the degree to which the movement and posture types deviate from the normal pattern.

[0009] Further, S4 includes: Initialize the counter for this biological group, which contains three counting units, corresponding to the normal state, subnormal state and abnormal state respectively; Iterate through each individual organism in the biological group, and increment the corresponding counting unit by one unit according to the individual status level determined by S3; After the traversal is complete, calculate the total number of individuals in this biological group; Divide the count value of each counting unit by the total number of individuals to obtain the proportion of individuals in a normal state, the proportion of individuals in a subnormal state, and the proportion of individuals in an abnormal state in this biological group. Arrange the three proportions in the order of normal state, subnormal state, and abnormal state to form the state distribution vector of this biological group.

[0010] Further, S5 includes: A fixed order of biological groups is pre-defined, which is arranged from low to high trophic level of the organisms in the river water, or from small to large individual organism size. The state distribution vectors of each biological group are extracted in this fixed order, and the extracted state distribution vectors are used as a row of the current state matrix. The current state matrix has three columns: the first column is the proportion of normal states, the second column is the proportion of subnormal states, and the third column is the proportion of abnormal states. When a certain biological group is not present in the river water, all components of the state distribution vector corresponding to that biological group are set to zero.

[0011] Further, S6 includes: S61, Obtain a pre-stored reference matrix library, where each reference matrix corresponds to a river water pollution level, including no pollution level, light pollution level, moderate pollution level, and heavy pollution level; S62, retrieve an uncompared reference matrix from the reference matrix library as the current reference matrix; S63, calculate the difference between the element values ​​of the first row, first column, second column, and third column of the current state matrix and the element values ​​of the first row, first column, second column, and third column of the current reference matrix in turn to obtain the first absolute value of the difference, the second absolute value of the difference, and the third absolute value of the difference; S64, in row-major order, repeat S63 for each row and column of the current state matrix until the absolute value of the difference has been calculated for all rows and all columns of the current state matrix. S65, sum up the absolute values ​​of all the calculated differences to obtain the total difference value corresponding to the current reference matrix; S66, determine if there are any uncompared reference matrices in the reference matrix library. If there are, return to S62; otherwise, proceed to S67. S67. Arrange the total difference values ​​corresponding to all reference matrices in ascending order, and select the reference matrix with the smallest total difference value as the reference matrix that best matches the current state matrix.

[0012] Further, S7 includes: The pollution level corresponding to the selected reference matrix is ​​converted into a text description, which includes four strings: no pollution, light pollution, moderate pollution, and heavy pollution. The total difference value corresponding to the pollution level is converted into a confidence indicator. The confidence indicator includes three types: high confidence, medium confidence, and low confidence. When the total difference value is less than a first preset threshold, the confidence indicator is high confidence; when the total difference value is between the first preset threshold and the second preset threshold, the confidence indicator is medium confidence; and when the total difference value is greater than the second preset threshold, the confidence indicator is low confidence. The text description is combined with the confidence indicator to form an evaluation record, and the evaluation record is output to the computer system's display interface or storage medium.

[0013] Furthermore, when acquiring continuous images of multiple biological groups in the river water body in S1, the step of setting the shooting parameters of the underwater camera device is also included. The shooting parameters include the sampling frame rate and the single shooting duration. The sampling frame rate is set to a value that can completely capture its movement cycle based on the movement speed of the smallest biological individual in the biological group, and the single shooting duration is set to the duration that can record at least one complete movement cycle. During the data collection process, the underwater camera device should be kept in a fixed position relative to the river water, and the optical axis of the underwater camera device should be kept perpendicular to the direction of the river flow.

[0014] According to a second aspect of the present invention, the present invention claims protection for a river water pollution assessment system, comprising: A memory that stores one or more programs, which, when executed by one or more processors, enable the one or more processors to implement the aforementioned method for assessing river water pollution.

[0015] This invention discloses a method and system for assessing river water pollution, belonging to the interdisciplinary field of computer vision and river water environment monitoring. It involves acquiring continuous images of multiple biological groups in a river using an underwater camera. For each individual organism, its movement trajectory morphology and body posture changes are extracted and matched against pre-stored trajectory and posture template sets to determine its normal, sub-normal, or abnormal state. The distribution of individual state levels is statistically analyzed according to biological groups, constructing a current state matrix composed of the state proportions of each biological group. This matrix is ​​then compared element-by-element with multiple pre-stored reference matrices, and the pollution level corresponding to the reference matrix with the smallest total difference value is selected as the evaluation result. This invention comprehensively utilizes the differentiated response information of multiple biological groups to pollutants, does not rely on model training and data preprocessing, has strong interpretability, and is suitable for rapid, continuous, and non-contact pollution assessment of river water bodies. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating the workflow of a river water pollution assessment method claimed in an embodiment of the present invention. Figure 2 This is a second workflow diagram of a river water pollution assessment method claimed in an embodiment of the present invention. Figure 3 The third flowchart is shown for a river water pollution assessment method claimed in this embodiment of the invention. Detailed Implementation

[0017] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0018] The terms "first," "second," and "third" in this application are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of those features. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified. All directional indications in the embodiments of this application, such as up, down, left, right, front, back, etc., are only used to explain the relative positional relationships and movements between components in a specific orientation as shown in the accompanying drawings. If the specific orientation changes, the directional indications will change accordingly. Furthermore, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.

[0019] References to embodiments herein mean that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0020] Existing image-based biomonitoring methods face several technical bottlenecks in practical applications. Some methods rely on pre-trained deep learning models to identify abnormal biological behavior, but model training requires a large number of labeled samples, and the models have poor generalization ability across different river environments and biological species, making retraining costly. Other methods attempt to identify pollution by extracting multidimensional features of biological movement and inputting them into a classifier, but these methods often involve complex mathematical formulas or require data normalization and standardization preprocessing, increasing computational complexity and deployment difficulty, and making it difficult to explain the basis of the judgment results to environmental monitoring personnel. More importantly, there is currently no method that can directly utilize multiple types of biological imagery to determine the pollution level of river water by comparing the distribution of individual biological states with a preset reference matrix without involving model training and data preprocessing. Therefore, developing a river water pollution assessment method that can comprehensively utilize information from multiple types of biological imagery, has clear logical steps, requires no complex calculations, and is highly interpretable has significant practical significance and application value.

[0021] According to a first embodiment of the present invention, the present invention claims protection for a method for assessing river water pollution, referring to... Figure 1 This includes the following steps: S1, which uses an underwater camera device to capture continuous images of multiple biological groups in the river; S2, for each biological group, identify the movement trajectory and body posture changes of each individual organism contained in the continuous images; S3. For each biological individual, match the movement trajectory pattern of the biological individual with each trajectory template in the pre-stored trajectory template set, and match the body posture change of the biological individual with each posture template in the pre-stored posture template set. Determine the individual state level of the biological individual based on the matching results. S4. For each biological group, calculate the distribution of individual state levels of all biological individuals within that biological group to obtain the state distribution vector of that biological group. S5, arrange the state distribution vectors of each biological group according to a fixed biological group order to construct the current state matrix; S6. Compare the current state matrix with each of the pre-stored reference matrices element by element, calculate the absolute value of the difference between the elements at the same position in the current state matrix and the reference matrices, and sum the absolute values ​​of the differences at all positions to obtain the total difference value. S7 selects the pollution level corresponding to the reference matrix with the smallest total difference value as the current pollution assessment result of the river water body.

[0022] This embodiment describes the application of a river water pollution assessment method in the Qingxi River. A computer system is connected to an underwater camera device, which is fixed 0.5 meters below the riverbed of the Qingxi River, with the lens direction perpendicular to the water flow direction.

[0023] The first step involved the computer system acquiring continuous images of three biological groups in the Qingxi River using an underwater camera: the first group consisted of crucian carp, the second of prawns, and the third of dragonfly larvae and aquatic insects. The sampling frame rate was set to 30 frames per second, with a continuous acquisition time of 120 seconds, resulting in an image sequence containing multiple frames.

[0024] The second step, targeting crucian carp, involves the computer system detecting the center point pixel coordinates of each crucian carp in each frame of the image sequence. The center point coordinates of the same crucian carp in 60 consecutive frames are then connected chronologically to form the fish's motion trajectory. Simultaneously, for the same crucian carp, the outer contour boundary points are extracted from each frame, and the elongation rate, the ratio of body length to width, the ratio of circularity area to the square of the perimeter, and the area difference between the contour and its convex hull are calculated. The elongation rate, circularity, and convex hull defect area of ​​60 consecutive frames are arranged chronologically to construct a sequence of the crucian carp's body posture changes. The exact same operation is performed on shrimp and dragonfly larvae, only the detected and tracked targets differ.

[0025] The third step involves the computer system matching the motion trajectory pattern (i.e., the trajectory direction angle sequence) of each crucian carp with a pre-stored set of trajectory templates. This set includes four templates: a straight-line swimming trajectory template with an direction angle variation of less than 5 degrees; a curved swimming trajectory template with a direction angle continuously varying within ±30 degrees; a spiral swimming trajectory template with a direction angle continuously rotating more than 360 degrees; and a stationary oscillating trajectory template with a direction angle rapidly changing back and forth and a positional movement of less than two body lengths. The system calculates the difference between the actual direction angle sequence of the crucian carp and each template direction angle sequence, for example, by comparing and accumulating the direction angle differences frame by frame, and selecting the template with the smallest difference as the matching trajectory template. Simultaneously, the system matches three sequences related to the crucian carp's body posture changes—elongation rate, roundness, and convex hull defect area—with the posture template set. The posture template set contains four templates: the body extension pattern template has gradually increasing elongation and decreasing roundness, with a small and stable convex hull defect area; the body contraction pattern template has gradually decreasing elongation and increasing roundness, with the convex hull defect area initially increasing and then decreasing; the body torsion pattern template has oscillating elongation and roundness, with frequent fluctuations in the convex hull defect area; and the body stillness pattern template has essentially unchanged parameters. The system calculates the difference between each of the three sequences and the corresponding sequence of each template. The three differences are weighted according to preset weights (e.g., elongation weight 0.4, roundness weight 0.3, convex hull defect area weight 0.3), and then summed to obtain a comprehensive difference score. The template with the smallest comprehensive difference score is selected as the matching posture template. Finally, based on the matching results and referring to the state level mapping table: if the matching trajectory template is straight-line swimming and the matching posture template is body extension or body stillness, the state level is normal; if the matching trajectory template is curved swimming and the matching posture template is body contraction, the state level is subnormal; if the matching trajectory template is spiral swimming or stationary swaying and the matching posture template is body twisting, the state level is abnormal; other combinations, such as straight-line swimming with body twisting, are also classified as subnormal or abnormal. The system outputs a state level for each biological individual.

[0026] Step 4: For the crucian carp group, assume a total of 50 crucian carp are identified in the image. The system initializes three counters: normal counter = 0, subnormal counter = 0, and abnormal counter = 0. Iterate through the 50 crucian carp, incrementing the corresponding counter by 1 for each fish based on the level obtained in step 3. After iteration, the total number of individuals is 50. If the normal counter is 30, the subnormal counter is 15, and the abnormal counter is 5, then calculate the proportions: normal proportion = 30 / 50 = 0.6, subnormal proportion = 15 / 50 = 0.3, and abnormal proportion = 5 / 50 = 0.1. The resulting state distribution vector for the crucian carp group is [0.6, 0.3, 0.1]. Repeat the above statistics for shrimp and dragonfly larvae groups to obtain their respective state distribution vectors.

[0027] The fifth step involves pre-setting a fixed order for biological groups: arranged from lowest to highest trophic level, i.e., dragonfly larvae are at the lowest trophic level, shrimp at the middle trophic level, and crucian carp at the highest trophic level. The state distribution vector of dragonfly larvae is used as the first row of a matrix, shrimp as the second row, and crucian carp as the third row. The matrix has three fixed columns: the first column represents the normal proportion, the second column represents the subnormal proportion, and the third column represents the abnormal proportion. For example, if the vector for dragonfly larvae is [0.2, 0.4, 0.4], the vector for shrimp is [0.5, 0.3, 0.2], and the vector for crucian carp is [0.6, 0.3, 0.1], then the current state matrix is: First line: [0.2, 0.4, 0.4] Second line: [0.5, 0.3, 0.2] Third row: [0.6, 0.3, 0.1] Step 6: The system retrieves four reference matrices from a pre-stored reference matrix library, corresponding to uncontaminated, lightly contaminated, moderately contaminated, and heavily contaminated states, respectively. The row and column structure of each reference matrix is ​​identical to the current state matrix. The system performs an element-by-element difference comparison between the current state matrix and the uncontaminated reference matrix: The absolute value of the difference in the first row and first column is calculated as follows: |0.2 - 0.1| = 0.1, |0.4 - 0.2| = 0.2, |0.4 - 0.1| = 0.3; |0.5 - 0.4| = 0.1, |0.3 - 0.3| = 0, |0.2 - 0.2| = 0; |0.6 - 0.7| = 0.1, |0.3 - 0.2| = 0.1, |0.1 - 0.1| = 0. Sum the absolute values ​​of all differences: 0.1 + 0.2 + 0.3 + 0.1 + 0 + 0 + 0.1 + 0.1 + 0 = 0.9. Similarly, the total difference with the light pollution reference matrix is ​​calculated to be 0.5, the total difference with the moderate pollution reference matrix is ​​0.3, and the total difference with the heavy pollution reference matrix is ​​0.8.

[0028] The seventh step involves the system selecting the reference matrix with the smallest total difference value, namely the moderate pollution reference matrix with a total difference value of 0.3, and outputting the pollution level corresponding to this reference matrix as the pollution assessment result of the Qingxi River's current water body.

[0029] Furthermore, S2 identifies the movement trajectory patterns of each individual organism within the biological group, including: Perform biological individual detection on each frame of continuous images and obtain the center point pixel coordinates of each biological individual; Connect the center pixel coordinates of the same biological individual in consecutive frames in chronological order to form a trajectory point sequence; Trajectory morphology features are extracted from the trajectory point sequence. These features include the curvature of the trajectory, the turning frequency of the trajectory, and the closure of the trajectory. The curvature is characterized by the change in the turning angle formed by three adjacent points in the trajectory point sequence. The turning frequency is characterized by the number of times the trajectory direction changes per unit time. The closure is characterized by the ratio of the spatial distance between the trajectory start point and the end point to the total length of the trajectory.

[0030] In this embodiment, biological individual detection is first performed on each frame of the continuous image. The detection process is as follows: For each frame of the image, all pixel regions in the image are traversed, and candidate regions belonging to crucian carp are filtered out based on a pre-set range of biological individual size (e.g., minimum 10 pixels, maximum 200 pixels) and shape features (e.g., aspect ratio between 2:1 and 5:1). For each candidate region, the geometric center of its bounding rectangle is calculated, and the pixel coordinates x, y of this center point are used as the center point coordinates of the crucian carp in the current frame. Assuming a crucian carp numbered F001 has center point coordinates of (120, 340) in frame 1, (125, 342) in frame 2, (130, 339) in frame 3, and so on, until frame 60, which is (300, 280).

[0031] The center pixel coordinates of the same biological individual in consecutive frames are connected in chronological order to form a trajectory point sequence. For crucian carp F001, the trajectory point sequence is: [(120,340), (125,342), (130,339), (135,341), (140,338), ……, (300,280)], totaling 60 points.

[0032] Three trajectory morphological features were extracted from the trajectory point sequence: First, the curvature of the trajectory. Take three adjacent points in the trajectory point sequence, such as points A, B, and C, and calculate the turning angle between vectors AB and BC. The specific calculation method for the turning angle is as follows: first calculate the direction angle α of vector AB, then calculate the direction angle β of vector BC. The turning angle is the absolute value of the difference between β and α. If the difference is greater than 180 degrees, subtract the difference from 360 degrees. For the F001 crucian carp, calculate the turning angles for all combinations of adjacent three points to obtain a sequence of turning angles. The curvature is defined as the average value of all turning angles in this sequence. For example, if the average turning angle is 8 degrees, the trajectory is relatively straight; if the average turning angle is 35 degrees, the trajectory is significantly curved.

[0033] Second, the trajectory turning frequency. This involves counting the number of trajectory direction changes per unit of time. The unit of time is set to 1 second, corresponding to 30 frames. A change in direction is defined as a turn when the angle difference between two adjacent frames exceeds 15 degrees. For the F001 crucian carp, the vector direction of the movement from the center point of frame t to the center point of frame t+1 is calculated frame by frame. Then, it is determined whether the angle difference between two adjacent movement directions is greater than 15 degrees, and the number of turns occurring within 1 second of every 30 frames is counted. For example, if the number of turns in the first second is 2, the turning frequency is 2 times / second.

[0034] Third, the closure of the trajectory. Calculate the spatial distance between the center point of the starting point in frame 1 and the center point of the ending point in frame 60, and the sum of the Euclidean distances between all adjacent points along the total trajectory length. Closure is defined as the spatial distance between the starting and ending points divided by the total trajectory length. For example, the spatial distance between the starting point (120, 340) and the ending point (300, 280) is √((300-120)²+(280-340)²)=√(180²+(-60)²)=√(32400+3600)=√36000≈189.7 pixels; the total trajectory length is the sum of the distances of each segment, assumed to be 350 pixels; then the closure = 189.7 / 350≈0.542. A closure close to 0 indicates that the trajectory is approximately closed with the starting and ending points coinciding, while a closure close to 1 indicates that the trajectory is approximately a straight line.

[0035] The above three features—curvature, turning frequency, and closure—completely describe the motion trajectory of the crucian carp F001, which can be used for subsequent matching with trajectory templates.

[0036] Furthermore, referring to Figure 2 The S2 identifies the changes in body posture of each individual organism within the biological group, including: For each biological individual detected in each frame of a continuous image, the contour is extracted to obtain the set of outer contour boundary points of the biological individual. Calculate the geometric parameters of the set of outer contour boundary points in each frame, including the elongation of the contour, the roundness of the contour, and the area of ​​the convex hull defect of the contour. The geometric parameters of multiple consecutive frames are arranged in chronological order to form a posture change sequence, where elongation represents the degree to which the organism's body is stretched, roundness represents the degree to which the organism's outline is close to a circle, and convex hull defect area represents the degree to which the organism's body is bent or contracted.

[0037] In this embodiment, taking individual prawns in the Qingxi River as an example, contour extraction is performed on each prawn detected in each frame of a continuous image. The extraction process is as follows: First, edge detection is performed on the local area where the prawn is located in each frame of the image to obtain a set of edge points; then, connected component analysis is used to connect all edge points into a closed boundary, forming a set of outer contour boundary points. Assuming a prawn numbered S001, in the first frame, its outer contour consists of 156 boundary points, which are arranged in a clockwise direction to form an irregular closed polygon.

[0038] For each frame's set of outer contour boundary points, calculate three geometric parameters: First, the elongation rate of the outline. Calculate the minimum bounding rectangle of the outline, where the longer side is L and the shorter side is W. The elongation rate = L / W. For the first frame of the S001 shrimp, assuming the longer side of the minimum bounding rectangle is 45 pixels and the shorter side is 15 pixels, then the elongation rate = 45 / 15 = 3.0. The larger the elongation rate, the longer the body is stretched.

[0039] Second, the roundness of the outline. Calculate the area of ​​the outline (A) and the total number of pixels inside the outline, and the perimeter (P) and the cumulative distance between the boundary points of the outline. Roundness = 4πA / P². For the first frame of the S001 shrimp, assuming A = 420 square pixels and P = 92 pixels, then roundness = 4 × 3.1416 × 420 / (92 × 92) = 5277.9 / 8464 ≈ 0.623. The closer the roundness is to 1, the closer the outline is to a circle; the smaller the roundness, the narrower or more irregular the outline.

[0040] Third, the convex hull defect area of ​​the contour. First, calculate the smallest convex polygon containing the contour in the convex hull, and obtain the area of ​​the convex hull. Convex hull defect area = Convex hull area - Contour area. For the first frame of the S001 shrimp, assuming the convex hull area is 500 square pixels and the contour area is 420 square pixels, then the convex hull defect area = 80 square pixels. This value characterizes the degree of body bending or contraction: when the shrimp body is fully extended, the contour is close to the convex hull, and the defect area is small; when the shrimp body is bent or contracted, the contour is concave, and the defect area increases.

[0041] For example, 60 consecutive frames, corresponding to 2 seconds, are used to form a pose change sequence based on these three geometric parameters in chronological order. For the S001 shrimp, the elongation rate of frame 1 is 3.0, roundness is 0.623, and convex hull defect area is 80; the elongation rate of frame 2 is 2.9, roundness is 0.630, and convex hull defect area is 85; the elongation rate of frame 3 is 2.7, roundness is 0.645, and convex hull defect area is 95; ...; the elongation rate of frame 60 is 2.2, roundness is 0.680, and convex hull defect area is 130. Therefore, the elongation rate change sequence is [3.0, 2.9, 2.7, ..., 2.2], the roundness change sequence is [0.623, 0.630, 0.645, ..., 0.680], and the convex hull defect area change sequence is [80, 85, 95, ..., 130]. These three sequences together constitute the body posture changes of the S001 shrimp, fully recording the process of the shrimp's body gradually changing from extension to contraction within 2 seconds.

[0042] Further, S3 includes: The movement trajectory pattern of an individual organism is matched with each trajectory template in the trajectory template set. The difference between the trajectory direction angle sequence of the individual organism and the direction angle sequence of each trajectory template is calculated. The trajectory template with the smallest difference is selected as the matching trajectory template, and the movement type corresponding to the matching trajectory template is recorded. The changes in the body posture of an individual organism are matched with each posture template in the posture template set. The difference between the sequence of changes in the outline elongation rate, the sequence of changes in the outline roundness, and the sequence of changes in the convex hull defect area of ​​the individual organism and the corresponding sequence of each posture template is calculated. The difference of the three sequences is weighted and summed to obtain the comprehensive difference. The posture template with the smallest comprehensive difference is selected as the matching posture template, and the posture type corresponding to the matching posture template is recorded. Based on the combination of the motion type of the matching trajectory template and the posture type of the matching posture template, the individual status level of the organism is determined by referring to the preset status level mapping table. When the matching trajectory template is a straight swimming trajectory and the matching posture template is a body extension mode or a body still mode, the status level is normal. When the matching trajectory template is a curved swimming trajectory and the matching posture template is a body contraction mode, the state level is subnormal. When the matching trajectory template is a spiral swimming trajectory or a stationary swing trajectory and the matching posture template is a body twisting mode, the status level is abnormal. Other combinations correspond to subnormal or abnormal states depending on the degree to which the movement and posture types deviate from the normal pattern.

[0043] In this embodiment, a dragonfly larva from the Qingxi River is used as an example.

[0044] Sub-step A: The specific content of the trajectory template set. Four trajectory templates are pre-stored, each consisting of a sequence of trajectory direction angles. The direction angle sequence of the straight-line motion trajectory template is [0°, 0°, 0°, ..., 0°], where all direction angles are 0 degrees, representing a constant direction. The direction angle sequence of the curved motion trajectory template is [10°, 20°, 30°, 20°, 10°, -10°, -20°, -10°, 10°, ...], exhibiting a sinusoidal wave pattern with an amplitude between ±30 degrees. The direction angle sequence of the spiral motion trajectory template is [10°, 20°, 30°, 40°, 50°, ..., 350°, 360°, 10°, ...], with the direction angles continuously increasing, forming a cycle every 360 degrees. The direction angle sequence of the stationary swing trajectory template is [90°, -90°, 90°, -90°, 90°, -90°, ……]. The direction angles alternate rapidly between positive and negative 90 degrees, but the range of position coordinate changes is less than two body lengths.

[0045] Sub-step B: Specific content of the posture template set. Four posture templates are pre-stored. Each template consists of a sequence of changes in contour elongation rate, a sequence of changes in roundness, and a sequence of changes in convex hull defect area. Body extension pattern template: The elongation rate sequence gradually increases from 2.0 to 4.0, the roundness sequence gradually decreases from 0.7 to 0.5, and the convex hull defect area sequence gradually decreases from 120 to 60. Body contraction pattern template: The elongation rate sequence gradually decreases from 4.0 to 2.0, the roundness sequence gradually increases from 0.5 to 0.7, and the convex hull defect area sequence gradually increases from 60 to 120. Body twisting pattern template: The elongation rate sequence oscillates between 2.5 and 3.5, the roundness sequence oscillates between 0.55 and 0.65, and the convex hull defect area sequence fluctuates frequently between 80 and 110. Body stillness pattern template: The elongation rate sequence is constant at 2.0, the roundness sequence is constant at 0.7, and the convex hull defect area sequence is constant at 120.

[0046] Sub-step C: Extract the movement trajectory morphology of a dragonfly larva L001, obtaining its azimuth angle sequence as [5°, 8°, 12°, 15°, 18°, 22°, 25°, 28°, 30°, 28°, 25°, 22°, 18°, 15°, 12°, 8°, 5°, ...]. Calculate the difference between this sequence and each trajectory template. The difference calculation method is as follows: calculate the absolute value of the angle difference for elements at the same position in both sequences, sum all angle differences, and divide by the sequence length. The difference with the straight-line swimming template is an average angle difference of 20 degrees per frame; the difference with the curved swimming template is an average angle difference of 3 degrees per frame; the difference with the spiral swimming template is an average angle difference of 40 degrees per frame; and the difference with the stationary oscillation template is an average angle difference of 50 degrees per frame. Select the template with the smallest difference, i.e., the curved swimming trajectory template, and record the movement type as curved swimming.

[0047] Sub-step D: Extract the body posture changes of L001 to obtain the elongation sequence [2.8, 2.7, 2.5, 2.4, 2.2, 2.1, 2.0, 1.9], the roundness sequence [0.62, 0.64, 0.66, 0.68, 0.70, 0.72, 0.74, 0.76], and the convex hull defect area sequence [90, 95, 105, 115, 125, 135, 145, 155]. Calculate the difference between these three sequences and the corresponding sequence of each posture template, summing the absolute values ​​of the frame-by-frame differences and dividing by the number of frames. Difference from the body extension template: Large difference in elongation rate (template increases while actual elongation rate decreases), large difference in roundness, large difference in convex hull defect area, resulting in high overall difference. Difference from the body contraction template: Small difference in elongation rate (template ranges from 4.0 to 2.0, actual elongation rate ranges from 2.8 to 1.9, showing a consistent trend but numerical deviation), small difference in roundness, small difference in convex hull defect area, resulting in low overall difference. Difference from the body torsion template: No oscillations in the actual sequence, resulting in moderate difference. Difference from the body stillness template: Significant changes in the actual sequence, resulting in high difference. The template with the lowest overall difference, i.e., the body contraction pattern template, is selected, and the posture type is recorded as body contraction.

[0048] Sub-step E: Based on the matching results, the movement type is defined as curvilinear swimming and the posture type as body contraction. Refer to the preset state level mapping table. This mapping table explicitly records that the combination of curvilinear swimming and body contraction corresponds to a subnormal state. Other examples of combinations: straight-line swimming and body extension correspond to a normal state; spiral swimming and body twisting correspond to an abnormal state; straight-line swimming and body twisting deviate from the normal state and correspond to a subnormal state; stationary swaying and body contraction correspond to an abnormal state. Therefore, the individual state level of dragonfly larva L001 is determined to be subnormal. Output this level and record it.

[0049] Further, S4 includes: Initialize the counter for this biological group, which contains three counting units, corresponding to the normal state, subnormal state and abnormal state respectively; Iterate through each individual organism in the biological group, and increment the corresponding counting unit by one unit according to the individual status level determined by S3; After the traversal is complete, calculate the total number of individuals in this biological group; Divide the count value of each counting unit by the total number of individuals to obtain the proportion of individuals in a normal state, the proportion of individuals in a subnormal state, and the proportion of individuals in an abnormal state in this biological group. Arrange the three proportions in the order of normal state, subnormal state, and abnormal state to form the state distribution vector of this biological group.

[0050] In this embodiment, shrimp species in the Qingxi River are taken as an example; First, a counter is initialized for the shrimp biological group. This counter is represented in computer memory as three independent integer variables: normal_count = 0, subnormal_count = 0, and abnormal_count = 0. These three variables correspond to the counts of normal, subnormal, and abnormal states, respectively.

[0051] The status level of each identified shrimp individual has been determined through the processing described in claims 3 and 4. Assume that a total of 80 individual shrimp were detected and tracked in the acquired images, each shrimp having a unique identifier such as S001 to S080. The status results of these 80 shrimp are then iterated through.

[0052] The traversal process is executed in the order of the identifier numbers: Take out S001, whose status level is normal. Execute the operation: normal_count = normal_count + 1, at which point normal_count becomes 1.

[0053] Take out S002, whose state level is subnormal. Execute: subnormal_count = subnormal_count + 1, and subnormal_count becomes 1.

[0054] Remove S003; its status level is abnormal, and abnormal_count becomes 1.

[0055] Continue iterating until S080. Assume that after the iteration, normal_count = 35, subnormal_count = 28, and abnormal_count = 17.

[0056] Calculate the total number of individuals in the shrimp group. Total number of individuals = normal_count + subnormal_count + abnormal_count = 35 + 28 + 17 = 80.

[0057] Calculate the proportion of each state: The proportion of individuals in normal condition = normal_count / total number of individuals = 35 / 80 = 0.4375.

[0058] The proportion of subnormal individuals = subnormal_count / total number of individuals = 28 / 80 = 0.35.

[0059] The percentage of individuals in abnormal condition = abnormal_count / total number of individuals = 17 / 80 = 0.2125.

[0060] These three proportions are arranged in a fixed order of normal, subnormal, and abnormal to form the state distribution vector of the shrimp biological group: [0.4375, 0.35, 0.2125]. This vector is stored in computer memory for subsequent use in constructing the state matrix. For other biological groups such as fish and dragonfly larvae, the exact same initialization, traversal, counting, proportion calculation, and vector arrangement operations are repeated to obtain their respective distribution vectors.

[0061] Further, S5 includes: A fixed order of biological groups is pre-defined, which is arranged from low to high trophic level of the organisms in the river water, or from small to large individual organism size. The state distribution vectors of each biological group are extracted in this fixed order, and the extracted state distribution vectors are used as a row of the current state matrix. The current state matrix has three columns: the first column is the proportion of normal states, the second column is the proportion of subnormal states, and the third column is the proportion of abnormal states. When a certain biological group is not present in the river water, all components of the state distribution vector corresponding to that biological group are set to zero.

[0062] In this embodiment, three biological groups in the Qingxi River are taken as examples.

[0063] A fixed order of biological taxa is predefined. This order is selected based on the organisms' trophic level in the river from low to high. Based on an ecological survey of the Qingxi River, the trophic order was determined as follows: First group – aquatic insect larvae such as dragonfly larvae; Second group – shrimp such as freshwater prawns; Third group – fish such as crucian carp. This order is stored in a configuration file and used in every processing operation.

[0064] The state distribution vectors of each biological group are extracted sequentially in the fixed order described above. This has been obtained from the embodiment of claim 5: The state distribution vector of dragonfly larvae is assumed to be [0.2, 0.4, 0.4], but the actual value is calculated based on counting.

[0065] The state distribution vector of shrimp is [0.4375, 0.35, 0.2125].

[0066] The state distribution vector of crucian carp is [0.6, 0.3, 0.1].

[0067] The extracted vector is used as a row in the current state matrix. The first row corresponds to the first biological group in the sequence, dragonfly larvae, so the first row is [0.2, 0.4, 0.4]. The second row corresponds to the second biological group, shrimp, so the second row is [0.4375, 0.35, 0.2125]. The third row corresponds to the third biological group, fish, so the third row is [0.6, 0.3, 0.1]. The current state matrix has a fixed number of three columns: the first column corresponds to the proportion of normal states, the second column corresponds to the proportion of sub-normal states, and the third column corresponds to the proportion of abnormal states. The matrix form is as follows: Row 1 Dragonfly larva: [0.2, 0.4, 0.4] Row 2 Shrimp: [0.4375, 0.35, 0.2125] Fish in row 3: [0.6, 0.3, 0.1] In another scenario, suppose no shrimp individuals are detected in the Qingxi River, for example, due to seasonal reasons causing shrimp disappearance. When performing the fourth step, the total number of shrimp individuals is 0. In this case, instead of performing proportional calculations, all components of the state distribution vector corresponding to this biological group are directly set to zero. That is, the shrimp state distribution vector is [0, 0, 0]. Then, the second row of the current state matrix becomes [0, 0, 0], while the other rows remain unchanged. This ensures that the matrix dimensions remain consistent, avoiding changes in the matrix structure due to missing biological groups.

[0068] Furthermore, referring to Figure 3 S6 includes: S61, Obtain a pre-stored reference matrix library, where each reference matrix corresponds to a river water pollution level, including no pollution level, light pollution level, moderate pollution level, and heavy pollution level; S62, retrieve an uncompared reference matrix from the reference matrix library as the current reference matrix; S63, calculate the difference between the element values ​​of the first row, first column, second column, and third column of the current state matrix and the element values ​​of the first row, first column, second column, and third column of the current reference matrix in turn to obtain the first absolute value of the difference, the second absolute value of the difference, and the third absolute value of the difference; S64, in row-major order, repeat S63 for each row and column of the current state matrix until the absolute value of the difference has been calculated for all rows and all columns of the current state matrix. S65, sum up the absolute values ​​of all the calculated differences to obtain the total difference value corresponding to the current reference matrix; S66, determine if there are any uncompared reference matrices in the reference matrix library. If there are, return to S62; otherwise, proceed to S67. S67. Arrange the total difference values ​​corresponding to all reference matrices in ascending order, and select the reference matrix with the smallest total difference value as the reference matrix that best matches the current state matrix.

[0069] In this embodiment, the following are included: S61: Retrieve the pre-stored reference matrix library. This library is stored in a specific folder on the computer's hard drive and contains four reference matrices, corresponding to four river water pollution levels: no pollution, slightly polluted, moderately polluted, and heavily polluted. Each reference matrix has 3 rows, the same number as the current state matrix, and corresponds to the same biological group order: dragonfly larvae, shrimp, and fish. Each reference matrix also has 3 columns, corresponding to the normal, subnormal, and abnormal proportions. For example, the no-pollution reference matrix is: First line: [0.9, 0.1, 0.0] Second line: [0.8, 0.2, 0.0] Third row: [0.7, 0.2, 0.1] The reference matrix for light pollution is as follows: First row: [0.6, 0.3, 0.1] Second line: [0.5, 0.4, 0.1] The third line: [0.4, 0.4, 0.2] The reference matrix for moderate pollution is as follows: First line: [0.3, 0.4, 0.3] Second line: [0.2, 0.4, 0.4] Third line: [0.1, 0.3, 0.6] The reference matrix for severe pollution is as follows: First line: [0.1, 0.2, 0.7] Second line: [0.0, 0.2, 0.8] Third line: [0.0, 0.1, 0.9] S62: Retrieve an uncompared reference matrix from the reference matrix library as the current reference matrix. The first reference matrix retrieved is the uncontaminated reference matrix.

[0070] S63: Calculate the difference between the elements in the first row and first column of the current state matrix and the uncontaminated reference matrix. The normal proportion of dragonfly larvae in the first row and first column of the current state matrix is ​​0.2, and in the first row and first column of the uncontaminated reference matrix it is 0.9. The difference is 0.2 - 0.9 = -0.7, and the absolute value is 0.7. Next, calculate the difference in the first row and second column: current is 0.4, reference is 0.1, and the absolute value of the difference is 0.3. Then, calculate the difference in the first row and third column: current is 0.4, reference is 0.0, and the absolute value of the difference is 0.4.

[0071] S64: Continue processing in row-major order. Second row, first column: Current value 0.4375, reference value 0.8, absolute difference 0.3625. Second row, second column: Current value 0.35, reference value 0.2, absolute difference 0.15. Second row, third column: Current value 0.2125, reference value 0.0, absolute difference 0.2125. Third row, first column: Current value 0.6, reference value 0.7, absolute difference 0.1. Third row, second column: Current value 0.3, reference value 0.2, absolute difference 0.1. Third row, third column: Current value 0.1, reference value 0.1, absolute difference 0.0. At this point, the absolute difference calculations for all 3 rows and 3 columns of the current state matrix have been completed.

[0072] S65: Sum the absolute values ​​of the nine calculated differences: 0.7 + 0.3 + 0.4 + 0.3625 + 0.15 + 0.2125 + 0.1 + 0.1 + 0.0 = 2.325. This value is the total difference corresponding to the uncontaminated reference matrix.

[0073] S66: Determine if there are any uncompared reference matrices in the reference matrix library. Currently, there are three uncompared reference matrices: mild, moderate, and severe. Therefore, return to S62. Retrieve the mildly contaminated reference matrix and repeat S63 to S65, calculating a total difference value of 1.125. Next, retrieve the moderately contaminated reference matrix and calculate a total difference value of 0.875. Finally, retrieve the severely contaminated reference matrix and calculate a total difference value of 1.950.

[0074] S67: Arrange the total difference values ​​corresponding to all reference matrices in ascending order: moderate pollution 0.875, light pollution 1.125, heavy pollution 1.950, no pollution 2.325. Select the reference matrix with the smallest total difference value, i.e., the moderate pollution reference matrix, as the reference matrix that best matches the current state matrix.

[0075] Further, S7 includes: The pollution level corresponding to the selected reference matrix is ​​converted into a text description, which includes four strings: no pollution, light pollution, moderate pollution, and heavy pollution. The total difference value corresponding to the pollution level is converted into a confidence indicator. The confidence indicator includes three types: high confidence, medium confidence, and low confidence. When the total difference value is less than a first preset threshold, the confidence indicator is high confidence; when the total difference value is between the first preset threshold and the second preset threshold, the confidence indicator is medium confidence; and when the total difference value is greater than the second preset threshold, the confidence indicator is low confidence. The text description is combined with the confidence indicator to form an evaluation record, and the evaluation record is output to the computer system's display interface or storage medium.

[0076] In this embodiment, a moderately polluted reference matrix has been selected as the best-matching reference matrix. The pollution level corresponding to this reference matrix is ​​moderate. This pollution level is then converted into a text description. The conversion process is as follows: a mapping table is maintained internally by the computer, where the key is the reference matrix identifier (e.g., ref_mid), and the value is the string "moderate pollution". The mapping table is searched based on the identifier of the selected reference matrix to obtain the string "moderate pollution".

[0077] Simultaneously, the total difference value corresponding to this pollution level, 0.875, is converted into a confidence indicator. The conversion rule is as follows: two preset thresholds are used, the first preset threshold being 0.5 and the second preset threshold being 1.5. Specifically: if the total difference value is less than 0.5, the confidence indicator is high confidence; if the total difference value is between 0.5 and 1.5, the confidence indicator is medium confidence; if the total difference value is greater than 1.5, the confidence indicator is low confidence. The current total difference value is 0.875, which is greater than or equal to 0.5 and less than or equal to 1.5, therefore the confidence indicator is medium confidence.

[0078] The text description and confidence level indicator are combined into an evaluation record. The combination method is as follows: first write the text description, then the separator "|", and finally the confidence level indicator, forming the string "Moderate Pollution | Medium Confidence". This evaluation record is output to the computer's display interface: a dialog box pops up on the screen with the title "River Water Pollution Evaluation Result" and displays the string. Simultaneously, the evaluation record is appended to a log file named pollution_log.txt on a storage medium such as a solid-state drive, with each record including the current timestamp. If a printer is connected, the evaluation record can be printed.

[0079] Furthermore, when acquiring continuous images of multiple biological groups in the river water body in S1, the step of setting the shooting parameters of the underwater camera device is also included. The shooting parameters include the sampling frame rate and the single shooting duration. The sampling frame rate is set to a value that can completely capture its movement cycle based on the movement speed of the smallest biological individual in the biological group, and the single shooting duration is set to the duration that can record at least one complete movement cycle. During the data collection process, the underwater camera device should be kept in a fixed position relative to the river water, and the optical axis of the underwater camera device should be kept perpendicular to the direction of the river flow.

[0080] In this embodiment, before the first step of data collection, the shooting parameters of the underwater camera device are set. First, information about the biological group is obtained: based on the preliminary survey of the Qingxi River, the smallest individual organism is a dragonfly larva, approximately 5 mm in length, with a movement speed of about 10 body lengths per second (50 mm per second). A complete movement cycle, from one tail swing to the next, takes approximately 0.5 seconds. Based on this information, the sampling frame rate is set: to fully capture its movement cycle, at least 15 sampling points are needed within each cycle. Therefore, the sampling frame rate is set to 30 frames per second (0.5 seconds × 30 frames per second = 15 frames). For larger fish, whose movement cycles are slower, 30 frames per second is sufficient for coverage.

[0081] Set the duration of each shot. To record at least one complete movement cycle, and considering that different biological groups may require multiple cycles to improve statistical reliability, the duration of each shot was set to 2 minutes and 120 seconds. For dragonfly larvae, 2 minutes contains approximately 240 movement cycles; for shrimp and fish, it is far more than one cycle.

[0082] During the data acquisition process, maintain a fixed position of the underwater camera relative to the river water. Specifically, mount the underwater camera on a tripod, embedding the bottom of the tripod into the riverbed sediment, and weigh it down with a heavy object such as lead blocks to prevent movement caused by water flow. Simultaneously, adjust the optical axis of the underwater camera, using a level and protractor to ensure that the optical axis is perpendicular to the river current direction, i.e., pointing towards the riverbank at a 90-degree angle to the current. This perpendicular orientation helps reduce lateral distortion of the organisms' movement trajectories caused by the water flow, resulting in images that more accurately reflect the spontaneous behavior of the organisms.

[0083] After setting up, start the camera device to begin capturing images. Do not change any shooting parameters during the capture process until 120 seconds have elapsed. The captured continuous images are directly sent to the first step of claim 1 for subsequent processing, without performing any preprocessing operations such as cropping, filtering, or enhancement on the images.

[0084] According to a second embodiment of the present invention, the present invention claims protection for a river water pollution assessment system, comprising: A memory that stores one or more programs, which, when executed by one or more processors, enable the one or more processors to implement the aforementioned method for assessing river water pollution.

[0085] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.

[0086] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated units described above can be implemented in hardware or as software functional units. The above are merely embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made based on the description and drawings of this application, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

[0087] The specific embodiments of the invention have been described in detail above, but they are only examples, and this application is not limited to the specific embodiments described above. For those skilled in the art, any equivalent modifications or substitutions to the invention are also within the scope of this application. Therefore, all equivalent changes, modifications, and improvements made without departing from the spirit and principles of this application should be covered within the scope of this application.

Claims

1. A method for assessing river water pollution, characterized in that, Includes the following steps: S1, which uses an underwater camera device to capture continuous images of multiple biological groups in the river; S2, for each biological group, identify the movement trajectory and body posture changes of each individual organism contained in the continuous images; S3. For each biological individual, match the movement trajectory pattern of the biological individual with each trajectory template in the pre-stored trajectory template set, and match the body posture change of the biological individual with each posture template in the pre-stored posture template set. Determine the individual state level of the biological individual based on the matching results. S4. For each biological group, calculate the distribution of individual state levels of all biological individuals within that biological group to obtain the state distribution vector of that biological group. S5, arrange the state distribution vectors of each biological group according to a fixed biological group order to construct the current state matrix; S6. Compare the current state matrix with each of the pre-stored reference matrices element by element, calculate the absolute value of the difference between the elements at the same position in the current state matrix and the reference matrices, and sum the absolute values ​​of the differences at all positions to obtain the total difference value. S7 selects the pollution level corresponding to the reference matrix with the smallest total difference value as the current pollution assessment result of the river water body.

2. The method according to claim 1, characterized in that, The S2 identifies the movement trajectory patterns of each individual organism within the biological group, including: Perform biological individual detection on each frame of continuous images and obtain the center point pixel coordinates of each biological individual; Connect the center pixel coordinates of the same biological individual in consecutive frames in chronological order to form a trajectory point sequence; Trajectory morphology features are extracted from the trajectory point sequence. These features include the curvature of the trajectory, the turning frequency of the trajectory, and the closure of the trajectory. The curvature is characterized by the change in the turning angle formed by three adjacent points in the trajectory point sequence. The turning frequency is characterized by the number of times the trajectory direction changes per unit time. The closure is characterized by the ratio of the spatial distance between the trajectory start point and the end point to the total length of the trajectory.

3. The method according to claim 1, characterized in that, The S2 identifies the changes in body posture of each individual organism within the biological group, including: For each biological individual detected in each frame of a continuous image, the contour is extracted to obtain the set of outer contour boundary points of the biological individual. Calculate the geometric parameters of the set of outer contour boundary points in each frame, including the elongation of the contour, the roundness of the contour, and the area of ​​the convex hull defect of the contour. The geometric parameters of multiple consecutive frames are arranged in chronological order to form a posture change sequence, where elongation represents the degree to which the organism's body is stretched, roundness represents the degree to which the organism's outline is close to a circle, and convex hull defect area represents the degree to which the organism's body is bent or contracted.

4. The method according to claim 1, characterized in that, S3 includes: The movement trajectory pattern of an individual organism is matched with each trajectory template in the trajectory template set. The difference between the trajectory direction angle sequence of the individual organism and the direction angle sequence of each trajectory template is calculated. The trajectory template with the smallest difference is selected as the matching trajectory template, and the movement type corresponding to the matching trajectory template is recorded. The changes in the body posture of an individual organism are matched with each posture template in the posture template set. The difference between the sequence of changes in the outline elongation rate, the sequence of changes in the outline roundness, and the sequence of changes in the convex hull defect area of ​​the individual organism and the corresponding sequence of each posture template is calculated. The difference of the three sequences is weighted and summed to obtain the comprehensive difference. The posture template with the smallest comprehensive difference is selected as the matching posture template, and the posture type corresponding to the matching posture template is recorded. Based on the combination of the motion type of the matching trajectory template and the posture type of the matching posture template, the individual status level of the organism is determined by referring to the preset status level mapping table. When the matching trajectory template is a straight swimming trajectory and the matching posture template is a body extension mode or a body still mode, the status level is normal. When the matching trajectory template is a curved swimming trajectory and the matching posture template is a body contraction mode, the state level is subnormal. When the matching trajectory template is a spiral swimming trajectory or a stationary swing trajectory and the matching posture template is a body twisting mode, the status level is abnormal. Other combinations correspond to subnormal or abnormal states depending on the degree to which the movement and posture types deviate from the normal pattern.

5. The method according to claim 1, characterized in that, S4 includes: Initialize the counter for this biological group, which contains three counting units, corresponding to the normal state, subnormal state and abnormal state respectively; Iterate through each individual organism in the biological group, and increment the corresponding counting unit by one unit according to the individual status level determined by S3; After the traversal is complete, calculate the total number of individuals in this biological group; Divide the count value of each counting unit by the total number of individuals to obtain the proportion of individuals in a normal state, the proportion of individuals in a subnormal state, and the proportion of individuals in an abnormal state in this biological group. Arrange the three proportions in the order of normal state, subnormal state, and abnormal state to form the state distribution vector of this biological group.

6. The method according to claim 1, characterized in that, S5 includes: A fixed order of biological groups is pre-defined, which is arranged from low to high trophic level of the organisms in the river water, or from small to large individual organism size. The state distribution vectors of each biological group are extracted in this fixed order, and the extracted state distribution vectors are used as a row of the current state matrix. The current state matrix has three columns: the first column is the proportion of normal states, the second column is the proportion of subnormal states, and the third column is the proportion of abnormal states. When a certain biological group is not present in the river water, all components of the state distribution vector corresponding to that biological group are set to zero.

7. The method according to claim 1, characterized in that, S6 includes: S61, Obtain a pre-stored reference matrix library, where each reference matrix corresponds to a river water pollution level, including no pollution level, light pollution level, moderate pollution level, and heavy pollution level; S62, retrieve an uncompared reference matrix from the reference matrix library as the current reference matrix; S63, calculate the difference between the element values ​​of the first row, first column, second column, and third column of the current state matrix and the element values ​​of the first row, first column, second column, and third column of the current reference matrix in turn to obtain the first absolute value of the difference, the second absolute value of the difference, and the third absolute value of the difference; S64, in row-major order, repeat S63 for each row and column of the current state matrix until the absolute value of the difference has been calculated for all rows and all columns of the current state matrix. S65, sum up the absolute values ​​of all the calculated differences to obtain the total difference value corresponding to the current reference matrix; S66, determine if there are any uncompared reference matrices in the reference matrix library. If there are, return to S62; otherwise, proceed to S67. S67. Arrange the total difference values ​​corresponding to all reference matrices in ascending order, and select the reference matrix with the smallest total difference value as the reference matrix that best matches the current state matrix.

8. The method according to claim 1, characterized in that, S7 includes: The pollution level corresponding to the selected reference matrix is ​​converted into a text description, which includes four strings: no pollution, light pollution, moderate pollution, and heavy pollution. The total difference value corresponding to the pollution level is converted into a confidence indicator. The confidence indicator includes three types: high confidence, medium confidence, and low confidence. When the total difference value is less than a first preset threshold, the confidence indicator is high confidence; when the total difference value is between the first preset threshold and the second preset threshold, the confidence indicator is medium confidence; and when the total difference value is greater than the second preset threshold, the confidence indicator is low confidence. The text description is combined with the confidence indicator to form an evaluation record, and the evaluation record is output to the computer system's display interface or storage medium.

9. The method according to claim 1, characterized in that, When collecting continuous images of multiple biological groups in the river water body in S1, the step of setting the shooting parameters of the underwater camera device is also included. The shooting parameters include the sampling frame rate and the single shooting duration. The sampling frame rate is set to a value that can completely capture its movement cycle based on the movement speed of the smallest biological individual in the biological group, and the single shooting duration is set to the duration that can record at least one complete movement cycle. During the data collection process, the underwater camera device should be kept in a fixed position relative to the river water, and the optical axis of the underwater camera device should be kept perpendicular to the direction of the river flow.

10. A river water pollution assessment system, characterized in that, include: A memory having stored one or more programs that, when executed by one or more processors, cause the one or more processors to implement a method for assessing river water pollution according to any one of claims 1 to 9.