nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
morph.hpp
Go to the documentation of this file.
1// toolboxes/image/include/nk/image/morph/morph.hpp
2//
3// Morphological operations.
4
5#pragma once
6
7#include <memory_resource>
8#include <nk/value/fn_handle.hpp>
9#include <nk/value/value.hpp>
10
11#include <string>
12#include <vector>
13
14namespace nk::image {
15
18
19
30
49Value strel(const std::string &shape, const std::vector<double> &params,
50 const Value &arbitrary_nhood,
51 std::pmr::memory_resource *mr = nullptr);
52
64Value imerode(const Value &I, const Value &SE,
65 std::pmr::memory_resource *mr = nullptr);
66
77Value imdilate(const Value &I, const Value &SE,
78 std::pmr::memory_resource *mr = nullptr);
79
85Value imopen(const Value &I, const Value &SE,
86 std::pmr::memory_resource *mr = nullptr);
87
93Value imclose(const Value &I, const Value &SE,
94 std::pmr::memory_resource *mr = nullptr);
95
112Value imreconstruct(const Value &marker, const Value &mask, int conn,
113 std::pmr::memory_resource *mr = nullptr);
114
126Value imfill_holes(const Value &BW, int conn,
127 std::pmr::memory_resource *mr = nullptr);
128
140Value imregionalmax(const Value &I, int conn,
141 std::pmr::memory_resource *mr = nullptr);
142
153Value imregionalmin(const Value &I, int conn,
154 std::pmr::memory_resource *mr = nullptr);
155
167Value imhmax(const Value &I, double h, int conn,
168 std::pmr::memory_resource *mr = nullptr);
169
178Value imhmin(const Value &I, double h, int conn,
179 std::pmr::memory_resource *mr = nullptr);
180
192Value imextendedmax(const Value &I, double h, int conn,
193 std::pmr::memory_resource *mr = nullptr);
194
205Value imextendedmin(const Value &I, double h, int conn,
206 std::pmr::memory_resource *mr = nullptr);
207
220Value imimposemin(const Value &I, const Value &BW, int conn,
221 std::pmr::memory_resource *mr = nullptr);
222
234Value imclearborder(const Value &BW, int conn,
235 std::pmr::memory_resource *mr = nullptr);
236
244Value imkeepborder(const Value &BW, int conn,
245 std::pmr::memory_resource *mr = nullptr);
246
257Value imtophat(const Value &I, const Value &SE,
258 std::pmr::memory_resource *mr = nullptr);
259
269Value imbothat(const Value &I, const Value &SE,
270 std::pmr::memory_resource *mr = nullptr);
271
287Value mmgradm(const Value &I, const Value &se_dil, const Value &se_ero,
288 std::pmr::memory_resource *mr = nullptr);
289
300Value bwpack(const Value &BW, std::pmr::memory_resource *mr = nullptr);
301
312Value bwunpack(const Value &BWP, size_t M,
313 std::pmr::memory_resource *mr = nullptr);
314
328Value applylut(const Value &BW, const Value &LUT,
329 std::pmr::memory_resource *mr = nullptr);
330
347Value bwlookup(const Value &BW, const Value &lut,
348 std::pmr::memory_resource *mr = nullptr);
349
374Value makelut(FnHandle fun, int n,
375 std::pmr::memory_resource *mr = nullptr);
376
405Value bwmorph3(const Value &V, const std::string &op,
406 std::pmr::memory_resource *mr = nullptr);
407
420Value bwhitmiss(const Value &BW, const Value &se1, const Value &se2,
421 std::pmr::memory_resource *mr = nullptr);
422
446Value bwmorph(const Value &BW, const std::string &op, int n,
447 std::pmr::memory_resource *mr = nullptr);
448
483Value bwtraceboundary(const Value &BW, const Value &P,
484 const std::string &fstep, int conn,
485 std::size_t m, const std::string &dir,
486 std::pmr::memory_resource *mr = nullptr);
487
488
490} // namespace nk::image
Core MATLAB-compatible multidimensional array and scalar value type.
Definition value.hpp:61
Value 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 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 imregionalmax(const Value &I, int conn, std::pmr::memory_resource *mr=nullptr)
Regional maxima mask (J = imregionalmax(I, conn)).
Value 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 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 bwpack(const Value &BW, std::pmr::memory_resource *mr=nullptr)
Pack a binary image into UINT32 columns (BWP = bwpack(BW)).
Value 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 makelut(FnHandle fun, int n, std::pmr::memory_resource *mr=nullptr)
Build a lookup table for bwlookup (lut = makelut(fun, n)).
Value imextendedmax(const Value &I, double h, int conn, std::pmr::memory_resource *mr=nullptr)
Extended-maxima transform (J = imextendedmax(I, h, conn)).
Value imclearborder(const Value &BW, int conn, std::pmr::memory_resource *mr=nullptr)
Remove border-touching components (J = imclearborder(BW, conn)).
Value bwunpack(const Value &BWP, size_t M, std::pmr::memory_resource *mr=nullptr)
Unpack a UINT32 binary image (BW = bwunpack(BWP, M)).
Value bwlookup(const Value &BW, const Value &lut, std::pmr::memory_resource *mr=nullptr)
Nonlinear neighbourhood filter via lookup table (A = bwlookup(BW, lut)).
Value 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,...
Value 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 applylut(const Value &BW, const Value &LUT, std::pmr::memory_resource *mr=nullptr)
Neighbourhood-LUT filter (A = applylut(BW, LUT)).
Value 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 imregionalmin(const Value &I, int conn, std::pmr::memory_resource *mr=nullptr)
Regional minima mask (J = imregionalmin(I, conn)).
Value imimposemin(const Value &I, const Value &BW, int conn, std::pmr::memory_resource *mr=nullptr)
Minima imposition (J = imimposemin(I, BW, conn)).
Value 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 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 imhmax(const Value &I, double h, int conn, std::pmr::memory_resource *mr=nullptr)
H-maxima transform (J = imhmax(I, h, conn)).
Value 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 imextendedmin(const Value &I, double h, int conn, std::pmr::memory_resource *mr=nullptr)
Extended-minima transform (J = imextendedmin(I, h, conn)).
Value imdilate(const Value &I, const Value &SE, std::pmr::memory_resource *mr=nullptr)
Grayscale dilation (J = imdilate(I, SE)).
Value 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 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 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 imerode(const Value &I, const Value &SE, std::pmr::memory_resource *mr=nullptr)
Grayscale erosion (J = imerode(I, SE)).