Computer vision is an area have proven to play an essential role in urban and rural applications like medical, agriculture, and remote sensing. The use of image processing methods for simulating the visual capability of robots plays a crucial role in the consolidation of smart farming. The under- standing of the complexity of outdoor environments, where the robot performs its task, is an essential issue for the development of efficient processes of autonomous mobility, especially in areas with uneven illumination, unpredictable weather conditions, and different color shades. In this study, we present a new method to detect and segment tree trunks from unstructured environments where natural properties such as lighting and terrain shape form a variety of non-controlled conditions. We prepared a dataset with stereo image pairs and ground truth maps to calculate disparities and to evaluate the proposed method in the application of smart farming. The results show that the presented approach can segment trees with high precision, which is an important step in calculating the disparity of external components by systems that use the stereoscopic view.