This paper proposes an effective algorithm for detecting and distinguishing defects in industrial pipes. In many of the industries, conventional defects detection methods are performed by experienced human inspectors who sketch defect patterns manually. However, such detection methods are much expensive and time consuming. To overcome these problems, a method has been introduced to detect defects automatically and effectively in industrial pipes based on image processing. Although, most of the image-based approaches focus on the accuracy of fault detection, the computation time is also important for practical applications. The proposed algorithm comprises of three steps. At the first step, it converts the RGB image of the pipe into a grayscale image and extracts the edges using Sobel gradient method, after which it eliminates the undesired objects based on their size. Secondly, it extracts the dimensions of the pipe. And finally this algorithm detects and identifies the defects i.e., holes and cracks on the pipe based on their characteristics. Tests on various kinds of pipes have been carried out using the algorithm, and the results show that the accuracy of identification rate is about 96% at hole detection and 93% at crack detection.
Visual defect detection has drawn increasing attention in recent years since it has been an important and complicated task in the field of computer vision. It has a wide range of application areas including automatic object detection, object surveillance activity analysis and human computer interaction. In this paper, an algorithm for detecting certain manufacturing errors that may arise in case of industrial pipes is developed, which the manufacturing company can then investigate and solve. The detection and identification of defects on industrial pipes is the most important step during the post manufacture inspection. Although, it can be performed manually by experienced human inspectors but such manual inspection of industrial pipes has a number of drawbacks including high costs, laborious, low efficiency and time consuming. Therefore, an image processing based algorithm for the detection of defects is proposed. Some systems for defect detection have already been developed as commercial products. However, since long time to cope with defect detection, several techniques have been proposed using image processing [1,2]. Abdel-Qader et al. developed a method by using wavelet transform, Fourier transform, Sobel filter, and canny filter in . Hutchinson et al. in  used a canny filter and the wavelet transform for defect detection. Another automated method has also been performed by Wu Xue-Fei, Bai Hua in . It is based on image processing, a defect feature extracting method under HSV color space. They have used QFCM (Quick Fuzzy C-Mean clustering) segmentation arithmetic. Another one among the proposed methods is based on morphological operation of underground pipe defects. Shivprakash Iyer and K. Sinha  used smoothing using morphological operation, segmentation using edge detection. Nowadays, extensive sophisticated researches are being performed all over the world. Recently, automatic defect and contaminant inspection system has been developed for inspecting the inner surface of Heating, Ventilation and Air Conditioning (HV AC) ductwork pipeline . In that paper instead of Sobel edge detection, they have used SUSAN edge detection where edges are detected by circular mask. Over there, seeded k-mean clustering approach has been used to classify features such as hole, crack and rust. But the feature extraction method used in this proposed work is different from those discussed till now. Another important application of image processing is the morphological segmentation based on edge detection captured by CCTV that is used by Tung-Ching Su et al . They have used the specific method to detect defects such as multiple fractures, debris, hole, collapse, open joint and so on. But they have not distinguished between defects, rather marked them only. Most of these algorithms are designed to detect cracks for underground pipes. However, for the pipes in the industries, these algorithms may not always perform accurately to distinguish the defects i.e., holes and cracks.
This proposed algorithm is divided into three sections. In the first section, it carries out some pre-processing in the whole image including gray scale conversion, edge detection and noisy object elimination. In the next section, the pipe is extracted from the whole image and in the last one, identification method is applied. In section one, the ROB image is converted to a gray scale image and then edge detection is done using Sobel gradient method . After applying Sobel gradient method , the resultant image may contain some noisy objects which can create erroneous results in the algorithm. To minimize their effect, these unwanted objects are eliminated according to their sizes. Then a bounding-box is generated to surround the pipe. [n the second section, fundamental morphological operation  is applied to describe about region shape and connect disjoint lines. Finally some fundamental features i.e., area and perimeter are calculated for each object. Afterwards the defects such as hole and crack are distinguished based on their area to perimeter ratio.
II. PROPOSED ALGORITHM
The proposed algorithm detects the defects in the industrial pipes through image processing. [t is arranged in three sections. First section is declared pre-processing, second one as extraction of pipe from background and third one is defect identification. Summary of our method is shown in below by a flowchart (Fig. 1).
The raw data (RGB image) acquired from digital camera are pre-processed for further data analysis. It includes the gray scale conversion , edge detection and elimination of noisy objects present in the raw image. The different data-processing stages are depicted below.
1) Edge detection: At the RGB image is converted to grayscale and then Sobel gradient algorithm  is applied to detect the sharp changes, to preserve the defects. Sobel edge gradient preserves the boundary of objects. The gradient is a vector and the components are measured in the x and y direction. The components are found using (I) and (2).
B. Extraction of Pipe
Pipe extraction is an important part of this algorithm. As noises in background create problems with the defects (hole and cracks), extraction of pipe from background is necessary. This section involves running through images pixel by pixel and performing numerous calculations using this pixel and its surrounding pixels. It is consists of three steps. From resulting edge image, algorithm eliminates unwanted objects. Then, a bounding-box is created surrounding the pipe for the presence of some noises in image. And last extraction of pipe from background is done. By extracting the pipe, test image is represented in a more appropriate manner for further processing. The proposed algorithm is elaborately described below.
1) Unwanted object elimination: First, defects and the boundary of objects are distinguished. Therefore, objects (some dots, some small objects and noises) remain in the foreground and background as shown in Fig. 5. The main purpose of this is to keep only the defects in the foreground. So, needless objects should be eliminated. Unwanted object elimination follows the following formulas (6).