# Filters on floating-point images

**URL:** <https://forum.commonvisionblox.com/t/filters-on-floating-point-images/1297>\
**Category:** .Net API\
**Created:** [December 18, 2020, 8:32am UTC](https://forum.commonvisionblox.com/t/filters-on-floating-point-images/1297 "2020-12-18T08:32:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CvK](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/cvk/32/112_2.png) [@CvK](https://forum.commonvisionblox.com/u/CvK)\
**Post date:** [December 18, 2020, 8:32am UTC](https://forum.commonvisionblox.com/t/filters-on-floating-point-images/1297/1 "2020-12-18T08:32:15Z")

</div>

It seems the default filters for images (filter.boxMedian for example) doesn’t accept f32bpp images such as obtained as heightmaps. How would one filter heightmap images obtained from cvb? Of course the crude approach would be to convert the data type, but this results in the loss of a lot of information, which I’d like to avoid if at all possible.

---

<div class="post-metadata">

**Author:** ![illusive](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/illusive/32/61_2.png) [@illusive](https://forum.commonvisionblox.com/u/illusive)\
**Post date:** [December 23, 2020, 11:51am UTC](https://forum.commonvisionblox.com/t/filters-on-floating-point-images/1297/2 "2020-12-23T11:51:20Z")

</div>

Hi @CvK

the support for floating-point valued images in the _CVFoundation.dll_ functions unfortunately is a fairly jagged terrain. I’ll add a rough list of functions that support this data format to the bottom of this post.

Where support for floating point valued input is not given, I fear that you’ll either need to go through a different data format (accepting that there might be some information loss, but the extent to which this hurts greatly depends on the range of values in the floating point image) or try to build the missing link with what is there (which might be possible e.g. for some of the simpler filter operations).

The functions that - according to a look at the sources - support 32 bit floating point images are:  
(note: this list is based on the input checks in the source code - assuming that these are written correctly these functions _should_ support 32 bit floating point images…)

- `AbsoluteImage`
- `AddConstant`
- `AddImages`
- `ApplyColorTwistMatrix`
- `ApplyForwardGammaCorrection`
- `ApplyInverseGammaCorrection`
- `AreaSubImage`
- `BlackHatImage`
- `CalculateCorrelationCoefficients`
- `CalculateCrossCorrelations`
- `CalculateSumOfSquareDistances`
- `ConvertHLSToRGB`
- `ConvertRGBToLUV`
- `ConvertRGBToGrayScale`
- `ConvertRGBToGrayScaleStandard`
- `ConvertRGBToHLS`
- `ConvertRGBToXYZ`
- `ConvertRGBToYCC`
- `ConvertLUVToRGB`
- `ConvertXYZToRGB`
- `ConvertYCCToRGB`
- `CreateConstantThresholdImage`
- `CreateImageThresholdImage`
- `CreateTransparentThresholdImage`
- `DivideConstant`
- `DivideImages`
- `DynThresholdImageMinMax`
- `DilateImage`
- `ErodeImage`
- `FilterBoxMax`
- `FilterBoxMean`
- `FilterBoxMin`
- `FilterGauss`
- `FilterHiPass`
- `FilterLaplace2`
- `FilterLoPass`
- `FilterMedianColor`
- `FilterPrewittHorizontal`
- `FilterPrewittVertical`
- `FilterRobertsDown`
- `FilterRobertsUp`
- `FilterScharrHorizontal`
- `FilterScharrVertical`
- `FilterSharpening`
- `FilterSobelCross`
- `FilterSobelHorizontal`
- `FilterSobelHorizontal2ndOrder`
- `FilterSobelVertical`
- `FilterSobelVertical2ndOrder`
- `FilterUserLinear`
- `FilterWiener`
- `ForwardWaveletTransform`
- `ImageMinMaxValue`
- `ImageNormL1`
- `ImageNormL2`
- `ImageNormLInf`
- `InitializeImageRectFloat`
- `InverseWaveletTransform`
- `MatrixTransformImage`
- `MorphologicalGradientImage`
- `MultiplyConstant`
- `MultiplyImages`
- `PerspectiveTransformImage`
- `PyramidDownSample`
- `PyramidUpSample`
- `ResizeImage`
- `RotateImage`
- `ShearImage`
- `SquareImage`
- `SquareRootImage`
- `SubtractConstant`
- `SubtractConstantAbsolute`
- `SubtractImages`
- `SubtractImagesAbsolute`
- `TopHatImage`
- `WangImageQuality`

---

<div class="post-metadata">

**Author:** ![CvK](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/cvk/32/112_2.png) [@CvK](https://forum.commonvisionblox.com/u/CvK)\
**Post date:** [December 24, 2020, 12:50pm UTC](https://forum.commonvisionblox.com/t/filters-on-floating-point-images/1297/3 "2020-12-24T12:50:08Z")

</div>

Hmm, I found a working solution but it feels kind of hack-y. Being the duct-tape engineer that I am, I tried to get the color median filter to work since this one does accept floating point values. It worked after I copied the first plane two times to create an RGB encoded image. Strange that the original median doesn’t work though.
