Skip to content

regiongrowing_nRegiongrowingNRegiongrowingNregiongrowing_nregiongrowing_nπŸ”—

Short descriptionπŸ”—

regiongrowing_nRegiongrowingNRegiongrowingNregiongrowing_nregiongrowing_n β€” Segment an image using region growing for multi-channel images.

SignatureπŸ”—

regiongrowing_n( image MultiChannelImage, out region Regions, string Metric, number MinTolerance, number MaxTolerance, integer MinSize )void RegiongrowingN( const HObject& MultiChannelImage, HObject* Regions, const HTuple& Metric, const HTuple& MinTolerance, const HTuple& MaxTolerance, const HTuple& MinSize )static void HOperatorSet.RegiongrowingN( HObject multiChannelImage, out HObject regions, HTuple metric, HTuple minTolerance, HTuple maxTolerance, HTuple minSize )def regiongrowing_n( multi_channel_image: HObject, metric: str, min_tolerance: Union[int, float], max_tolerance: Union[int, float], min_size: int ) -> HObject

Herror regiongrowing_n( const Hobject MultiChannelImage, Hobject* Regions, const char* Metric, double MinTolerance, double MaxTolerance, const Hlong MinSize )

Herror T_regiongrowing_n( const Hobject MultiChannelImage, Hobject* Regions, const Htuple Metric, const Htuple MinTolerance, const Htuple MaxTolerance, const Htuple MinSize )

HRegion HImage::RegiongrowingN( const HString& Metric, const HTuple& MinTolerance, const HTuple& MaxTolerance, Hlong MinSize ) const

HRegion HImage::RegiongrowingN( const HString& Metric, double MinTolerance, double MaxTolerance, Hlong MinSize ) const

HRegion HImage::RegiongrowingN( const char* Metric, double MinTolerance, double MaxTolerance, Hlong MinSize ) const

HRegion HImage::RegiongrowingN( const wchar_t* Metric, double MinTolerance, double MaxTolerance, Hlong MinSize ) const (Windows only)

HRegion HImage.RegiongrowingN( string metric, HTuple minTolerance, HTuple maxTolerance, int minSize )

HRegion HImage.RegiongrowingN( string metric, double minTolerance, double maxTolerance, int minSize )

DescriptionπŸ”—

regiongrowing_nRegiongrowingN performs a multi-channel region growing. The \(n\) channels give rise to an n-dimensional feature vector. Neighboring points are aggregated into the same region if the difference of their feature vectors with respect to the given metric lies in the interval [MinToleranceminTolerancemin_tolerance, MaxTolerancemaxTolerancemax_tolerance]. Only neighbors of the 4-neighborhood are examined. The following metrics can be used:

Let \(g_{A}\) denote the gray value in the feature vector \(A\) at point \(a\) of the image, and likewise be \(g_{B}\) the gray value in the feature vector \(B\) at point a neighboring point \(b\). Let \(g(d)\) be the gray value with index \(d\). Furthermore, let \(MinT\) denote MinToleranceminTolerancemin_tolerance and \(MaxT\) denote MaxTolerancemaxTolerancemax_tolerance.

  • '1-norm'"1-norm": Sum of absolute values

    \[\begin{eqnarray*}MinT \le \frac{1}{n} \sum{|g_{A} - g_{B}|} \le MaxT\end{eqnarray*}\]
  • '2-norm'"2-norm": Euclidean distance

    \[\begin{eqnarray*}MinT \le \sqrt{ \frac{ \sum{(g_{A} - g_{B})^2 }}{n} } \le MaxT\end{eqnarray*}\]
  • '3-norm'"3-norm": p - Norm with p = 3

    \[\begin{eqnarray*}MinT \le \sqrt[3]{ \frac{ \sum {(g_{A} - g_{B})^3 }}{n} } \le MaxT\end{eqnarray*}\]
  • '4-norm'"4-norm": p - Norm with p = 4

    \[\begin{eqnarray*} MinT \le \sqrt[4]{ \frac{ \sum {(g_{A} - g_{B})^4 }}{n} } \le MaxT \end{eqnarray*}\]
  • 'n-norm'"n-norm": Minkowski distance

    \[\begin{eqnarray*}MinT \le \sqrt[n]{ \frac{ \sum {(g_{A} - g_{B})^n }}{n} } \le MaxT\end{eqnarray*}\]
  • 'max-diff'"max-diff": Supremum distance

    \[\begin{eqnarray*}MinT \le \max { \{ |g_{A} - g_{B}| \} } \le MaxT\end{eqnarray*}\]
  • 'min-diff'"min-diff": Infimum distance

    \[\begin{eqnarray*}MinT \le \min { \{ |g_{A} - g_{B}| \} } \le MaxT\end{eqnarray*}\]
  • 'variance'"variance": Variance of gray value differences

    \[\begin{eqnarray*}MinT \le Var(g_{A} - g_{B}) \le MaxT\end{eqnarray*}\]
  • 'dot-product'"dot-product": Dot product

    \[\begin{eqnarray*}MinT \le \frac{1}{n} \sqrt { \sum { (g_{A} g_{B}) } } \le MaxT\end{eqnarray*}\]
  • 'correlation'"correlation": Correlation

    \[\begin{eqnarray*} m_{A} &=& \frac{1}{n} \sum { g_{A} } \\ Var_{A} &=& \frac{1}{n} \sqrt { \sum { (g_{A} - m_{A})^2 } } \\ m_{B} &=& \frac{1}{n} \sum { g_{B} } \\ Var_{B} &=& \frac{1}{n} \sqrt { \sum { (g_{B} - m_{B})^2 } } \\ MinT &\le& \frac{1}{n^2} \sum {\frac{(g_{A} - m_{A}) (g_{B} - m_{B})} {(Var_{A} Var_{B})}} \le MaxT \end{eqnarray*}\]
  • 'mean-diff'"mean-diff": Difference of arithmetic means

    \[\begin{eqnarray*} a &=& \frac{1}{n} \sum { g_{A} } \\ b &=& \frac{1}{n} \sum { g_{B} } \\ MinT &\le& |a - b| \le MaxT \end{eqnarray*}\]
  • 'mean-ratio'"mean-ratio": Ratio of arithmetic means

    \[\begin{eqnarray*} a &=& \frac{1}{n} \sum { g_{A} } \\ b &=& \frac{1}{n} \sum { g_{B} } \\ MinT &\le& \min { \left\{ \frac{a}{b},\frac{b}{a} \right\} } \le MaxT \end{eqnarray*}\]
  • 'length-diff'"length-diff": Difference of the vector lengths

    \[\begin{eqnarray*} a &=& \sqrt { \frac{ \sum { g_{A}^2 }}{n}}\\ b &=& \sqrt { \frac{ \sum { g_{B}^2 }}{n}}\\ MinT &\le& |a - b| \le MaxT \end{eqnarray*}\]
  • 'length-ratio'"length-ratio": Ratio of the vector lengths

    \[\begin{eqnarray*} a &=& \sqrt { \frac{ \sum { g_{A}^2 } }{n} }\\ b &=& \sqrt { \frac{ \sum { g_{B}^2 } }{n} }\\ MinT &\le& \min { \left\{ \frac{a}{b},\frac{b}{a} \right\} } \le MaxT \end{eqnarray*}\]
  • 'n-norm-ratio'"n-norm-ratio": Ratio of the vector lengths w.r.t the p-norm with p = n

    \[\begin{eqnarray*} a &=& \sqrt[n]{ \frac{ \sum { g_{A}^n } }{ n }}\\ b &=& \sqrt[n]{ \frac{ \sum { g_{B}^n } }{ n }}\\ MinT &\le& \min { \left\{ \frac{a}{b},\frac{b}{a} \right\} } \le MaxT \end{eqnarray*}\]
  • 'gray-max-diff'"gray-max-diff": Difference of the maximum gray values

    \[\begin{eqnarray*} a &=& \max { \{ |g_{A}| \} }\\ b &=& \max { \{ |g_{B}| \} }\\ MinT &\le& |a - b| \le MaxT \end{eqnarray*}\]
  • 'gray-max-ratio'"gray-max-ratio": Ratio of the maximum gray values

    \[\begin{eqnarray*} a &=& \max { \{ |g_{A}| \} }\\ b &=& \max { \{ |g_{B}| \} }\\ MinT &\le& \min { \left\{ \frac{a}{b},\frac{b}{a} \right\} } \le MaxT \end{eqnarray*}\]
  • 'gray-min-diff'"gray-min-diff": Difference of the minimum gray values

    \[\begin{eqnarray*} a &=& \min { \{|g_{A}| \} }\\ b &=& \min { \{|g_{B}| \} }\\ MinT &\le& |a - b| \le MaxT \end{eqnarray*}\]
  • 'gray-min-ratio'"gray-min-ratio": Ratio of the minimum gray values

    \[\begin{eqnarray*} a &=& \min { \{ |g_{A}| \} }\\ b &=& \min { \{ |g_{B}| \} }\\ MinT &\le& \min { \left\{ \frac{a}{b},\frac{b}{a} \right\} } \le MaxT \end{eqnarray*}\]
  • 'variance-diff'"variance-diff": Difference of the variances over all gray values (channels)

    \[\begin{eqnarray*}MinT \le | Var(g_{A}) - Var(g_{B}) | \le MaxT\end{eqnarray*}\]
  • 'variance-ratio'"variance-ratio": Ratio of the variances over all gray values (channels)

    \[\begin{eqnarray*}MinT \le \frac{Var(g_{B})}{Var(g_{A})} \le MaxT\end{eqnarray*}\]
  • 'mean-abs-diff'"mean-abs-diff": Difference of the sum of absolute values over all gray values (channels)

    \[\begin{eqnarray*} a &=& \sum_{d,k,k < d} { |g_{A}(d) - g_{A}(k)| }\\ b &=& \sum_{d,k,k < d} { |g_{B}(d) - g_{B}(k)| }\\ MinT &\le& \frac{|a - b|}{\mbox{number of sums}} \le MaxT \end{eqnarray*}\]
  • 'mean-abs-ratio'"mean-abs-ratio": Ratio of the sum of absolute values over all gray values (channels)

    \[\begin{eqnarray*} a &=& \sum_{d,k,k < d} { |g_{A}(d) - g_{A}(k)| }\\ b &=& \sum_{d,k,k < d} { |g_{B}(d) - g_{B}(k)| }\\ MinT &\le& \min { \left\{ \frac{a}{b},\frac{b}{a} \right\} } \le MaxT \end{eqnarray*}\]
  • 'max-abs-diff'"max-abs-diff": Difference of the maximum distance of the components

    \[\begin{eqnarray*} a &=& \max { \{ g_{A}(d), g_{A}(k) \} } \\ b &=& \max { \{ g_{B}(d), g_{B}(k) \} } \\ MinT &\le& \min { \left\{ \frac{a}{b},\frac{b}{a} \right\} } \le MaxT \end{eqnarray*}\]
  • 'max-abs-ratio'"max-abs-ratio": Ratio of the maximum distance of the components

    \[\begin{eqnarray*} a &=& \max { \{ g_{A}(d), g_{A}(k) \} } \\ b &=& \max { \{ g_{B}(d), g_{B}(k) \} } \\ MinT &\le& \min { \left\{ \frac{a}{b},\frac{b}{a} \right\} } \le MaxT \end{eqnarray*}\]
  • 'min-abs-diff'"min-abs-diff": Difference of the minimum distance of the components

    \[\begin{eqnarray*} a &=& \min { \{ g_{A}(d), g_{A}(k) \} }, k < d\\ b &=& \min { \{ g_{B}(d), g_{B}(k) \} }, k < d\\ MinT &\le& |a - b| \le MaxT \end{eqnarray*}\]
  • 'min-abs-ratio'"min-abs-ratio": Ratio of the minimum distance of the components

    \[\begin{eqnarray*} a &=& \min { \{ g_{A}(d), g_{A}(k) \}}, k < d\\ b &=& \min { \{ g_{B}(d), g_{B}(k) \}}, k < d\\ MinT &\le& \min { \left\{\frac{a}{b},\frac{b}{a} \right\} } \le MaxT \end{eqnarray*}\]
  • 'plane'"plane": The following has to hold for all \(d_{1}\),\(d_{2} \in [1,n]\):

    \[\begin{eqnarray*} g_{A}(d_{1}) &>& g_{A}(d_{2}) \Rightarrow g_{B}(d_{1}) > g_{B}(d_{2})\\ g_{A}(d_{1}) &<& g_{A}(d_{2}) \Rightarrow g_{B}(d_{1}) < g_{B}(d_{2}) \end{eqnarray*}\]

Regions with an area less than MinSizeminSizemin_size are suppressed.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

ParametersπŸ”—

MultiChannelImagemultiChannelImagemulti_channel_image (input_object) (multichannel-)image(-array) β†’ object (byte)HObject (byte)HImage (byte)HObject (byte)Hobject (byte)

Input image.

Regionsregionsregions (output_object) region-array β†’ objectHObjectHRegionHObjectHobject *

Segmented regions.

Metricmetricmetric (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Metric for the distance of the feature vectors.

Default: '2-norm'"2-norm"
List of values: '1-norm', '2-norm', '3-norm', '4-norm', 'correlation', 'dot-product', 'gray-max-diff', 'gray-max-ratio', 'gray-min-diff', 'gray-min-ratio', 'length-diff', 'length-ratio', 'max-abs-diff', 'max-abs-ratio', 'max-diff', 'mean-abs-diff', 'mean-abs-ratio', 'mean-diff', 'mean-ratio', 'min-abs-diff', 'min-abs-ratio', 'min-diff', 'n-norm', 'n-norm-ratio', 'plane', 'variance', 'variance-diff', 'variance-ratio'"1-norm", "2-norm", "3-norm", "4-norm", "correlation", "dot-product", "gray-max-diff", "gray-max-ratio", "gray-min-diff", "gray-min-ratio", "length-diff", "length-ratio", "max-abs-diff", "max-abs-ratio", "max-diff", "mean-abs-diff", "mean-abs-ratio", "mean-diff", "mean-ratio", "min-abs-diff", "min-abs-ratio", "min-diff", "n-norm", "n-norm-ratio", "plane", "variance", "variance-diff", "variance-ratio"

MinToleranceminTolerancemin_tolerance (input_control) number β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Lower threshold for the features’ distance.

Default: 0.00.0
Suggested values: 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 25.0, 30.00.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 25.0, 30.0

MaxTolerancemaxTolerancemax_tolerance (input_control) number β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Upper threshold for the features’ distance.

Default: 20.020.0
Suggested values: 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 25.0, 30.00.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 25.0, 30.0

MinSizeminSizemin_size (input_control) integer β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Minimum size of the output regions.

Default: 3030
Suggested values: 1, 10, 25, 50, 100, 200, 500, 10001, 10, 25, 50, 100, 200, 500, 1000
Value range: 1 ≀ MinSize
Minimum increment: 1
Recommended increment: 5

ResultπŸ”—

regiongrowing_nRegiongrowingN returns 2 (H_MSG_TRUE) if all parameters are correct. The behavior with respect to the input images and output regions can be determined by setting the values of the flags 'no_object_result'"no_object_result", 'empty_region_result'"empty_region_result", and 'store_empty_region'"store_empty_region" with set_systemSetSystem. If necessary, an exception is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

compose2Compose2, compose3Compose3

Alternatives

class_2dim_supClass2dimSup, class_ndim_normClassNdimNorm

See also

regiongrowing_meanRegiongrowingMean

ModuleπŸ”—

Foundation