Study on Effect of Lighting Variations in Edge Detection of Objects using Machine Vision System

Download Full-Text PDF Cite this Publication

Text Only Version

Study on Effect of Lighting Variations in Edge Detection of Objects using Machine Vision System

R Manish

M Tech Mechatronics, School of Mechanical Engineering,

VIT University,

Vellore 632 014, Tamil Nadu, INDIA.

Dr. S. Denis Ashok

Professor, Mechatronics Branch School of Mechanical Engineering, VIT University,

Vellore 632 014, Tamil Nadu, INDIA.

Abstract – An approach towards understanding the effect of lighting conditions on edge detection using machine vision for a mild steel circular shaft specimen is presented in this paper. The gray scale intensity distribution on the image is observed using pixel level values. Canny Edge detection algorithm is implemented and the results are compared visually to observe the edge detection under differing lighting intensities. An experimental setup is proposed as a base for further research work on object identification under dynamic lighting conditions

Keywords – Gray Scale Values, Histogram Intensities, Canny Edge, Lighting Intensity (Lux), Mild Steel Object, Machine Vision Inspection, Open CV.


    Machine vision applications are now-a-days significantly implemented [1] [2] in many key areas [3] such as manufacturing, inspection, sorting and packaging industries. With the advancement of Automation technology, there has been a rising demand from the consumer industry for obtaining manufactured components with a high degree of precision. As compared to the conventional and currently existing Lathe machines, the use of CNC machines is increasing rapidly worldwide among the top global manufacturers for production process and also for obtaining good quality finish while machining the metallic and non metallic components. To aid the precision engineering techniques, machine vision systems are used as a supporting equipment to obtain accurate level of boundary finish for the machined/ welded components [4]. The significance of such vision based systems is that they can capture fine details such as boundary contours [5], in (Image Pixels) which most cases cannot be observed by a human vision, when employed on a fast moving production line. By using such supporting vision setups, Production and Inspection process can be integrated and on a whole partially automated [6] by employing only few skilled and trained employees who can monitor online [8] the entire process. Thereby reducing the excess labor costs and a large number of manual inspection processes. Another Important parameter for the vision system to function in an optimum manner is the lighting conditions. They are considered to be very crucial for any kind of inspection process. Hence an optimum integration of

    Machine Vision and Lighting System is an uttermost necessity for any process/ wear inspection [6] in a manufacturing unit. Industries which manufacture Fabrics also use machine vision based techniques to determine defects [2]. LED ring lighting is the standard illumination source which is used in process inspection of water bottles, Beverage cans etc. on a conveyor belt which handles the material movements from one process section to another in the shop floor. Front Lighting is used in most of the industries for observing the surface features and detecting the boundary characteristics of the manufactured objects [8]. Considering that sometimes due to different constraints, the inspection environment is in a closed and controlled area, appropriate illumination conditions need to be maintained. Another Key feature is that it is also possible to conserve power, when the correct illumination requirements are met. This paper discusses about implementing a machine vision based edge detection using variable lighting conditions. Image processing is the fundamental part of any vision based application. Here in our paper, Canny Edge algorithm [7] is implemented for detecting the edges of a mild steel shaft specimen under changing lighting intensities. A Lux meter is utilized for finding out the lighting on the object surface. There by giving an understanding between the lighting requirements and the object boundary detection. Mono color gray scale camera along with its supporting hardware module is used to capture the image and Open CV software is used to process for the edge detection using Canny Algorithm for the different sets of images obtained. The results are visually compared and using the gray scale pixel intensity values plotted on a histogram, an understanding is reached with regards to choosing the optimum range for lighting intensity needed for edge detection using a camera with a fixed object distance.


      1. Components & Experimental Setup:

        Gray scale images are faster to process in any machine vision system, Hence grayscale image processing hardware and camera modules are widely used in most of the industries for obtaining digital image of the feature object. Here in our experimental setup, A CMOS Area

        Scan Gray Scale Camera (Marlin make) shown below in Fig 1, is used.

        Fig 1: Camera

        Table 1: Camera Specifications


        CMOS Sensor

        Picture Size

        800 x 600 Pixels


        8 Bit

        Lens Mount

        C Mount

        Digital Interface

        IEEE 1394

        Gain Control

        0 -16 dB (Manual)

        Shutter Speed


        Power Consumption

        Less than 3W at 12V DC

        Operating Temperature

        +5 to +45 Degrees Celsius

        Lighting Equipment:

        The system consists of an LED ring lighting module (Advanced Illumination make). This is a ring light, consisting of 60 LEDs in a circular pattern within the casing. This is mounted on the lens of the camera. Shown below in figure 2 is the lighting module used for illumination.

        Fig 2: LED Ring Lighting Module

        Table 2: Lighting System Specifications


        LED Lighting

        No. of LEDs


        IP Rating


        Operating Voltage

        0-24 Volts

        Operating Temperature

        0 to +60 Degrees Celsius


        The camera and object surface distance is kept constant at 54 cm. The object is a mild steel shaft of 14 mm diameter. The camera is vertically mounted, with the red

        LED ring light (AI RL 4260 make) around it to illuminate the required region as shown in Fig 3 below.

        Fig. 3 Experimental Setup

        The frame grabber along with its corresponding hardware and software modules are integrated in the PC and are used to capture and store the images. Open CV software is used to post process the images and observe the edge images using Canny Algorithm. The resolution of the images are 800×600 i.e. 480000 pixels in every image captured. The intensities obtained are in gray scale values ranging from 0-255. Values 0 being black and 255 being white.

      2. PROCEDURE:

        The experimental procedure is as follows:

        Choose an appropriate background

        Fix the camera- object distance as per requirements

        Assemble and connect the LED ring lighting setup around the camera

        Vary the lighting Intensities using a voltage regulator

        Read the intensity values using a lux meter

        Capture grayscale images under varying intensity vales

        Canny Edge Algorithm to observe the edges

      3. Canny Edge Algorithm:

    Canny edge algorithm [7], is a multi-stage edge detector algorithm, which processes the images for sharp edges based upon the set upper and lower threshold values. Detects the edges and outputs the proper edge detected feature image. The stages are:

    1. Image Smoothing: The image is filtered from potential noise. The most commonly used kernel for image smoothing in canny edge is Gaussian blur.

    2. Gradient Finding: Gradients are regions in image where there is a potential jump in the gray scale values, which gives a good indication of an edge. They are found out by running Sobel Masks in horizontal (Gx) and vertical directions (Gy) across the image grid. The mask is a 3*3 Matrix as shown below:

      These kernels are convolved on the gray scale image pixel grid which has the corresponding intensities of the object as well as background. The magnitude is an indicator of edge strength and direction is an indicator of edge

      direction. They are calculated by using the below given formulae:

      Magnitude: G= ((Gx)2 + (Gy)2 ) Direction/ Orientation: = Arctan(Gy/Gx)

    3. Non Maxima Suppression: Only the local Maxima are marked as edges and the rest pixels are ignored.

    4. Tresholding: Potential Edges are detected.

    5. Hysteresis Edge Tracking: Only strong edges that are connected are detected and other pixels which are not connected to the strong edge is neglected.

      Canny edge is still the widely used edge detection operator even today. This is mostly attributed to the following:

      1. Noise in image is minimized at the first stage, thereby giving an image which has un-corrupted useful data

      2. Only strong edges in the image are traced and the remaining region is blackened, The output is a display of white contours, representing correct edges in the image.

      3. Pseudo edges are filtered in hysteresis tresholding stage and hence giving only the required object edge in the image.


    Images of Canny Edge Detected (Left) and Grayscale Image (Right) under different lighting conditions

    Fig 2a Object Detection at 7.9V Fig 2b Object Detection at 8.1V Fig 2c Object Detection at 8.3V

    Fig 2d Object Detection at 8.5V Fig 2e Object Detection at 8.7V Fig 2f Object Detection at 8.9V

    Fig 2g Object Detection at 9.1V Fig 2h Object Detection at 9.3V Fig 2i Object Detection at 9.5V

    Table 3: Histogram for the above Gray scale Images.

    Table 4: Pixel Intensity Distribution Table for the above Histogram is shown below:


    It is observed from the Table 4, that as the lighting intensity increases, the gray level values of all the pixels also show a corresponding increase. The pixels in the image tend to shift from the darker region towards the brighter region of the gray scale range. From the figures 2b and 2i, shown above, it is observed that at whenever the pixel intensity values are distributed narrowly at either ends of the gray level range, the object edge cannot be detected properly, this is attributed to the fact that there is either very low or very high lighting intensity projected on the surface of the object and the corresponding region. In both these cases, there is either insufficient reflection from the object surface or very high reflection from the object surface which makes the object not clearly distinguishable from the background. Thus an optimum range of lighting is chosen for the object to be detected along with its

    boundary. The above histogram table 4, gives us an understanding that between a lighting range of 8.3V to 9.3V, the object edge is detected properly.

    Images under different lighting intensities:

    Gray scale images captured under different lighting conditions (expressed as voltage intensity) are shown in Fig. 2 (a to i). Experimentation has shown that when there is a change in the lighting intensity, a significant change in the gray scale intensity values is noticed and a better boundary detection features are observed. The table which relates the lighting intensity values in voltages to the corresponding Lux is shown in Table 5 below:

    Table 5: Conversion of Units (Voltage to Lux)

    Ring light intensity (V)

    Lux meter reading (Lux)



















    It is further observed that when Canny Edge Algorithm is implemented with a fixed Lower to Upper Threshold ratio (1:3) and with a threshold values TL = 50 and TH = 150, for all set of images, The results show that traces of edges are detected only at 8.1V intensity, and at 9.5V intensity, the edge tends to deplete and as the intensity is further increased the entire image becomes white and there is no distinction between the object and the image. Hence it can be understood that by setting a few parameters (camera- object distance, gray level threshold ratios) constant, the mild steel shaft contour can be detected in between a certain range of lighting intensities. This way, a novel approach is presented to understand the circular shaft edges using machine vision and edge detection algorithm.

    Gray Scale Pixel Intensity Variations:

    It is observed that as the lighting intensity varies, the gray scale values of all the pixels in the digital image also tend to change proportionally. Here in our experiment it has been observed that as the lighting intensity of the background (for a fixed illumination source and background distance) increases from a dark lighting at 0 Lux to a bright lighting 110 Lux, The background pixels show a progressive change in the gray scale values from 0 to 255. And as mentioned above in section 3.1, the object and background cannot be distinguished in complete dark conditions and bright conditions. i.e. when the object and background grayscale intensities are very near in the darkest region of gray (0 to 15) or very near in the brightest region of gray(240 to 255).


    It can be understood from this research work, that lighting conditions play a very important role in identifying edges and boundaries of objects. Further, it is also understood that excess lighting or insufficient lighting are the two intensity ranges which should be avoided. The intensity of lighting is an important characteristic when we take power consumption into consideration. Much electricity can be conserved by using only the required lighting intensity. This especially is true in industries using machine vision equipment for online process monitoring.

    From this research, the following can be concluded:

        1. Optimum Illumination is necessary to distinguish object from background.

        2. Object Boundary/ Edge detection is completely dependent on the lighting conditions.

        3. Canny edge algorithm gives a good response while detecting edges of object in an image


The Authors would like to thank VIT University, Vellore for providing the Lab facilities and Department of Science and Technology(DST) & Science and Engineering Research Board(SERB), New Delhi India, for providing the research funding. Reference No. SB/FTP/ETA- 276/2012, under fast track young scientists scheme, to develop the machine vision setup for spindle radial error measurements.


        1. Chan, J. P., & Palmer, G. S. (1995, May). Machine vision- applications in industry. In Appliction of Machine Vision, IEE Colloquium on (pp. 1-1). IET.

        2. Kumar, A. (2008). Computer-vision-based fabric defect detection: a survey.Industrial Electronics, IEEE Transactions on, 55(1), 348-363.

        3. Davies, E. R. (2004). Machine vision: theory, algorithms, practicalities. Elsevier.

        4. Hou, X., & Liu, H. (2012, August). Welding image edge detection and identification research based on Canny operator. In Computer Science & Service System (CSSS), 2012 International Conference on (pp. 250-253). IEEE.

        5. Ren, M., Yang, J., & Sun, H. (2002). Tracing boundary contours in a binary image. Image and vision computing, 20(2), 125-131.

        6. ZHAO, L. H., ZHANG, J. C., & NING, S. R. (2012). Experimental research on micro tool wear measurement based on machine vision [J]. Manufacturing Automation, 10.

        7. Canny, J. (1986). A computational approach to edge detection. Pattern Analysis and Machine Intelligence, IEEE Transactions on, (6), 679-698.

        8. Peng, X. K. Y. C. Z. (2009). Technology of On-line Surface Inspection for Hot-rolled Steel Strips and Its Industrial Application [J]. Journal of Mechanical Engineering, 4, 021.

        9. Batchelor, B. G., & Whelan, P. F. (1981). Selected papers on industrial machine vision systems. Proc. IEEE, 69(12), 1524- 1538.

        10. Newman, T. S., & Jain, A. K. (1995). A survey of automated visual inspection. Computer vision and image understanding, 61(2), 231-262.

        11. Hornberg, A. (Ed.). (2007). Handbook of machine vision. John Wiley & Sons.

        12. Chin, R. T., & Harlow, C. A. (1982). Automated visual inspection: A survey.Pattern Analysis and Machine Intelligence, IEEE Transactions on, (6), 557-573.

        13. Al-Kindi, G. A., Baul, R. M., & Gill, K. F. (1992). An application of machine vision in the automated inspection of engineering surfaces. The International Journal of Production Research, 30(2), 241-253.

        14. Kumar, R., Kulashekar, P., Dhanasekar, B., & Ramamoorthy, B. (2005). Application of digital image magnification for surface roughness evaluation using machine vision. International Journal of Machine Tools and Manufacture, 45(2), 228-234.

Leave a Reply

Your email address will not be published. Required fields are marked *