Carpal Tunnel Syndrome (CST) is a form of peripheral neuropathy that affects a significant number of people. It is triggered by the compression of the median nerve in the wrist. CTS has recently been diagnosed using ultrasonography. This article presents a method that employs an edge-morphology detection approach to extract the structural feature of the median nerve from ultrasound images to permit automated segmentation of the median nerve. Pre-processing is applied to reduce the associated noise to boost the sensitivity and increase the accuracy of the model in segmenting the median nerve in ultrasound images. When tried on the test images, the suggested model performed well, with average precision, recall, F-score, and Jaccard similarity values of 0.87, 0.93, 0.76, and 0.93, respectively. Furthermore, a strong correlation of Cross-Sectional Area (CSA) between the ground truth and the segmented image of 0.962 is observed, allowing this model to serve as a useful initial screening tool to expedite the detection, diagnosis, and assessment of CTS in clinical practice.