Selective laser melting (SLM) has been attracting a growing interest in different industrial sectors as it is one of the key technologies for metal additive manufacturing (AM). Despite the relevant improvements made by the SLM technology in the recent years, process capability is still a major issue for its industrial breakthrough. As a matter of fact, different kinds of defect may originate during the layerwise process. In some cases, they propagate from one layer to the following ones leading to a job failure. In other cases, they are hardly visible and detectable by inspecting the final part, as they can affect the internal structure or structural features that are difficult to measure. This implies the need for in-process monitoring methods able to rapidly detect and locate defect onsets during the process itself. Different authors have been investigating machine sensorization architectures, but the development of statistical monitoring techniques is still in a very preliminary phase. This paper proposes a method for the detection and spatial identification of defects during the layerwise process by using a machine vision system in the visible range. A statistical descriptor based on principal component analysis (PCA) applied to image data is presented, which is suitable to identify defective areas of a layer. The use of image k-means clustering analysis is then proposed for automated defect detection. A real case study in SLM including both simple and complicated geometries is discussed to demonstrate the performances of the method.