dockers/texcmp/texcmp.js
function fftImage(image) {
    const real = createMatrix();
    const imag = createMatrix();
    let idx = 0;
    const nchan = image.channels;
    const alphachan = 1 - (nchan % 2);
    const colorchan = nchan - alphachan;
    for (let y = 0; y < image.height; ++y) {
        for (let x = 0; x < image.width; ++x) {
            let v = 0;
            for (let c = 0; c < colorchan; ++c) {
                v += 255 - image.data[idx++];
            }
            for (let c = 0; c < alphachan; ++c) {
                v += image.data[idx++];
            }
            real.set(y, x, v);
        }
    }
    fft(1, real, imag);
    return {
        real: real,
        imag: imag,
        width: image.width,
        height: image.height,
    };
}
function fftImage(image) {
    const real = createMatrix();
    const imag = createMatrix();
    let idx = 0;
    const nchan = image.channels;
    const alphachan = 1 - (nchan % 2);
    const colorchan = nchan - alphachan;
    for (let y = 0; y < image.height; ++y) {
        for (let x = 0; x < image.width; ++x) {
            let v = 0;
            for (let c = 0; c < colorchan; ++c) {
                v += 255 - image.data[idx++];
            }
            for (let c = 0; c < alphachan; ++c) {
                v += image.data[idx++];
            }
            real.set(y, x, v);
        }
    }
    fft(1, real, imag);
    return {
        real: real,
        imag: imag,
        width: image.width,
        height: image.height,
    };
}
function fftImage ( image ) { const real = createMatrix ( ) ; const imag = createMatrix ( ) ; let idx = 0 ; const nchan = image . channels ; const alphachan = 1 - ( nchan % 2 ) ; const colorchan = nchan - alphachan ; for ( let y = 0 ; y < image . height ; ++ y ) { for ( let x = 0 ; x < image . width ; ++ x ) { let v = 0 ; for ( let c = 0 ; c < colorchan ; ++ c ) { v += 255 - image . data [ idx ++ ] ; } for ( let c = 0 ; c < alphachan ; ++ c ) { v += image . data [ idx ++ ] ; } real . set ( y , x , v ) ; } } fft ( 1 , real , imag ) ; return { real : real , imag : imag , width : image . width , height : image . height , } ; }
Take a parsed image data structure and apply FFT transformation to it
Take a parsed image data structure and apply FFT transformation to it