Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 551d2be
  • /
  • gaborkernel.cpp
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:96ebc4697fa80f9427d34db1293874d29b6b3764
directory badge
swh:1:dir:551d2be1152f8f6f0b24d38f90792b703adbaf74

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
gaborkernel.cpp
/*

Copyright 2018 Lingqi Yan

This file is part of WaveOpticsBrdf.

WaveOpticsBrdf is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

WaveOpticsBrdf is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with WaveOpticsBrdf.  If not, see <https://www.gnu.org/licenses/>.

*/

#include "gaborkernel.h"

comp GaborKernel::eval(Vector2 s) {
    return C * G(s, mu, sigma) * cnis(Float(2.0 * M_PI * a.dot(s)));
}

comp GaborKernel::xform(Vector2 u) {
    Float sigmaPrime = Float(1.0 / (2.0 * M_PI * sigma));
    comp CPrime = C * Float(1.0 / (2.0 * M_PI * sigma * sigma)) * cnis(Float(2.0 * M_PI * a.dot(mu)));
    GaborKernel g(-a, sigmaPrime, mu, CPrime);
    return g.eval(u);
}

GaborKernel GaborKernelPrime::toGaborKernel(Float lambda) {
    Float l = sigma * SCALE_FACTOR;
    comp C = l * l * cnis(4.0 * M_PI / lambda * cInfo);
    Vector2 a = aInfo / lambda;

    return GaborKernel(mu, sigma, a, C);
}

Vector2 GaborKernelPrime::getFFTCenter(Float lambda) {
    return -aInfo / lambda;
}

Float GaborKernelPrime::getFFTWidth() {
    return 1.0 / (2.0 * M_PI * sigma);
}

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API