In recent years, since flood disasters have brought immeasurable losses to the city, it is urgent to prevent and solve the flood of stagnant water. Considering the shortage of real-time and accuracy of hydrological analysis, Opencv technology is used in this paper to process the obtained data in real time. For improved Yolov5, BoTNet and GAMAttention Transformer are used to improve Yolov5 to enhance its ability of recognition and prediction to better identify surface gathered water. The prediction rate of the improved Yolov5 is 7.1% higher than that of Yolov7 and 1.7% higher than that of Yolov5.After that, contour preprocessing of the image is carried out through the cropping technology of the identification frame to eliminate relatively unstable factors. The principle of binocular distance measurement is used to measure the three-dimensional coordinates of the actual distance, better constrain the contour proportion of the picture, and then the Opencv technology is used to get the outline of the water, and HSV is combined with better color processing pictures for the identification of the water and contour generation, and the area is obtained to correspond to the corresponding parameters of flood to provide important help in flood prevention and storm drainage.