Continuous improvement of product quality is essential to the success of manufacturing enterprises. In-process inspection plays an important role in improving product quality control of mass produced products. The change that has occurred in traditional mass production, i.e., the change from dedicated manufacturing to reconfigurable and flexible manufacturing, has increased the demand for computer integrated manufacturing (CIM). Automated inspection serves as a key component of CIM, for example, detecting and measuring surface flaws. Today, inspection of surface flaws is mainly performed on sheet metal, paper, glass, rags, etc. These objects are flat in nature and do not include 3D features or edges of features. However, structural parts which are produced using casting process are complicated and are composed of a large number of features. When these parts are machined (flat milled) porosity defects arise in addition to surface flaws such as scratches and texture defects. Porosity defects arise on the surface when the cutting tool cuts through an air bubble (pore void) created during casting. In many applications, inspection and accurate measurement of porosity flaws, within the capabilities of the measuring device, is essential and crucial to determine the ability of the product to function well. In this paper we present a technique for measuring the correct size of a pore using a low value threshold, to avoid false detection, miss detection and underestimation of pore size. Also we present two algorithms for detecting edge-connected pores which are pores on the edge of features. Detection is done without the use of a feature data base. One of the edge-connected pore detection algorithms uses basic morphological operations for determining the locations of the pores, while the other algorithm uses curve analysis for the same purpose. The feasibility of the proposed porosity measurement technique and edge-connected pore detection algorithms is demonstrated and validated on the joint face of an engine cylinder head.