MATLAB DETECTION OF SHADOWS IN IMAGE OF PROFILOMETRY

This paper deals with shadows detection and removal of its influence in profilometry. The proposed algorithm was developed in MATLAB. Elimination of shadows has a crucial effect to the function of unwrapping phase. Unwrapping of phase (one part of the profilometry procedure) can fail when no shadow detection is used. Among other basic operations, morphological operations are used in this algorithm. Finally, the obtained results are evaluated and discussed. The aim of consequent research is to improve the quality of depth map by using profilometry. 1 Principle of fringe pattern profilometry using phase shifting In general, under the term profilometry belong all methods dealing with searching profile. We can divide profilometry into contact and non-contact. Currently, non-contact profilometry is mostly used. Fringe pattern profilometry belongs to coherent optical methods. The fundamental idea is projection of a fringe pattern onto the scanned object. Additional information is given by projection. Subsequently, using the obtained images, change of phase is evaluated. Changing the phase provides information about the depth distribution of a scene. A detailed description of this method can be found in many articles and books (e.g. [1], [2], [3]). A schematic plan of the measuring workplace is shown in Fig. 1. Figure 1: Profilometry: Schematic plan of the workplace for the depth map measuring. We can obtain information about phase using various approaches (phase-shift, Fourier transform and spatial phase detection). We employ phase shift profilometry in our project. This method works with eight pictures. Four of them are pictures of the object (example in Fig. 2) and other pictures are of the reference plane (example in Fig. 2). During measuring phase of pattern is changed. Flowchart of method phase shifting is given in Fig. 2. Main equation of this approach is given by relation (1) [14] as ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )⎟ ⎟ ⎠ ⎞ ⎜⎜ ⎝ ⎛ − ⋅ − + − ⋅ − − ⋅ − − − ⋅ − = − = 4 2 4 2 3 1 3 1 4 2 3 1 4 2 3 1 arctan , , , R R I I R R I I I I R R R R I I y x y x y x r m φ φ φ , (1) where I , I I I are pictures of the object and R , R R R are pictures of the reference plane. 1 2, 3, 4 1 2, 3, 4 This computation is executed in block “Calculation of wrapped phase”. Output from this step is phase in range -π to π, in which wraps occur (rapid phase shifting 2π). Unwrapping is a procedure whose aim is to take away 2π wraps (phase discontinuities) and obtain a continuous phase map. Let's notice that Unwrapping is the most difficult step of the whole method. We adopt the method Unwrapping via Graph Cuts [4]. Unfortunately, the algorithm fails in shadow regions. Whereas that the algorithm has a problem to cope with too frequent false wraps arising in a shadow. Therefore we must detect shadows and eliminate their influence. 2 Shadows detection and elimination Some specific properties arise from the use of profilometry. As we have more pictures with different content available, we can propose specific algorithms. We consider the original picture of scene (further called Object), additionally we have the picture with the projected pattern (further called Object_pattern) and picture with pattern projected to background (further called Pattern). Another important fact is that we have depth map created by the stereo method (further called Depth_stereo). We would like to improve this map by using profilometry. A similar approach was published by Scharstein and Szeliski [5]. Detection of shadow is often solved in video. In this case we have several consecutive pictures. Therefore, the shadow detection methods for video are based on finding differences between consecutive images or comparing an average picture with the actual image. Most methods are based on thresholding techniques. We can find many interesting approaches in literature (e.g. [6], [7], [8], [9], [10], [11], [12] and [13]). We propose two new methods for shadow detection. Figure 2: Flowchart of the Fringe pattern profilometry. Flowchart of the first method is given in Fig. 3. First we calculate the difference between images Object and Object_Pattern. The idea of this is that in shadows the difference will be minimal and will arise in areas with constant intensity. In rest of the picture a visible fringe pattern remains. The result is shown in Fig.6. Obviously, if we would like to detect shadows we have to do other operations. It is impossible to use a simple threshold at this moment, because there are disturbing artifacts in the image. Artifacts would be evaluated incorrectly as shadow regions. Two different problems arise. First of them arises in pixels where both pictures (Object and Object_Pattern) have high brightness. This means that the difference is low as in shadow areas. Therefore, we use the following pseudocode If (Pattern > Threshold_Projection )