The complexity and large volume of data from hyperspectral sensors have led to the consideration of more specialized and advanced methods of data analysis in order to extract information. One of the analyzes performed on hyperspectral images is target detection. With recent developments and the creation of images with high spatial resolution, it is necessary to use both spectral and spatial information to detect hyperspectral images. This research introduces a new method for building detection in hyperspectral images based on the marker-based hierarchical segmentation algorithm. In the proposed method, first, multilayer perceptron neural network (MLP) and support vector machine (SVM) classification algorithms were implemented and their results were combined. Then, the resulting map was used to select the markers and combine them with the marker-based hierarchical segmentation algorithm using the majority voting decision law. The above techniques were applied to a series of CASI image data taken from the urban area of Toulouse in southern France. The results of quantitative and qualitative evaluations show that the proposed method has improved the kappa coefficient by 33, 28, 19, and 17% compared to the spectral correlation similarity (SCS), spectral information divergence (SID), SVM, and MLP algorithms, respectively.