The traditional canny edge detection algorithm has its limitations in the aspect of antinoise interference, and it is susceptible to factors such as light. To solve these defects, the Canny algorithm based on morphological improvement was proposed and applied to the detection of agricultural products. First, the algorithm uses the open and close operation of morphology to form a morphological filter instead of the Gaussian filter, which can remove the image noise and strengthen the protection of image edge. Second, the traditional Canny operator is improved to increase the horizontal and vertical templates to 45° and 135° to improve the edge positioning of the image. Finally, the adaptive threshold segmentation method is used for rough segmentation, and on this basis, double detection thresholds are used for further segmentation to obtain the final edge points. The experimental results show that compared with the traditional algorithm applied to the edge detection of agricultural products, this algorithm can effectively avoid the false contour caused by illumination and other factors and effectively improve the antinoise interference while more accurate and fine detection of the edge of real agricultural products.