This paper introduces a related model of membrane calculation in the defect detection and positioning of industrial components. It has the characteristics of distributed and parallel computing, and can efficiently search for better solutions in a given feature space. Inspired by the membrane clustering algorithm, this paper proposes a greedy membrane clustering algorithm and names it GMCA. GMCA is applied after the extraction of local features of normal samples. It uses a greedy strategy to construct a sub-feature set that describes the local characteristics of normal samples. During training, GMCA can learn the membrane cluster center of normal image blocks and each sub-feature within the cluster. At test time, the anomaly map is obtained by calculating the distance from the test sample block to the corresponding cluster center and the maximum distance from the cluster center to the nearest neighbor in the training sample. This solves the limitation of traditional algorithms requiring dataset alignment. In the unsupervised dataset MvTec AD, samples can be divided into object categories and texture categories according to the background of images. The pixel-level anomaly location index (AUROC) of this method on object category data reaches 98.3%. The image-level anomaly detection index (AUROC) on texture category data reaches 99.1%.