With the progress of agricultural technology and the continuous development of agricultural machinery, the importance of intelligent navigation technology is increasingly prominent. This paper studies the linear driving and visual navigation technology of agricultural machinery. Based on the analysis of Hough transformation in the straight-line driving of agricultural machinery, the working principle of the straight-line visual navigation of agricultural machinery is described. In view of image segmentation in visual navigation, the gray value segmentation method is used to segment the agricultural land image on OpenCV, observe and analyze the experimental image, and analyze its feasibility. Through the study of threshold segmentation, region and growth segmentation and neural network segmentation, the advantages and disadvantages of gray value segmentation are compared.