Re: [Numpy-discussion] Help with interpolating missing values from a 3D scanner
I have implemented an iterative gaussian smoothing approach that is working well for my purposes. My approach uses a median filter to populate the initial values and then runs a few passes with gaussian smoothing. This works very well for the missing values that I care about within the face region. I also came across an error when I tried to use the Rbf class. I was hoping that I could just input all of the data that I have and have a quick and easy solution. I expect this would work if ran the Rbf on just a small image tile near the missing data region. I am not sure if this is worthy of a bug report. When I tried to create an RBF from the full image I got this error: Traceback (most recent call last): File /Users/bolme/Documents/workspace/pyvision/src/pyvision/types/ RangeImage.py, line 258, in module ri.populateMissingData() File /Users/bolme/Documents/workspace/pyvision/src/pyvision/types/ RangeImage.py, line 184, in populateMissingData it.Rbf(x[mask],y[mask],z[mask]) File /Library/Python/2.5/site-packages/scipy-0.7.0.dev4645-py2.5- macosx-10.3-i386.egg/scipy/interpolate/rbf.py, line 129, in __init__ r = self._call_norm(self.xi, self.xi) File /Library/Python/2.5/site-packages/scipy-0.7.0.dev4645-py2.5- macosx-10.3-i386.egg/scipy/interpolate/rbf.py, line 144, in _call_norm return self.norm(x1, x2) File /Library/Python/2.5/site-packages/scipy-0.7.0.dev4645-py2.5- macosx-10.3-i386.egg/scipy/interpolate/rbf.py, line 54, in _euclidean_norm return sqrt( ((x1 - x2)**2).sum(axis=0) ) ValueError: broadcast dimensions too large. This is probably because I tried to input the full 640X480 image. Too much data. x[mask], y[mask], and z[mask] are a one dimensional arrays with approximately 100,000 elements. I am trying to predict z. It would be nice to have a more descriptive error message. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Help with interpolating missing values from a 3D scanner
Thanks for all the ideas. I think I will look into the scikits.delaunay, Rbf, or gaussian smoothing approach. My best idea is similar to the Gaussian smoothing. Anyway, all of the missing data gaps seem to be small enough that I expect any of these methods to accomplish my purpose. I have read some of the work on PDE's and in- painting but I think it is overkill for this particular application. I will let you know how it works. Thanks again, Dave ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Help with interpolating missing values from a 3D scanner
2009/1/16 Robert Kern robert.k...@gmail.com: of the missing region into the center. This is roughly akin to solving a PDE over the missing region using the known pixels as boundary conditions. I have no particular references for this approach, but I imagine you can dig up something in the literature about PDE-based image processing. This technique is known as image inpainting: http://www.iua.upf.es/~mbertalmio/restoration.html Regards Stéfan ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Help with interpolating missing values from a 3D scanner
2009/1/16 Robert Kern robert.k...@gmail.com: On Thu, Jan 15, 2009 at 16:55, David Bolme bolme1...@comcast.net wrote: I am working on a face recognition using 3D data from a special 3D imaging system. For those interested the data comes from the FRGC 2004 dataset. The problem I am having is that for some pixels the scanner fails to capture depth information. The result is that the image has missing values. There are small regions on the face such as eyebrows and eyes that are missing the depth information. I would like to fill in these region by interpolating from nearby pixels but I am not sure of the best way to do that. Another approach (that you would have to code yourself) is to take a Gaussian smoothing kernel of an appropriate size, center it over each missing pixel, then average the known pixels under the kernel using the kernel as a weighting factor. Place that average value into the missing pixel. This is actually fairly similar to the Rbf method above, but will probably be more efficient since you know that the points are all gridded. You might try using Rbf with a window of known pixels centred on your missing pixels. You'll automatically get a smoothing kernel that weights nearer known pixel values more heavily, the behaviour of the kernel depends on the basis function you choose (so it's similar to the Gaussian smoothing idea). The reason for using a window is efficiency, Rbf will be grossly inefficient if you feed it all of the known pixels in your image as known values. Using a window will gain efficiency without significantly changing your result because very distant known pixel values contribute little to the result anyway. The iteration of image inpainting also sounds like a useful extension. Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion