Human visual system is a crucial component of the nervous system, enabling us to perceive and understand the surrounding world. Advancements in research on the visual system have profound implications for our understanding of both biological and computer vision. Orientation detection, a fundamental process in the visual cortex where neurons respond to linear stimuli in specific orientations, plays a pivotal role in both fields. In this study, we propose a novel orientation detection mechanism for local neurons based on dendrite computation, specifically designed for grayscale images. Our model comprises eight neurons capable of detecting local orientation information, with inter-neuronal interactions facilitated through nonlinear dendrites. Through the extraction of local orientation information, this mechanism effectively derives global orientation information, as confirmed by successful computer simulations. Experimental results demonstrate that our mechanism exhibits remarkable orientation detection capabilities irrespective of variations in size, shape, or position, which aligns with previous physiological research findings. These findings contribute to our understanding of the human visual system and provide valuable insights into both biological and computer vision. The proposed orientation detection mechanism, with its nonlinear dendritic computations, offers a promising approach for improving orientation detection in grayscale images.