Simd Library Documentation.

Home | Release Notes | Download | Documentation | Issues | GitHub

Functions for image segmentation. More...

Functions

SIMD_API void SimdSegmentationChangeIndex (uint8_t *mask, size_t stride, size_t width, size_t height, uint8_t oldIndex, uint8_t newIndex)
 Changes certain index in mask. More...
 
SIMD_API void SimdSegmentationFillSingleHoles (uint8_t *mask, size_t stride, size_t width, size_t height, uint8_t index)
 Fill single holes in mask. More...
 
SIMD_API void SimdSegmentationPropagate2x2 (const uint8_t *parent, size_t parentStride, size_t width, size_t height, uint8_t *child, size_t childStride, const uint8_t *difference, size_t differenceStride, uint8_t currentIndex, uint8_t invalidIndex, uint8_t emptyIndex, uint8_t differenceThreshold)
 Propagates mask index from parent (upper) to child (lower) level of mask pyramid with using 2x2 scan window. More...
 
SIMD_API void SimdSegmentationShrinkRegion (const uint8_t *mask, size_t stride, size_t width, size_t height, uint8_t index, ptrdiff_t *left, ptrdiff_t *top, ptrdiff_t *right, ptrdiff_t *bottom)
 Finds actual region of mask index location. More...
 
template<template< class > class A>
SIMD_INLINE void SegmentationChangeIndex (View< A > &mask, uint8_t oldIndex, uint8_t newIndex)
 Changes certain index in mask. More...
 
template<template< class > class A>
SIMD_INLINE void SegmentationFillSingleHoles (View< A > &mask, uint8_t index)
 Fill single holes in mask. More...
 
template<template< class > class A>
SIMD_INLINE void SegmentationPropagate2x2 (const View< A > &parent, View< A > &child, const View< A > &difference, uint8_t currentIndex, uint8_t invalidIndex, uint8_t emptyIndex, uint8_t differenceThreshold)
 Propagates mask index from parent (upper) to child (lower) level of mask pyramid with using 2x2 scan window. More...
 
template<template< class > class A>
SIMD_INLINE void SegmentationShrinkRegion (const View< A > &mask, uint8_t index, Rectangle< ptrdiff_t > &rect)
 Finds actual region of mask index location. More...
 

Detailed Description

Functions for image segmentation.

Function Documentation

◆ SimdSegmentationChangeIndex()

void SimdSegmentationChangeIndex ( uint8_t *  mask,
size_t  stride,
size_t  width,
size_t  height,
uint8_t  oldIndex,
uint8_t  newIndex 
)

Changes certain index in mask.

Mask must has 8-bit gray pixel format.

For every point:

if(mask[i] == oldIndex)
    mask[i] = newIndex;
Note
This function has a C++ wrappers: Simd::SegmentationChangeIndex(View<A> & mask, uint8_t oldIndex, uint8_t newIndex).
Parameters
[in,out]mask- a pointer to pixels data of 8-bit gray mask image.
[in]stride- a row size of the mask image.
[in]width- a mask width.
[in]height- a mask height.
[in]oldIndex- a mask old index.
[in]newIndex- a mask new index.

◆ SimdSegmentationFillSingleHoles()

void SimdSegmentationFillSingleHoles ( uint8_t *  mask,
size_t  stride,
size_t  width,
size_t  height,
uint8_t  index 
)

Fill single holes in mask.

Mask must has 8-bit gray pixel format.

Note
This function has a C++ wrappers: Simd::SegmentationFillSingleHoles(View<A> & mask, uint8_t index).
Parameters
[in,out]mask- a pointer to pixels data of 8-bit gray mask image.
[in]stride- a row size of the mask image.
[in]width- an mask width.
[in]height- an mask height.
[in]index- a mask index.

◆ SimdSegmentationPropagate2x2()

void SimdSegmentationPropagate2x2 ( const uint8_t *  parent,
size_t  parentStride,
size_t  width,
size_t  height,
uint8_t *  child,
size_t  childStride,
const uint8_t *  difference,
size_t  differenceStride,
uint8_t  currentIndex,
uint8_t  invalidIndex,
uint8_t  emptyIndex,
uint8_t  differenceThreshold 
)

Propagates mask index from parent (upper) to child (lower) level of mask pyramid with using 2x2 scan window.

For parent and child image must be performed: parentWidth = (childWidth + 1)/2, parentHeight = (childHeight + 1)/2. All images must have 8-bit gray pixel format. Size of different image is equal to child image.

Note
This function has a C++ wrappers: Simd::SegmentationPropagate2x2(const View<A> & parent, View<A> & child, const View<A> & difference, uint8_t currentIndex, uint8_t invalidIndex, uint8_t emptyIndex, uint8_t thresholdDifference).
Parameters
[in]parent- a pointer to pixels data of 8-bit gray parent mask image.
[in]parentStride- a row size of the parent mask image.
[in]width- a parent mask width.
[in]height- a parent mask height.
[in,out]child- a pointer to pixels data of 8-bit gray child mask image.
[in]childStride- a row size of the child mask image.
[in]difference- a pointer to pixels data of 8-bit gray difference image.
[in]differenceStride- a row size of the difference image.
[in]currentIndex- propagated mask index.
[in]invalidIndex- invalid mask index.
[in]emptyIndex- empty mask index.
[in]differenceThreshold- a difference threshold for conditional index propagating.

◆ SimdSegmentationShrinkRegion()

void SimdSegmentationShrinkRegion ( const uint8_t *  mask,
size_t  stride,
size_t  width,
size_t  height,
uint8_t  index,
ptrdiff_t *  left,
ptrdiff_t *  top,
ptrdiff_t *  right,
ptrdiff_t *  bottom 
)

Finds actual region of mask index location.

Mask must has 8-bit gray pixel format.

Note
This function has a C++ wrappers: Simd::SegmentationShrinkRegion(const View<A> & mask, uint8_t index, Rectangle<ptrdiff_t> & rect).
Parameters
[in]mask- a pointer to pixels data of 8-bit gray mask image.
[in]stride- a row size of the mask image.
[in]width- an mask width.
[in]height- an mask height.
[in]index- a mask index.
[in,out]left- a pointer to left side.
[in,out]top- a pointer to top side.
[in,out]right- a pointer to right side.
[in,out]bottom- a pointer to bottom side.

◆ SegmentationChangeIndex()

void SegmentationChangeIndex ( View< A > &  mask,
uint8_t  oldIndex,
uint8_t  newIndex 
)

Changes certain index in mask.

Mask must has 8-bit gray pixel format.

For every point:

if(mask[i] == oldIndex)
    mask[i] = newIndex;
Note
This function is a C++ wrapper for function SimdSegmentationChangeIndex.
Parameters
[in,out]mask- a 8-bit gray mask image.
[in]oldIndex- a mask old index.
[in]newIndex- a mask new index.

◆ SegmentationFillSingleHoles()

void SegmentationFillSingleHoles ( View< A > &  mask,
uint8_t  index 
)

Fill single holes in mask.

Mask must has 8-bit gray pixel format.

Note
This function is a C++ wrapper for function SimdSegmentationFillSingleHoles.
Parameters
[in,out]mask- a 8-bit gray mask image.
[in]index- a mask index.

◆ SegmentationPropagate2x2()

void SegmentationPropagate2x2 ( const View< A > &  parent,
View< A > &  child,
const View< A > &  difference,
uint8_t  currentIndex,
uint8_t  invalidIndex,
uint8_t  emptyIndex,
uint8_t  differenceThreshold 
)

Propagates mask index from parent (upper) to child (lower) level of mask pyramid with using 2x2 scan window.

For parent and child image must be performed: parent.width = (child.width + 1)/2, parent.height = (child.height + 1)/2. All images must have 8-bit gray pixel format. Size of different image is equal to child image.

Note
This function is a C++ wrapper for function SimdSegmentationPropagate2x2.
Parameters
[in]parent- a 8-bit gray parent mask image.
[in,out]child- a 8-bit gray child mask image.
[in]difference- a 8-bit gray difference image.
[in]currentIndex- propagated mask index.
[in]invalidIndex- invalid mask index.
[in]emptyIndex- empty mask index.
[in]differenceThreshold- a difference threshold for conditional index propagating.

◆ SegmentationShrinkRegion()

void SegmentationShrinkRegion ( const View< A > &  mask,
uint8_t  index,
Rectangle< ptrdiff_t > &  rect 
)

Finds actual region of mask index location.

Mask must has 8-bit gray pixel format.

Note
This function is a C++ wrapper for function SimdSegmentationShrinkRegion.
Parameters
[in]mask- a 8-bit gray mask image.
[in]index- a mask index.
[in,out]rect- a region bounding box rectangle.