Due to the American cancer society, many people with esophageal adenocarcinoma are not survived. The treatment rate can be significant in the early detection of Barrett's esophagus (BE) as a premalignant stage for adenocarcinoma. An important landmark to detect BE is the Z-line. BE segmentation is already highly dependent upon the operator's knowledge and skill. The main aim of this study is automatic Z-line extraction using endoscopic images leading to segmentation of the early BE stage. To this end, a computer-aided detection method exploiting k-means clustering, image segmentation using the edge detector, and a novel boundary linking algorithm is proposed. For the evaluation, the gold standard is considered the average contours of Z-lines extracted by the three experts. The proposed method annotated the Z-line with the accuracy and precision of 0.92 and 0.87, respectively, and the value of the average boundary distance is 5.9 pixels. To the results and visual inspection, the presented method can be used for efficient and robust extraction of the Zline at the early BE stage. Furthermore, it can be used in other medical imaging applications with complex boundaries and low contrast in the images, limiting the common automatic boundary detection methods.