Bubble sizes are generated by micro-bubble generators (MBGs) in the water for their effect on the percentage of dissolved oxygen in the water and we find this in aquaculture where oxygen is important to marine life and in many applications. And since these bubbles range in size from 20 to 50, we need to highlight the shape of the bubble and distinguish it, so two Sobel algorithms were used and the Canny method was improved and compared between them, where the edge detection algorithm is sensitive to noise, and therefore, it is easy to lose weak edge information when filtering noise, and it appears ts fixed parameters are weak adaptability. In response to these problems, this paper proposed an improved algorithm based on the Canny algorithm. This algorithm introduced the concept of gravitational field strength to replace the image gradient and obtained the gravitational field strength factor. Two methods for choosing the adaptive threshold based on the average image gradation The size and standard deviation of two types of model images (one containing less edge information, the other containing rich edge information) were subtracted, respectively. The improved Canny algorithm is simple and easy to achieve. Experimental results show that the algorithm can retain more useful information and is more robust in the face of noise.