nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
morph.hpp File Reference

Morphological operations (function-form). More...

#include <memory_resource>
#include <nk/value/fn_handle.hpp>
#include <nk/value/value.hpp>
#include <string>
#include <vector>

Go to the source code of this file.

Functions

Value nk::image::strel (const std::string &shape, const std::vector< double > &params, const Value &arbitrary_nhood, std::pmr::memory_resource *mr=nullptr)
 Build a 2-D structuring element (SE = strel(shape, params, arbitrary_nhood)).
Value nk::image::imerode (const Value &I, const Value &SE, std::pmr::memory_resource *mr=nullptr)
 Grayscale erosion (J = imerode(I, SE)).
Value nk::image::imdilate (const Value &I, const Value &SE, std::pmr::memory_resource *mr=nullptr)
 Grayscale dilation (J = imdilate(I, SE)).
Value nk::image::imopen (const Value &I, const Value &SE, std::pmr::memory_resource *mr=nullptr)
 Morphological opening (J = imopen(I, SE) = imdilate(imerode(I, SE), SE)).
Value nk::image::imclose (const Value &I, const Value &SE, std::pmr::memory_resource *mr=nullptr)
 Morphological closing (J = imclose(I, SE) = imerode(imdilate(I, SE), SE)).
Value nk::image::imreconstruct (const Value &marker, const Value &mask, int conn, std::pmr::memory_resource *mr=nullptr)
 Morphological reconstruction by dilation (J = imreconstruct(marker, mask, conn)).
Value nk::image::imfill_holes (const Value &BW, int conn, std::pmr::memory_resource *mr=nullptr)
 Fill holes in a binary image (J = imfill(BW, 'holes', conn)).
Value nk::image::imregionalmax (const Value &I, int conn, std::pmr::memory_resource *mr=nullptr)
 Regional maxima mask (J = imregionalmax(I, conn)).
Value nk::image::imregionalmin (const Value &I, int conn, std::pmr::memory_resource *mr=nullptr)
 Regional minima mask (J = imregionalmin(I, conn)).
Value nk::image::imhmax (const Value &I, double h, int conn, std::pmr::memory_resource *mr=nullptr)
 H-maxima transform (J = imhmax(I, h, conn)).
Value nk::image::imhmin (const Value &I, double h, int conn, std::pmr::memory_resource *mr=nullptr)
 H-minima transform (J = imhmin(I, h, conn)) — dual of imhmax.
Value nk::image::imextendedmax (const Value &I, double h, int conn, std::pmr::memory_resource *mr=nullptr)
 Extended-maxima transform (J = imextendedmax(I, h, conn)).
Value nk::image::imextendedmin (const Value &I, double h, int conn, std::pmr::memory_resource *mr=nullptr)
 Extended-minima transform (J = imextendedmin(I, h, conn)).
Value nk::image::imimposemin (const Value &I, const Value &BW, int conn, std::pmr::memory_resource *mr=nullptr)
 Minima imposition (J = imimposemin(I, BW, conn)).
Value nk::image::imclearborder (const Value &BW, int conn, std::pmr::memory_resource *mr=nullptr)
 Remove border-touching components (J = imclearborder(BW, conn)).
Value nk::image::imkeepborder (const Value &BW, int conn, std::pmr::memory_resource *mr=nullptr)
 Keep only border-touching components (J = imkeepborder(BW, conn)) — dual of imclearborder.
Value nk::image::imtophat (const Value &I, const Value &SE, std::pmr::memory_resource *mr=nullptr)
 White top-hat (J = imtophat(I, SE) = I - imopen(I, SE)).
Value nk::image::imbothat (const Value &I, const Value &SE, std::pmr::memory_resource *mr=nullptr)
 Black top-hat (J = imbothat(I, SE) = imclose(I, SE) - I).
Value nk::image::mmgradm (const Value &I, const Value &se_dil, const Value &se_ero, std::pmr::memory_resource *mr=nullptr)
 Morphological gradient (G = mmgradm(I, se_dil, se_ero)).
Value nk::image::bwpack (const Value &BW, std::pmr::memory_resource *mr=nullptr)
 Pack a binary image into UINT32 columns (BWP = bwpack(BW)).
Value nk::image::bwunpack (const Value &BWP, size_t M, std::pmr::memory_resource *mr=nullptr)
 Unpack a UINT32 binary image (BW = bwunpack(BWP, M)).
Value nk::image::applylut (const Value &BW, const Value &LUT, std::pmr::memory_resource *mr=nullptr)
 Neighbourhood-LUT filter (A = applylut(BW, LUT)).
Value nk::image::bwlookup (const Value &BW, const Value &lut, std::pmr::memory_resource *mr=nullptr)
 Nonlinear neighbourhood filter via lookup table (A = bwlookup(BW, lut)).
Value nk::image::makelut (FnHandle fun, int n, std::pmr::memory_resource *mr=nullptr)
 Build a lookup table for bwlookup (lut = makelut(fun, n)).
Value nk::image::bwmorph3 (const Value &V, const std::string &op, std::pmr::memory_resource *mr=nullptr)
 Morphological operations on a binary volume (J = bwmorph3(V, operation)).
Value nk::image::bwhitmiss (const Value &BW, const Value &se1, const Value &se2, std::pmr::memory_resource *mr=nullptr)
 Binary hit-or-miss transform (J = bwhitmiss(BW, se1, se2)).
Value nk::image::bwmorph (const Value &BW, const std::string &op, int n, std::pmr::memory_resource *mr=nullptr)
 Composite binary morphological operations (J = bwmorph(BW, op, n)).
Value nk::image::bwtraceboundary (const Value &BW, const Value &P, const std::string &fstep, int conn, std::size_t m, const std::string &dir, std::pmr::memory_resource *mr=nullptr)
 Trace object boundary in a binary image (B = bwtraceboundary(BW, P, fstep, conn, m, dir)).

Detailed Description

Morphological operations (function-form).

Inputs. Most operators accept an H × W (or H × W × P) image I plus a structuring element SE produced by strel (LOGICAL matrix). LOGICAL inputs use binary morphology; numeric inputs use grayscale min/max formulations.

conn. Connectivity argument is 4 or 8 for 2-D; default 8.

Definition in file morph.hpp.