With the development of economy and technology, the increasing discharge of industrial and agricultural production wastes leads to the continuous deterioration of the water environment in the sea area. The biological monitoring method can carry out online continuous monitoring of the water body, and the operation is simple. The target detection and tracking algorithm of moving targets in video monitoring has been relatively mature, the processing and analysis of the data obtained after moving target detection and tracking has gradually become a hot spot in the field. In this paper, the CCD camera is used to continuously and automatically monitor the behavior of aquatic organisms, and the image recognition system is used to obtain relevant behavior data in real time. Through the abnormal analysis of the behavior of moving targets in video monitoring through computer machine vision, the behavior model of moving targets can be established to find similar tracks or search for abnormal tracks from many tracks, define a suitable similarity to determine the similarity or difference of trajectories. As one of the most important characteristics of the moving target behavior, the motion trajectory information of the target organism can be used as the characteristic of discovering the abnormal behavior of the moving target in video monitoring for the first time. According to the "escape behavior" generated by the indicating organism in the first time, the online biological monitoring of heavy metal pollution can be realized. This paper also discusses and analyzes the behavioral response of zebrafish under the stress of various heavy metals and the toxic mechanism of heavy metals in fish, so as to provide toxic basis and internal basis for the reliability and feasibility of water quality monitoring and early warning by using fish behavioral response. The results of several groups of experiments show that it is feasible to use the movement behavior changes of zebrafish for early warning of sudden water pollution. The method is fast, simple and cheap.