Building facade segmentation is essential for smart city-related applications such as energy consumption simulation or urban planning. In this paper, we take advantage of the horizontal self-similarity feature of building texture and propose a building facade segmentation algorithm based on K-means classification. First, the building texture images are rectified to orthogonal projection. Then, texture pixels in each horizontal line are classified into line segments using the K-means method based on CIE color distance. Next, a graph is generated where the nodes represent line segments, and the edges are relatedly connected with color distance attribute of its two nodes. The connected nodes (neighbor line segments) with similar color are aggregated based on which the building main structures such as floors and tiles are detected. The novelty of the proposed method is that the K-means classification is applied to the building texture pixels in a horizontal line that can improve the classification accuracy and increase speed. According to the experimental results, the proposed algorithm can achieve over 90% accuracy on the test dataset compared with traditional methods.