MCPcopy Create free account
hub / github.com/cpvrlab/ImagePlay / processInputData

Method processInputData

IPL/src/processes/IPLFFT.cpp:46–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46bool IPLFFT::processInputData(IPLData* data, int, bool)
47{
48 IPLImage* image = data->toImage();
49
50 // delete previous result
51 delete _result;
52 _result = NULL;
53
54 int width = image->width();
55 int height = image->height();
56 int cWidth = IPLComplexImage::nextPowerOf2(width);
57 int cHeight = IPLComplexImage::nextPowerOf2(height);
58 int size = cHeight = cWidth = (cWidth>cHeight)? cWidth : cHeight;
59
60 _result = new IPLComplexImage(cWidth, cHeight);
61
62 // get properties
63 int mode = getProcessPropertyInt("mode");
64
65 int progress = 0;
66 int maxProgress = image->height() * image->getNumberOfPlanes();
67
68 // image center
69 int dx = ( cWidth - width )/2;
70 int dy = ( cHeight - height )/2;
71
72 IPLImagePlane* plane = image->plane(0);
73 for(int y=0; y<height; y++)
74 {
75 // progress
76 notifyProgressEventHandler(100*progress++/maxProgress);
77 for(int x=0; x<width; x++)
78 {
79 _result->c(x+dx, y+dy) = Complex(plane->p(x,y), 0.0);
80 }
81 }
82
83 // windowing function
84 switch(mode)
85 {
86 case 0: // rectangular
87 break;
88
89 case 1: // Hanning
90 for( int y=0; y<size; y++ )
91 for( int x=0; x<size; x++ )
92 _result->c(x,y) *= Hanning(x, size) * Hanning(y, size);
93 break;
94 case 2: // Hamming
95 for( int y=0; y<size; y++ )
96 for( int x=0; x<size; x++ )
97 _result->c(x,y) *= Hamming(x, size) * Hamming(y, size);
98 break;
99 case 3: // Blackman
100 for( int y=0; y<size; y++ )
101 for( int x=0; x<size; x++ )
102 _result->c(x,y) *= Blackman(x, size) * Blackman(y, size);
103 break;

Callers

nothing calls this directly

Calls 7

HammingClass · 0.85
toImageMethod · 0.80
widthMethod · 0.80
heightMethod · 0.80
planeMethod · 0.80
FFTMethod · 0.80
ComplexClass · 0.50

Tested by

no test coverage detected