10.3 DDPIV version 4.6.0c R14 IPP
10.3.1 FINDPART
FINDPART, as mentioned above, has two main functions: to detect particle images, and to find particles in space. It includes routines for image pre-processing, particle image detection, application of multi-plane dewarping, converting particle images to particles in space, and the correction of particleZ coordinates due to refraction from a multi-medium experimental setup.
10.3.1.1 Image Pre-processing
Depending on the selected options,DDPIVmay perform some pre-processing steps on the raw images before the particle search begins. This can be divided into two categories—image manipulation, which consists of preparing image files for processing (such as splitting a multi-sensor image), and image alteration, where actual pixel values are changed. These steps proceed in order by aperture. If the images are double frame, then both frames of an aperture are processed before the next aperture is processed. Regardless of the image layout, the files should be 8-bitBMPfiles.
After the images are sorted into single-frame, single-sensor images, the image in memory is al- tered according to the selected options. There are 5 possible pre-processing functions: background subtraction happens first, then de-interlace, invert, blur, and normalize, in that order. Those func- tions that benefit from the optimization are implemented using Intel’s Image Processing Primitives (IPP) library.
Background subtraction allows for an image to be subtracted from all experimental images.
Because the Gaussian fitting step simply searches for bright spots in the image, illuminated background elements can contribute a lot to the ghost particle population, so it is important to get an image which hasonly particle images.
De-interlacing takes the rows and then the columns of the image and multiplies them by some constant so that the average pixel value of two adjacent ones is the same. It is useful for analog sensors, such as the ones in the Lunchbox Camera.
Invert simply inverts the pixel values of the image. FINDPARTexpects the particle images to be lighter than the background; in the case of a light surface marked with dark dots it is necessary to invert the image first.
Blur is an implementation of Gaussian blur using a 13 by 13 pixel kernel. Normally the blur radius will not exceed 3 pixels. Blur can be used when the images are extremely noisy, although in normal circumstances, tests with dewarping target images show no discernable increase in the precision of the Gaussian fit with blur turned on. However, the current implementation of the Gaussian fitting routine fails with saturated particle images (see below) and if the particle images are big enough, blurring them substantially is the only way to recover any data from such images.
Normalize takes the pixel value histogram of the image and stretches it so that there is at least one pixel with value of 0 and one with value of 255.
FINDPARTalso includes an image masking function, but it is not implemented on the pixel values themselves but rather during the Gaussian fitting step.
10.3.1.2 Particle Search
After the images are prepared, pixel threshold values are used to mark possible particle images. The user defines a particle image maximum radius, which should be large enough to cover all the particle images of interest, andFINDPARTsearches areas of this size pixel-by-pixel through the entire image.
The mask is implemented at this step—if a particular image coordinate has value 0 in the mask, then FINDPARTcontinues without checking the pixel values there. Once a non-masked image coordinate is found, the pixel values within the search radius of that image coordinate are checked. If the maximum pixel value inside this radius is larger than the threshold set by the user for this aperture then that pixel coordinate is checked against the maximum allowable overlap, also set by the user.
Typically this is 50%, so if the particle images have a clear maximum pixel and values sloping down around it, the pixel-by-pixel check will not mark multiple “bright spots” per particle image. If a maximum pixel value passes the mask, threshold, and overlap tests, then the set of pixels around
it becomes the kernel of pixels for a Gaussian fit. If a heavily saturated particle image is passed through this procedure, then normally FINDPART will mark multiple possible particle images per saturated particle image because the first 255-valued pixel is taken as the maximum for a particular search area, thus marking the edge of a particle image for fitting. Even if the overlap is set to 0 this will likely result in multiple particle images being tagged instead of the single saturated one. By blurring the entire image as mentioned above, the saturated particle images lose their plateau shape and a single, centrally located pixel becomes the maximum value so the particle image search will be successful.
For each prospective particle image detected by threshold, a two-dimensional Gaussian is fitted over the pixel values, and the center of this Gaussian is taken to be the location of the particle image. The fit is done by minimizing the difference between the pixel values and the Gaussian within the kernel defined as above using thelmdif function of MINPACK. (This function minimizes the sum of the squares of n nonlinear functions using a modified Levenberg-Marquardt algorithm and is publicly available.) If for some reason the fit fails, the software defaults to taking the centroid of the kernel as the particle image location.
At this point, the images are discarded, andFINDPARTproceeds with a list ofx, ypixel coordinates of particle images for each aperture. Internally, the software takes all these coordinates and dewarps them according to the coefficients obtained with dewarpC. All dewarping planes are interpreted independently. By default, the dot on the origin of the grid is mapped to 0,0 for each plane, and all the other dots are mapped so that they form a perfect grid. At the reference plane this is correct, but for all other planes the particle image coordinates must be shifted according to the theoretical pinhole-optics separation between apertures as defined in equation4.3-35.
Particle image matching continues with a coarse tolerance first, and using the dewarping coef- ficients from the reference plane. Figure 10.3-1is an exaggerated view of the matching procedure.
Two of the camera’s apertures are shown as white circles; they are separated by a distanceB. The particle image from the first aperture, shown as a blue circle, is superimposed onto the aperture location since everything is measured relative to this point. The particle image in the second aper- ture, shown as a red circle, is being checked for the possibility of a prospective match. The distance between the two particle images is A, and the distance between the second particle image to its aperture isC. The circles traced by these two radii intersect and form a line segment which cuts the segment between the apertures a distance rB from the blue particle image. If this were a perfect pinhole camera with no error, then the two circles would intersect at one point, and rB would be exactly the separation predicted by equation4.3-35. In the case shown in figure10.3-1,
rB= A+ (B−C)
2 (10.3-2)
Figure 10.3-1: Exaggerated view of the particle image matching criteria used inFINDPART.
A
tolerance
C
B rB
In a real camera, the second (red) particle image is allowed to be within a certain tolerance of this perfect location. The tolerance is shown as a green circle in figure 10.3-1. At the first stage, where all particle images are dewarped using the reference plane coefficients, the tolerance is usually large (1.5 pixels for the Ian and Emilio Cameras) and is known as the “coarse” tolerance. If the second particle image is a match with the first using the coarse tolerance1 then a preliminary Z is calculated using rBas the separation. The particle image coordinates are replaced with a linear interpolation of the coordinates given by the dewarping coefficients of the two dewarping planes on either side of this preliminary Z or as the coordinate given by the last dewarping plane if the preliminaryZ is beyond (closer to the camera than) the last dewarping plane.
The calculation depicted in figure10.3-1is repeated with the new particle image coordinates and using the “fine” tolerance (typically 0.5 pixels for the Emilio Camera). If the two particle images still match then the next particle image is sought in the next aperture using the fine tolerance, always updating the preliminaryZ at each new aperture, until finallyN particle images are matched inN apertures and a finalZ is calculated using the separations between N−1 apertures.
After a particle is created itsZ coordinate is corrected for the refraction of the different indexes in a multi-medium experiment. Because the dewarping coefficients are calculated from images taken in a similar multi-medium setup, the correction is a simple rescaling inZ by as defined by
Ztrue= (Zapparent+L1+L2/n12)n13−L2−L1 (10.3-3) where 1, 2, and 3 are the three media from camera to particle location (typically air, wall material, and experiment fluid, respectively),Li are the distances in those mediums, andn1i are the indexes
1Note that figure10.3-1shows a pair of particle images thatdo notmatch.
of refraction of the medium relative to air. This is a simplified version of the correction depicted in equation 20 ofPereira and Gharib[2002], since by doing the dewarping in the fluid allX andY dependency of the correction is removed.
FINDPART is the key step in the processing because its result is the reconstructed point cloud corresponding to the locations in space of the particles that were imaged. Typically vector fields are obtained using particle tracking algorithms and thus the error introduced in this step propagates directly to those results. Great care has been taken to ensure that the calibration is accurate and that the hardware design is such that once a calibration is obtained the results are consistent from power cycle to power cycle. Chapters 12, 13, and14 examine in detail the simulated and experimental precision of the key parts of the reconstruction performed inFINDPART.