A dynamic masking technique for combined ... - CiteSeerX

6 downloads 0 Views 778KB Size Report
Aug 23, 2005 - INSTITUTE OF PHYSICS PUBLISHING ... both density gradients and velocity. ... velocity and density in fluids through the combination of the.
INSTITUTE OF PHYSICS PUBLISHING

MEASUREMENT SCIENCE AND TECHNOLOGY

doi:10.1088/0957-0233/16/10/010

Meas. Sci. Technol. 16 (2005) 1954–1960

A dynamic masking technique for combined measurements of PIV and synthetic schlieren applied to internal gravity waves J K Sveen and S B Dalziel Department of Applied Mathematics and Theoretical Physics, University of Cambridge, Wilberforce Rd, CB3 OWA, Cambridge, UK E-mail: [email protected]

Received 18 January 2005, in final form 17 April 2005 Published 23 August 2005 Online at stacks.iop.org/MST/16/1954 Abstract We present a novel technique for dynamically masking images for synthetic schlieren, a recently developed technique for measuring density gradients in fluids. Synthetic schlieren uses pattern matching algorithms to determine the apparent displacement of a background pattern. In the present case this pattern is displayed on a regular LCD monitor. By changing what is displayed on the monitor, foreground features (such as particles or optical defects in the apparatus) can be identified separately from the background pattern. The influence of these features can then be locally masked out from the synthetic schlieren calculations. The technique also has the benefit of enabling the simultaneous use of particle image velocimetry or particle tracking velocimetry, and hence it may produce combined measurements of both density gradients and velocity. The masking techniques introduced here significantly reduce the errors in the measured density gradient that would otherwise be introduced by the presence of particles in the flow. The mask itself will introduce errors in the pattern matching, but we show that these are smaller than the benefits. Keywords: PIV, water wave measurements, synthetic schlieren, internal

gravity waves, density gradient measurements, velocity measurements, dynamic local masking (Some figures in this article are in colour only in the electronic version)

1. Introduction The recent development of synthetic schlieren (Dalziel et al 1998, Sutherland et al 1999, Dalziel et al 2000) provides a valuable tool for measuring density field perturbations. The technique works by viewing a background pattern through the fluid medium. Perturbations in the density field lead to perturbations in the refractive index of the fluid that cause the pattern to appear to move. Pattern matching algorithms may then be applied to this apparent movement to determine the refractive index and hence density perturbations. 0957-0233/05/101954+07$30.00

The present paper aims to combine measurements of velocity and density in fluids through the combination of the two techniques: particle image velocimetry (e.g. Raffel et al (1998), Sveen and Cowen (2004)) and synthetic schlieren. Moreover, we utilize the approach developed in a different context by Munro et al (2004) whereby the background patterns used for synthetic schlieren are changed in order to extend the scope of the measurements. The experiments are recorded by a computer-controlled CCD camera. This computer is also equipped with a secondary LCD monitor positioned behind the experiment and used to

© 2005 IOP Publishing Ltd Printed in the UK

1954

Combined measurements of PIV and synthetic schlieren Secondary Monitor

Tank

Camera

Primary monitor

Computer

Figure 1. Experiment setup.

display the different background patterns. In the present case, two different backgrounds are used, and the first background consists of a pattern of random dots and is used for synthetic schlieren. The second background is completely white and is used for locating features in the fluid or on the tank wall that ideally should be masked out in order to improve the synthetic schlieren measurements. When tracer particles are added to the fluid, this background can also be used for particle image velocimetry (PIV) and/or particle tracking velocimetry (PTV) measurements. Particles in the fluid will appear as dark blobs on this white background and their motion may be determined by the use of PIV or PTV. Before processing the synthetic schlieren (SS) image, the image containing the particles is used to edit the synthetic schlieren image and thus remove most of the influence of the particles from the synthetic schlieren image. This leads to an improvement in precision and quality of the calculated density measurements. This hybrid technique is applied to measurements of internal gravity waves in a linearly stratified fluid. Initial tests show promising results for this novel technique.

2. Experiments 2.1. Setup The technical setup comprises a computer with two monitors, also running the software code DigiFlow, a JAI CVM4+CL camera and a framegrabber. Figure 1 shows a schematic drawing of the setup. The camera resolution is 1380 × 1030 pixels, and the video sequences are stored at 8 bit depth to hard-disk in real time. Synthetic schlieren measures the apparent displacement of a background pattern. Normally this pattern is created as a random array of dots which is printed on a piece of paper or transparent film and positioned between a light source and the experiment. The simple idea we present here uses the computer’s secondary monitor for displaying this pattern and also introduces the possibility of synchronously changing the pattern during recording. In our case we have

chosen to use two such patterns which we change based on two factors: the frequency with which the monitor is updated and the possible camera frame rate. The background monitor is a 19 inch LCD monitor of 1280 × 1024 pixels resolution operating at 60 Hz and with a response time of 16 ms. The key idea here is to be able to trigger the camera to capture images each time the monitor is updated. Unfortunately the camera used here has a maximum frame rate of 24 fps when operating in full resolution, so we have chosen to operate it at 20 fps, 15 fps and 10 fps in the tests comprised here, which corresponds to integer fractions of the screen refresh rate. Optimally we would require our camera to focus on both our background pattern as well as the whole depth of the tank containing particles. This is, however, not generally possible, and in order to maximize focus in both ‘planes’ it is essential to use a camera lens with a long focal length, and also to position the camera relatively far away from the experiment. In combination with a small aperture this enables us to keep both image ‘planes’ close to focused. In practice we have found that the camera should be focused between the two ‘planes’. We note that due to the similar resolutions of the camera and monitor, we sometimes experience moir´e fringes in the images. These distortions are nevertheless minimized when we defocus the background slightly. The acquisition is initiated by the computer locking on to the secondary monitor’s update frequency (60 Hz) and displaying the first background image on it. A given time δt after the background has been displayed, a trigger signal is sent to the camera and an image is acquired. After acquisition, the computer waits the correct number of screen updates before displaying the second background image and acquiring the next image. For flexibility this synchronization is accomplished in software, although the high data rates from the camera combined with the critical timing place a heavy demand on the available bandwidth of the single processor system being used. DigiFlow uses DirectX to pick up the blanking signal sent from the monitor every time the screen has been updated. Due to timing overheads it is generally not possible to acquire images at every blanking signal, but our 1955

J K Sveen and S B Dalziel

tests have shown that up to 30 frames per second should be possible with a suitable camera. For the purpose of this investigation, two background images are used. The first is a random pattern of white dots on a black background, while the second pattern is all white. The dots in the first frame have a diameter of about 3–8 pixels (in the recorded image). We note that the choice of a random pattern is based on the wish that all correlations should be unique, and that we thus avoid problems regarding phase-wrapping which can potentially occur for regular patterns when displacements are larger than the pattern-length. The second, white frame is generated with an intensity so that particles in the flow field will appear black on a white background. In this way all the particles will be backlit, in contrast to how PIV and PTV measurements normally are performed, where usually a twodimensional light sheet is used for illumination. The present approach is chosen for simplicity, but it is a straightforward task to change the intensity of the background from white to black and to introduce a light sheet in the flow. The back lighting approach, however, comes with the added advantage of allowing the removal of all the unwanted image features such as particles and reflections that appear in the synthetic schlieren images. This means that by keeping track of these distortions to the first frame, it is possible to remove potential error sources from the synthetic schlieren frames. We use a mixture of Pliolite VTAC and Pliolite S5E particles with a nominal diameter of 0.15 mm. The former particles have a specific gravity of about 1.02 g cm−3 and the latter of about 1.05 g cm−3 , but both with rather large spreads about these values. This mixture will generally seed the upper half of our linearly stratified fluid. Our seeding density is such that we have between 5 and 10 particles within each interrogation region.

PIV and PTV are related techniques for measuring displacements of tracer particles in fluids. The main difference between the two is that PIV relies on spatial correlation while PTV relies on temporal correlation. PIV is based on fundamentals of pattern matching and measures the displacement of an ensemble of particles. PTV, on the other hand, usually measures the displacements of individual particles allowing the full Lagrangian particle path to be resolved. The slight advantage of PIV over PTV is the fact that the method deals better with high particle densities and poorer image quality. On the other hand, PTV is often better at measuring stronger local gradients. Details on PIV may be found in Sveen and Cowen (2004), and Dalziel (1992) contains an approach to PTV. Two different PIV codes are used here: MatPIV (Sveen 2004) and DigiFlow (Dalziel 2004). The latter code is also used for background image display, image acquisition and data processing, while the former was only used in the initial phases of the experiments for verification and testing of algorithms. Pattern matching in PIV is performed using centred differences, or second order accurate window shifting (similar to that of Wereley and Meinhart (2001)). Furthermore, we use subpixel window shifting and distortion and also reverse matching as described above. For PTV we again use DigiFlow, which uses an implementation of the method outlined in Dalziel (1992, 1993).

2.2. Synthetic schlieren

2.4. The dynamic masking technique

Synthetic schlieren is based on the detection of apparent movement of a background pattern due to changes in the refractive index in a flow field. We note that the technique known as background oriented schlieren (Meier 1999, Richard and Raffel 2001) is essentially the same technique as synthetic schlieren. There are only minor differences between the two methods, primarily in the approaches they take towards pattern matching. It can be shown that the apparent displacement of the background pattern, zexp (in the coordinate system for the middle of the tank), is related to the density gradient according to

One of the aims of the present experimental setup is to attempt to remove the effects of the particles on the synthetic schlieren images. For reference we show a small section of the raw images from an experiment in figure 2. The effects of the particles can clearly be seen in the synthetic schlieren frame. Given that the particles are backlit, they will appear as shadows on top of the synthetic schlieren pattern. Any particle motion will therefore appear as a moving pattern superimposed on the apparent motion of the background pattern. In the present case these two distinct motions have similar amplitudes but different directions and phase. In this paper we have chosen a novel approach where we identify pixels corresponding to particles from the PIV images and subsequently remove their effect by masking the SS frame. Masking is performed by omitting any masked pixel from the SS pattern matching process. In this way the particle motion will not contribute to the correlation planes, but on the other hand this comes at the risk of introducing noise to the pattern matching. The procedure is depicted in figure 3 and starts by performing simple image processing on the PIV frame. The first step is to construct a background image from all of the PIV frames. This is done by locating the maximum intensity for each pixel as a function of time, and it serves to remove uneven background illumination and unwanted features on the tank walls, such as drops, dirt or air bubbles. An example of

2Lzexp ρ0 ∂ρ  = , ∂z (L − B − W/2)W (W + 2B)β here B is the distance from the background to the experiment, W is the width (or thickness) of the fluid, L is the distance from the experiment to the camera, ρ = ρ0 + ρ  is the density, with ρ0 the reference density and ρ  the density perturbation. Finally β ≈ 0.184 is a constant connecting the density to the refractive index. Readers are referred to Dalziel et al (2000) for details. The pattern matching in synthetic schlieren is performed using forward differences with subpixel window shifts. In order to improve the displacement estimate, the matching 1956

is also performed with the image order reversed. The pattern matching is performed using the minimum quadratic difference method (Gui and Merzkirch 2000). 2.3. PIV and PTV

Combined measurements of PIV and synthetic schlieren

(a)

(b)

Figure 2. Raw images (zoom of an arbitrary 100 × 100 pixels large region). (a) Raw synthetic schlieren frame. (b) Raw PIV frame. (b)

0.2 0.15

(a)

0.1

(c) 0.05 0 0

(d)

(e)

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

0.5

Figure 4. RMS error of displacement field versus proportion of image area removed by mask.

Gonzales and Woods (1992)) to ‘grow’ the particles in size and thus be certain all the pixels affected by the particle can be removed, even if the particle moves slightly. The resulting frame is thereafter used as a mask for the synthetic schlieren frame. We note that an erosion filter is applied since our images are inverted (black particles on white background). Since the PIV and synthetic schlieren frames are interleaved, one should ideally combine the information about the particles from the PIV frame before and after each synthetic schlieren frame. In the present case, however, the particle motion is rather small and this step becomes less important. 2.5. Simulating the removal of particles from the synthetic schlieren frames

Figure 3. Example images. (a) shows the raw synthetic schlieren frame. (b) shows the raw (subsequent) PIV frame. (c) shows frame (b) with background image subtracted and the image thereafter thresholded to produce a binary image. Frame (d ) shows frame (c) inverted and filtered through an erosion filter. (e) shows the final, masked frame to be processed in synthetic schlieren. Masked pixels are coloured red.

such unwanted features is seen in figure 2(b) in the form of a few large grey ‘blobs’ on the left of the image. The next step is to locate particles using a threshold value, relative to the background, which has to be chosen by trial and error. Having located particles we apply an erosion filter (see, for example,

To quantify the degree of noise introduced, we have performed a few simple tests whereby we remove random small regions of 3 × 3 pixels from a synthetic schlieren image with no particles present. Hence, this removal of information simulates the response of the synthetic schlieren measurement to removal of the effects of particles present in the flow field. The test is performed on an image from a real experiment that will be described in more detail in section 2.8. Figure 4 shows the RMS (root mean square) error of the whole apparent displacement field as a function of the fraction of removed area to total area. The RMS error rises rather quickly as the first few per cent of the pixels are removed, but after about 5% masked area, the curve flattens out. We observe that removing 47.3% of the image pixels only introduces about 21% noise. Our initial tests confirm that typically 20% of the area is removed by the mask, which indicates that in practical 1957

J K Sveen and S B Dalziel

Table 1. Effect of dynamic masking technique. Note that subscripts refer to experiment number. RMS2,3 /RMS1 With particles present With particles removed

1.17 1.10

applications the RMS errors introduced by this technique will be around 0–10%. These numbers obviously depend on the particle seeding density, and to optimize both our synthetic schlieren and PIV measurements we normally need to restrict the seeding density in our experiments. 2.6. Performance of the masking technique In order to evaluate the effect of the masking technique in realistic conditions, we performed three nominally identical but independent experiments. In the first, no particles were added to the flow and a time series of synthetic schlieren data were obtained for a duration of about 90 s. The data were subsequently processed and the RMS of the magnitude of the density gradient was calculated (as a function of time). The mean of this RMS signal was thereafter compared to the same property calculated from the second experiment, where particles were added to the flow. A fairly low seeding density was applied, but with large local variations due to the fact that the particles have a limited density distribution, causing them to settle into layers within the stratified flow. Finally, we applied our dynamic masking technique to remove the particles from the recordings of the second experiment. Table 1 shows the nondimensional (temporal mean) RMS ratios for this second experiment, where the numbers have been made dimensionless with respect to the RMS of the first experiment. We observe that the introduction of the particles gives rise to a 17% increase in RMS errors, and this error drops to about 10% when our masking technique is applied. As shown in section 2.5, the application of the masking technique will inherently introduce errors as well, and the magnitude of the error is related to the relative area of the mask. In our case, on average the mask removes about 10% of the area which means that the noise introduced by the mask itself should be less than 8%. We note that these values are averaged over the whole flow-field and that in some image (interrogation) regions up to about 20% of the area is masked out. 2.7. A note on the relation to PIV The technique presented herein also has interesting applications within PIV measurements. In these measurements, a mask is often used to remove regions of the flow containing experimental apparatus etc. The interrogation regions containing parts of the mask will suffer from very similar noise levels as we have shown here. Moreover, in PIV the mask will typically consist of one or more solid regions, so that bias errors will be significant as well as RMS errors. Our results indicate that it is possible to measure displacements with relatively good precision even when a mask is covering a small part of the interrogation region. As the size of the mask grows, the error also grows and by the time 50% of the local image area is removed, the errors will be around 25%. 1958

Figure 5. Density field perturbation as measured by synthetic 2 2 schlieren. Colours indicate magnitude of ( ∂ρ∂x + ∂ρ∂y )1/2 . Particles removed from field. White box indicates the position of the measurements shown in figure 6. Red/grey line indicates the position of the cross section for figure 7.

We note that for large, contiguously masked regions, the RMS errors should be somewhat smaller than if the mask consists of random pixels within the interrogation region. Furthermore, in PIV we may also have particles entering or leaving the image plane. The effect of loss of particles will, in fact, be very similar to the dynamic masking technique we present here. Hu et al (1998) indicate errors between 7.12% and 41.30% as the out-of-plane velocity is increased so that about 1.7% to 34% of the particles leave the image plane between two subsequent exposures. Their errors are larger than we observe, but we ascribe this to the fact that the masked areas are completely omitted from the correlation in our case. We have also performed tests (not shown here) where the masked areas are replaced by a constant value close to the background intensity. In this case we find errors of about 45% when 34% of the local image area is removed and about 8.2% when 1.7% of the area is removed. These numbers are in very good agreement with the findings of Hu et al (1998). This comparison also suggests that one can improve PIV accuracy by identifying individual particles leaving or entering the image plane and omitting these from the calculations by the use of our masking technique. Indeed, one of the attractions of point-by-point based measures of image difference is the possibility of identifying particles entering or leaving and subsequently masking them out of the pattern matching. Preliminary analysis of such dynamic masking in the DigiFlow implementation of PIV confirms significantly decreased errors. In the case where we have about 40% out of plane motion (i.e. about 40% of the particles leave the light sheet), our masking technique could reduce these errors to about 18%. 2.8. Experiments on internal waves in a linearly stratified fluid The test case concerns internal gravity waves in a linearly stratified fluid. Waves are excited by means of an oscillating cylinder. This experiment has featured in many publications in recent years (e.g. Sutherland et al (1999), Dalziel et al (2000)). The fluid is linearly stratified with a buoyancy

Combined measurements of PIV and synthetic schlieren

200

200

250

250

300

300

350

350

400

400

450

450

500

400

600

800

1000

1200

500

400

600

800

(a)

1000

1200

(b)

Figure 6. (a) Density gradient vectors from synthetic schlieren. (b) Displacement of particles found by PIV. Maximum displacement is 2.88 pixels. Vector field taken from the white box indicated in figure 5.

frequency (Brunt–V¨ais¨al¨a frequency) given by N2 =

–3

x 10

−g ∂ρ , ρ0 ∂z

where ρ is the density, ρ0 is a reference density and g is the acceleration due to gravity. We used N = 1.8 s−1 in our experiments and the cylinder diameter was d = 4.4 cm. Oscillating the cylinder at a frequency ω < N will excite the well-known ‘St Andrews cross’ wave field. This field consists of four wave beams radiating away from the cylinder at angles θ to the vertical. For small amplitude (linear) waves the angle is then determined by the dispersion relation (Lighthill 1978) ω = N cos θ. Results from a typical experiment are depicted in figure 5. The waves can be seen radiating away from the cylinder at an angle of about 57◦ . The figures show an experiment where particles have been added to the flow. Figure 5 is the result of an SS analysis using the dynamic masking technique. For illustration we also show figure 6 where both the density gradient and the particle displacements are shown. This figure shows a zoom of the white box drawn in figure 5. As expected for internal gravity waves, the particles move perpendicularly to the density gradients. Following Sutherland et al (1999) we can use conservation of mass for linear motion of an incompressible fluid to calculate the velocity perturbations u and v  from the density field as  1 (1) u (x, y) = 2 (∂N 2 /∂t) dx, N  1 (2) v  (x, y) = − 2 (∂N 2 /∂t) dz, N where ∂N 2 /∂t is determined by using two subsequent images for the SS calculations. Figure 7 shows the velocity in a cross-section of the wave beam, measured 3.4 cylinder diameters away from the centre of the cylinder. The velocities are non-dimensionalized by the buoyancy frequency times the cylinder diameter. The velocities calculated using equations (1) and (2) compare rather well with those measured by PIV.

6 4 2

u Nd

0 –2 –4 –6 2.8

3

3.2

3.4

3.6

3.8

4

x/d

Figure 7. Velocity profile across wave beam. Circles: velocities estimated from density perturbations using linear theory. Dots: velocities measured by PIV.

We note that ∂N 2 /∂t could also have been calculated from the difference between two subsequent perturbation density fields. Tests have shown the differences between the two approaches are negligible in our case. Finally we mention that index of refraction changes are known to give rise to errors in PIV. Jackson et al (2002) imaged a fixed pattern located behind a stirred stratification, and they found maximum rms velocity errors of about 8%. We note that we expect a much smaller influence in our experiments since we have small amplitude, linear waves in a stable stratification and no mixing.

3. Conclusion We have presented a novel technique for dynamically masking images for synthetic schlieren through the use of a regular LCD monitor for displaying the background pattern. The background patterns can be changed and hence particles (and other features) may be identified and locally masked out from the SS calculations. The technique also has the advantage of enabling the additional use of particle image velocimetry or particle tracking velocimetry, and hence it may produce combined measurements of both velocity and density gradients. We have performed several experiments to test the performance of this technique and have found that it can greatly reduce RMS variations in the density gradient 1959

J K Sveen and S B Dalziel

measurements, which are due to particles present in the flow field. The mask itself will introduce errors in the pattern matching, but we have shown that these are smaller than the benefits. In our experiments the errors introduced were up to about 11%, whereas the reduction in the root mean square errors was up to 50%. Furthermore, our results indicate that one can reduce errors in PIV by locally masking out regions that contain particles entering or leaving the light sheet. This is the topic of an ongoing investigation.

Acknowledgment This work was GR/S27351/01.

performed

under

EPSRC

grant

References Dalziel S B 1992 Decay of rotating turbulence: some particle tracking experiments Appl. Sci. Res. 49 217–44 Dalziel S B 1993 Rayleigh–Taylor instability: experiments with image analysis Dyn. Atmos. Oceans 20 127–53 Dalziel S B 2004 Digiflow user manual http://www.damtp.cam.ac.uk/lab/digiflow/ Dalziel S B, Hughes G O and Sutherland B R 2000 Whole-field density measurements by synthetic schlieren Exp. Fluids 28 322–35 Dalziel S, Hughes G and Sutherland B 1998 Synthetic schlieren Proc. 8th Int. Symp. on Flow Visualization ed G M Carlomagno and I Grant Gonzales R C and Woods R E 1992 Digital Image Processing (Reading, MA: Addison-Wesley)

1960

Gui L and Merzkirch W 2000 A comparative study of the MQD method and several correlation-based PIV evaluation algorithms Exp. Fluids 28 36–44 Hu H, Saga T, Kobayashi T, Okamoto K and Taniguchi N 1998 Evaluation of the cross correlation method by using PIV standard images Int. J. Vis. 1 87–94 Jackson P R, Musalem R A, Rehmann C R and Hill D F 2002 Particle image velocimetry errors due to refractive index fluctuations Hydraulic Measurements and Experimental Methods, Proc. Speciality Conf., EWRI and IAHR (Estes Park, CO) Lighthill M J 1978 Waves in Fluids (Cambridge: Cambridge University Press) Meier G E A 1999 Hintergrund schlierenmessverfahren Deutsche Patentanmeldung DE 199 42 856 A1 Munro R, Dalziel S B and Jehan H 2004 A pattern matching technique for measuring sediment displacement levels Exp. Fluids. 37 399–408 Raffel M, Willert C E and Kompenhans J 1998 Particle Image Velocimetry, A Practical Guide 1st edn (Berlin: Springer) Richard H and Raffel M 2001 Principle and applications of the background oriented schlieren (BOS) method Meas. Sci. Technol. 12 1576–85 Sutherland B R, Dalziel S B, Hughes G O and Linden P F 1999 Visualization and measurement of internal waves by synthetic schlieren: part 1. Vertically oscillating cylinder J. Fluid Mech. 390 93–126 Sveen J K 2004 An introduction to matpiv v.1.6.1 Eprint no. 2, ISSN 0809-4403, Department of Mathematics, University of Oslo, http://www.math.uio.no/∼jks/matpiv Sveen J K and Cowen E A 2004 Quantitative imaging techniques and their application to wavy flow PIV and Water Waves ed J Grue, P L F Liu and G K Pedersen (Singapore: World Scientific) Wereley S T and Meinhart C D 2001 Second-order accurate particle image velocimetry Exp. Fluids 31 258–68