nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
filter.hpp File Reference
#include <memory_resource>
#include <nk/value/fn_handle.hpp>
#include <nk/value/value.hpp>
#include <string>
#include <tuple>
#include <vector>

Go to the source code of this file.

Enumerations

enum class  nk::image::PadMode { PadMode::Constant , PadMode::Replicate , PadMode::Symmetric , PadMode::Circular }
 Boundary handling for image filtering / padding. More...

Functions

Value nk::image::padarray (const Value &x, const std::vector< int > &padsize, PadMode mode, double pad_value, const std::string &direction, std::pmr::memory_resource *mr=nullptr)
 Pad an array by padsize elements on each side (B = padarray(A, padsize, mode, val, dir)).
Value nk::image::fspecial (const std::string &type, const std::vector< double > &params, std::pmr::memory_resource *mr=nullptr)
 Build a 2-D filter kernel by name (h = fspecial(type, params)).
Value nk::image::fspecial3 (const std::string &type, const Value &a1, const Value &a2, std::pmr::memory_resource *mr=nullptr)
 Build a predefined 3-D filter kernel (h = fspecial3(type, ...)).
Value nk::image::imfilter (const Value &I, const Value &h, PadMode boundary, double pad_value, bool full, bool flip_kernel, std::pmr::memory_resource *mr=nullptr)
 2-D linear filtering (B = imfilter(I, h, ...)).
Value nk::image::imgaussfilt (const Value &I, double sigma, int filter_size, std::pmr::memory_resource *mr=nullptr)
 2-D Gaussian filter (B = imgaussfilt(I, sigma, filter_size)).
Value nk::image::imboxfilt (const Value &I, int filter_size, std::pmr::memory_resource *mr=nullptr)
 2-D box / mean filter (B = imboxfilt(I, filter_size)).
Value nk::image::integralBoxFilter (const Value &I, int fH, int fW, double normFactor, std::pmr::memory_resource *mr=nullptr)
 2-D box filter on a precomputed integral image (B = integralBoxFilter(I, [fH fW], normFactor)).
Value nk::image::integralBoxFilter3 (const Value &I, int fH, int fW, int fP, double normFactor, std::pmr::memory_resource *mr=nullptr)
 3-D box filter on a precomputed integral volume (B = integralBoxFilter3(A, [fH fW fP], NormalizationFactor, n)).
Value nk::image::modefilt (const Value &A, int fH, int fW, const std::string &padopt, std::pmr::memory_resource *mr=nullptr)
 2-D mode filter (B = modefilt(A, [fH fW], padopt)).
Value nk::image::modefilt3D (const Value &A, int fH, int fW, int fD, const std::string &padopt, std::pmr::memory_resource *mr=nullptr)
 3-D variant: modefilt(V, [fH fW fD], padopt).
Value nk::image::roifilt2 (const Value &h, const Value &I, const Value &BW, std::pmr::memory_resource *mr=nullptr)
 Filter a region of interest (J = roifilt2(h, I, BW)).
Value nk::image::imguidedfilter (const Value &A, const Value &G, int nhood, double eps, std::pmr::memory_resource *mr=nullptr)
 Edge-preserving guided filter (B = imguidedfilter(A, G, ...)).
Value nk::image::imdiffusefilt (const Value &I, const Value &thresh, std::size_t N, const std::string &connectivity, const std::string &conduction, std::pmr::memory_resource *mr=nullptr)
 Anisotropic-diffusion edge-preserving smoothing (B = imdiffusefilt(I, ...)).
void nk::image::imgaborfilt (const Value &A, double wavelength, double orientation, double sfb, double aspect, Value &mag_out, Value &phase_out, std::pmr::memory_resource *mr=nullptr)
 Apply a single Gabor filter to a 2-D image ([mag, phase] = imgaborfilt(A, wavelength, orientation, ...)).
void nk::image::imnlmfilt (const Value &I, double dos, int swsize, int cwsize, Value &J_out, double &est_out, std::pmr::memory_resource *mr=nullptr)
 Non-local means denoising ([J, estDoS] = imnlmfilt(I, ...)).
Value nk::image::medfilt2 (const Value &I, int rows=3, int cols=3, std::pmr::memory_resource *mr=nullptr)
 2-D median filter (B = medfilt2(I, [m n])).
Value nk::image::imsharpen (const Value &I, double radius, double amount, double threshold, std::pmr::memory_resource *mr=nullptr)
 Unsharp masking (B = imsharpen(I, radius, amount, threshold)).
Value nk::image::im2col (const Value &A, int m, int n, const std::string &block_type, std::pmr::memory_resource *mr=nullptr)
 Rearrange image neighbourhoods into matrix columns (B = im2col(A, [m n], block_type)).
Value nk::image::col2im (const Value &B, int m, int n, int mm, int nn, const std::string &block_type, std::pmr::memory_resource *mr=nullptr)
 Inverse of im2col (A = col2im(B, [m n], [mm nn], block_type)).
Value nk::image::imbilatfilt (const Value &I, double degreeOfSmoothing, double spatialSigma, std::pmr::memory_resource *mr=nullptr)
 Edge-preserving bilateral filter (B = imbilatfilt(I, degreeOfSmoothing, spatialSigma)).
Value nk::image::imnoise (::nk::ops::RngContext &rng, const Value &I, const std::string &mode, const Value &p1, const Value &p2, std::pmr::memory_resource *mr=nullptr)
 Add synthetic noise to an image (J = imnoise(I, mode, p1, p2)).
Value nk::image::stdfilt (const Value &I, const Value &domain, std::pmr::memory_resource *mr=nullptr)
 Local sample standard deviation (B = stdfilt(I, domain)).
Value nk::image::rangefilt (const Value &I, const Value &domain, std::pmr::memory_resource *mr=nullptr)
 Local max − min over a neighbourhood (B = rangefilt(I, domain)).
Value nk::image::imsmooth (const Value &I, const std::string &name, double sigma, std::pmr::memory_resource *mr=nullptr)
 Octave-image style smoothing dispatcher (J = imsmooth(I, name, sigma)).
Value nk::image::imboxfilt3 (const Value &V, int fH, int fW, int fP, std::pmr::memory_resource *mr=nullptr)
 3-D box (mean) filter (J = imboxfilt3(V, fH, fW, fP)).
Value nk::image::convmtx2 (const Value &h, int m, int n, std::pmr::memory_resource *mr=nullptr)
 2-D convolution matrix (T = convmtx2(h, m, n)).
Value nk::image::imgaussfilt3 (const Value &V, double sigH, double sigW, double sigP, std::pmr::memory_resource *mr=nullptr)
 3-D Gaussian filter (J = imgaussfilt3(V, sigH, sigW, sigP)).
Value nk::image::medfilt3 (const Value &V, int M, int N, int P, std::pmr::memory_resource *mr=nullptr)
 3-D median filter (J = medfilt3(V, [M N P])).
Value nk::image::entropyfilt (const Value &I, const Value &domain, std::pmr::memory_resource *mr=nullptr)
 Local Shannon entropy (B = entropyfilt(I, domain)).
Value nk::image::ordfilt2 (const Value &A, int nth, const Value &domain, const Value &S, PadMode boundary, double pad_value, std::pmr::memory_resource *mr=nullptr)
 2-D order-statistic filter (B = ordfilt2(A, nth, domain, S)).
std::tuple< Value, Value, Value > nk::image::freqz2 (const Value &h, size_t M, size_t N, std::pmr::memory_resource *mr=nullptr)
 2-D frequency response of a filter ([H, f1, f2] = freqz2(h, M, N)).
std::tuple< Value, Value > nk::image::wiener2 (const Value &I, size_t nh, size_t nw, double noise, std::pmr::memory_resource *mr=nullptr)
 Adaptive Wiener noise reduction ([J, noise] = wiener2(I, nh, nw, noise)).
Value nk::image::nlfilter (const Value &A, std::size_t m, std::size_t n, FnHandle fun, bool indexed, std::pmr::memory_resource *mr=nullptr)
 General sliding-neighbourhood operation (B = nlfilter(A, [m n], fun)).
Value nk::image::colfilt (const Value &A, std::size_t m, std::size_t n, const std::string &block_type, FnHandle fun, bool indexed, std::pmr::memory_resource *mr=nullptr)
 Column-wise neighbourhood operation (B = colfilt(A, [m n], block_type, fun)).
Value nk::image::locallapfilt (const Value &I, double sigma, double alpha, double beta, int num_intensity_levels, bool process_luminance, std::pmr::memory_resource *mr=nullptr)
 Edge-aware fast local Laplacian filtering (B = locallapfilt(I, sigma, alpha, beta, ...)).
Value nk::image::imreducehaze (const Value &I, double amount, const std::string &method, const Value &atmospheric_light, const std::string &contrast_enhancement, double boost_amount, Value &t_out, Value &L_out, std::pmr::memory_resource *mr=nullptr)
 Dark-channel-prior haze removal ([J, T, L] = imreducehaze(I, amount, ...)).
Value nk::image::fibermetric (const Value &I, const std::vector< double > &thickness, double structure_sensitivity, bool bright_polarity, std::pmr::memory_resource *mr=nullptr)
 Multi-scale Frangi vesselness filter (J = fibermetric(I, thickness, ...)).
Value nk::image::fsamp2 (const Value &Hd, const Value &f1, const Value &f2, const std::vector< std::size_t > &siz, std::pmr::memory_resource *mr=nullptr)
 2-D FIR filter design via frequency sampling (h = fsamp2(Hd)).
Value nk::image::ftrans2 (const Value &b, const Value &t, std::pmr::memory_resource *mr=nullptr)
 2-D FIR filter via 1-D → 2-D frequency transformation (h = ftrans2(b, t)).
Value nk::image::fwind1 (const Value &Hd, const Value &win1, const Value &win2, std::pmr::memory_resource *mr=nullptr)
 2-D FIR filter via 1-D window method (h = fwind1(Hd, win1[, win2])).
Value nk::image::fwind2 (const Value &Hd, const Value &W, std::pmr::memory_resource *mr=nullptr)
 2-D FIR filter via 2-D window method (h = fwind2(Hd, W)).