Comparing version 1.3.1 to 1.3.2
{ | ||
"name": "ml-fft", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "fft", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -212,3 +212,3 @@ 'use strict' | ||
*/ | ||
convolute:function(data, kernel, nRows, nCols){ | ||
convolute:function(data, kernel, nRows, nCols, opt){ | ||
var ftSpectrum = new Array(nCols * nRows); | ||
@@ -221,3 +221,4 @@ for (var i = 0; i<nRows * nCols; i++){ | ||
var dim = kernel.length; | ||
var dimR = kernel.length; | ||
var dimC = kernel[0].length; | ||
var ftFilterData = new Array(nCols * nRows); | ||
@@ -229,8 +230,9 @@ for(var i=0;i<nCols * nRows;i++){ | ||
var iRow, iCol; | ||
var shift = (dim - 1) / 2; | ||
var shiftR = (dimR - 1) / 2; | ||
var shiftC = (dimC - 1) / 2; | ||
//console.log(dim); | ||
for (var ir = 0; ir < dim; ir++) { | ||
iRow = (ir - shift + nRows) % nRows; | ||
for (var ic = 0; ic < dim; ic++) { | ||
iCol = (ic - shift + nCols) % nCols; | ||
for (var ir = 0; ir < dimR; ir++) { | ||
iRow = (ir - shiftR + nRows) % nRows; | ||
for (var ic = 0; ic < dimC; ic++) { | ||
iCol = (ic - shiftC + nCols) % nCols; | ||
ftFilterData[iRow * nCols + iCol] = kernel[ir][ic]; | ||
@@ -237,0 +239,0 @@ } |
90537
1128