vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
|
filter by weighted summation of spline values More...
#include <iostream>
#include <vspline/vspline.h>
#include <vigra/stdimage.hxx>
#include <vigra/imageinfo.hxx>
#include <vigra/impex.hxx>
Go to the source code of this file.
Classes | |
struct | meta_filter< I, O, S, EV > |
struct | ev_meta< inner_type > |
Typedefs | |
typedef vigra::RGBValue< float, 0, 1, 2 > | pixel_type |
typedef vigra::TinyVector< float, 2 > | coordinate_type |
typedef vspline::bspline< pixel_type, 2 > | spline_type |
typedef vigra::MultiArray< 2, pixel_type > | target_type |
Functions | |
int | main (int argc, char *argv[]) |
filter by weighted summation of spline values
convolution forms a weighted sum of a window of values from a raster. But some filters are easier to formulate by the formation of a weighted sum over a pattern of 'pickup' points which do not coincide with raster points. To realize such a filter, we first create an interpolator over the raster data which provides a contiguous signal. Then we can pick up values at arbitrary offsets (delta) and form a weighted sum from them. Obviously this is computationally intensive, as we need to evaluate the interpolator for every contributing pickup point, but the method is extremely flexible, and with fast, multithreaded, vectorized evaluation it's still very fast.
This file has a simple example implementing an x-shaped filter.
The filter mechanism introduced here provides a reasonably efficient way to code stuff like 'perceptrons' liberated from the corset of the grid of the incoming raster data. It allows arbitrary patterns, among them concentric polygons, cross shapes and many more, and when using b-splines as 'underlying' interpolators, it's also an option to not look at the spline itsef, but at it's derivative(s), which opens up yet more interesting detectors. And with the meta filter 'looking at' a continuous signal, we can pick up filtered values from every valid continuous coordinate, not just from a unit-spaced raster of discrete coordinates as we would when doing a convolution, so we can throw in decimation/upsampling, geometric transformations etc. pp.
Definition in file metafilter.cc.
typedef vigra::TinyVector< float , 2 > coordinate_type |
Definition at line 75 of file metafilter.cc.
typedef vigra::RGBValue< float , 0 , 1 , 2 > pixel_type |
Definition at line 72 of file metafilter.cc.
typedef vspline::bspline< pixel_type , 2 > spline_type |
Definition at line 78 of file metafilter.cc.
typedef vigra::MultiArray< 2 , pixel_type > target_type |
Definition at line 81 of file metafilter.cc.
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 156 of file metafilter.cc.