MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / gaussianFilter

Function gaussianFilter

source/MRVoxels/MRFloatGrid.cpp:199–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199void gaussianFilter( FloatGrid& grid, int width, int iters, ProgressCallback cb /*= {} */ )
200{
201 if ( !grid )
202 return;
203 // just grows to 100%
204 // first grows fast, then slower
205 ProgressCallback dummyProgressCb;
206 float i = 1.0f;
207 if ( cb )
208 dummyProgressCb = [&] ( float )->bool
209 {
210 i += 1e-4f;
211 return cb( 1.0f - 1.0f / std::sqrt( i ) );
212 };
213 ProgressInterrupter interrupter( dummyProgressCb );
214
215 auto filter = openvdb::tools::Filter<openvdb::FloatGrid, openvdb::FloatGrid::ValueConverter<float>::Type, ProgressInterrupter>( ovdb( *grid ), &interrupter );
216 filter.gaussian( width, iters );
217}
218
219FloatGrid gaussianFiltered( const FloatGrid& grid, int width, int iters, ProgressCallback cb /*= {} */ )
220{

Callers 2

fixFunction · 0.85
gaussianFilteredFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected