ImFusion C++ SDK 4.5.0
ImFusion::GlFilterSet Class Reference

#include <ImFusion/GL/GlFilterSet.h>

Processing multiple images with a standard filter. More...

Inheritance diagram for ImFusion::GlFilterSet:

Detailed Description

Processing multiple images with a standard filter.

Classes

class  ParamInfo
 Simple container to store information about filter parameters and names. More...

Public Types

enum  FilterMode {
  SHARPEN = 0 , GAUSSIAN = 1 , GUIDED_FILTER = 2 , ANISOTROPIC_DIFFUSION = 3 ,
  BILATERAL = 4 , XCLAHE = 5 , NOISE_UNIFORM = 6 , NOISE_GAUSSIAN = 7 ,
  NOISE_POISSON = 8 , GRADIENT = 9 , EDGE = 10 , MEDIAN = 11 ,
  ADSOC = 12 , LOCALEXTREMAL = 13 , CUSTOM = 14
}
 Enum for the different filters.
enum  ParamType { FLOAT }
 Categories for data types passed to filter.
Public Types inherited from ImFusion::Algorithm
enum  Status {
  Unknown = -1 , Success = 0 , Error = 1 , InvalidInput ,
  IncompleteInput , OutOfMemoryHost , OutOfMemoryGPU , UnsupportedGPU ,
  UnknownAction , AbortedByUser , User = 1000
}
 Status codes. More...

Public Member Functions

 GlFilterSet (SharedImageSet *images, int mode=0, GlFilter *custom=0)
 Constructor providing texture images and filter mode.
 GlFilterSet (const std::vector< SharedImageSet * > &images, int mode=0, GlFilter *custom=0)
 ~GlFilterSet () override
 Destructor, deleting all filtered images.
void setInput (const std::vector< SharedImageSet * > &newInput)
 Replaces the input of the algorithm.
void setMode (int val, GlFilter *custom=0, bool atInit=false, bool config=false)
 Specify which standard filter to use.
void setHalfKernelSize (int val)
 Specify the half kernel size.
void setIterations (int val)
 Specify the number of iterations (if applicable).
void setStrength (double val)
 Specify the filter strength.
void setSharpenStrength (double val)
 Specify sharpen filter strength for anisotropic diffusion.
void setCreateNew (bool flag)
 Specify whether new data should be created when called via compute.
void setMetricMode (bool flag)
 Specify whether the filter should be used in metric mode.
virtual SharedImagefilterOne (int whichImg=-1, int whichSet=-1)
 Filter a single image. The returned image is owned by the FilterSet class.
SharedImageSetfilterSelection (int whichSet=-1)
 Filter selection of images, if settings have changed.
void filterAll ()
 Filter the entire set of images, if settings have changed.
void filterAllInPlace ()
 Filter the entire set of images and replace them in the source image set.
int mode () const
 Return current mode.
int halfKernelSize () const
 Return half kernel size.
int iterations () const
 Return number of iterations.
double strength () const
 Return strength parameter.
double sharpenStrength () const
 Return sharpen strength parameter.
bool metricMode () const
 Return if the filter uses metric mode.
GlFilterfilter ()
 Access to filter instance.
void initParamInfos ()
 Initialize the info for all available filters, i.e.
const std::vector< std::pair< FilterMode, std::vector< ParamInfo > > > paramInfos () const
 Get the vector of ParamInfos.
Public Member Functions inherited from ImFusion::Algorithm
 Algorithm ()
 Default constructor will registers a single "compute" action that calls compute() and returns status().
virtual void setProgress (Progress *progress)
 Sets a Progress interface the algorithm can use to notify observers about its computing progress.
Progressprogress () const
 Returns the progress interface if set.
virtual int status () const
 Indicates the status of the last call to compute().
virtual bool survivesDataDeletion (const Data *) const
 Indicates whether the algorithm can handle (partial) deletion of the specified data, by default this checks whether the data is in the input list.
const FactoryInfofactoryInfo () const
 Returns the record describing how this Algorithm was instantiated by the AlgorithmFactory.
void setFactoryInfo (const FactoryInfo &value)
 Sets the record describing how this Algorithm was instantiated by the AlgorithmFactory.
Status runAction (const std::string &id)
 Run the action with name id if it exists.
const std::vector< Action > & actions ()
 Get a mapping from Action id to Action as registered in this algorithm.
Public Member Functions inherited from ImFusion::Configurable
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 Configurable (const Configurable &rhs)
 Configurable (Configurable &&rhs) noexcept
Configurable & operator= (const Configurable &)
Configurable & operator= (Configurable &&) noexcept
Public Member Functions inherited from ImFusion::SequentialImageProcessor
virtual void setSequentialMode (bool b)
 This method should be called to let the algorithm know that it should only run in sequential mode.
virtual bool isSequentialMode () const
 Returns of the algorithm should only run in sequential mode.

Protected Member Functions

void setAllDirty (bool dirty)
Protected Member Functions inherited from ImFusion::Algorithm
void loadDefaults ()
void registerAction (const std::string &id, const std::string &guiName, const std::function< Algorithm::Status(void)> &action)
 Register an action to be run via runAction.
template<typename D>
void registerAction (const std::string &id, const std::string &guiName, Algorithm::Status(D::*action)(void))
 Template version of runAction that can be used with a pointer to a member function.
void registerAction (const Action &action)
 Register an action.

Protected Attributes

int m_mode
 Standard filter mode.
int m_kernelSize
 Half kernel size.
int m_iterations
 Number of iterations.
double m_strength
 Filter strength parameter.
double m_sharpenStrength
 Strength parameter for sharpen filter of anisotropic diffusion filter.
std::vector< bool > m_dirty
 Dirty flag for processing all images.
bool m_createNew
 Create new data when called via compute.
std::vector< SharedImageSet * > m_imgSrc
 Source images.
std::vector< std::unique_ptr< SharedImageSet > > m_imgDst
 Destination images.
SharedImagem_imgAux
 Single auxiliary destination.
GlFilterm_filter
 The actual filter.
bool m_metricMode
 The filter will consider the metric if this is true and the filter supports this.
std::vector< std::pair< FilterMode, std::vector< ParamInfo > > > m_paramInfos
 FilterInfos of all filters.
std::mutex m_filterSetupMutex
 Mutex protecting the filter.
Protected Attributes inherited from ImFusion::Algorithm
std::string m_name
 Algorithm name.
Progressm_progress = nullptr
 Non-owing pointer to a progress interface. May be a nullptr.
FactoryInfo m_factoryInfo = {}
 Record describing how this algorithm was instantiated by the AlgorithmFactory.
int m_status = Status::Unknown
 Algorithm status after last call to compute().
std::vector< Actionm_actions
 Map of key given by the id of the action, of the available actions of this algorithm.
Protected Attributes inherited from ImFusion::Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
Protected Attributes inherited from ImFusion::SequentialImageProcessor
bool m_isSequentialMode = false
 Flag to determine if algorithm is running in sequential mode.

Algorithm interface methods

void compute () override
 Execute the algorithm.
OwningDataList takeOutput () override
 Return any new Data that was created by the Algorithm during the last call to compute().
static bool createCompatible (const DataList &data, Algorithm **a=0)

SequentialImageProcessor interface method

std::pair< std::shared_ptr< SharedImage >, DataComponentListprocessImage (const SharedImage &image, const DataComponentList &components) const override
 Processes a single image without modifying the algorithm's status.

Configurable interface methods

void configure (const Properties *p) override
 Configure this object instance by de-serializing the given Properties.
void configuration (Properties *p) const override
 Serialize the current object configuration into the given Properties object.

Additional Inherited Members

Static Public Member Functions inherited from ImFusion::Algorithm
static bool createCompatible (const DataList &data, Algorithm **a=nullptr)
 Factory function to check algorithm compatibility with input data and optionally instantiate it.
Public Attributes inherited from ImFusion::Algorithm
Signal signalOutputChanged
 Signal should be emitted by Algorithms when their output/result has changed.
Signal signalParametersChanged
 Signal should be emitted by Algorithms when their parameter configuration has changed.
Public Attributes inherited from ImFusion::Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.

Constructor & Destructor Documentation

◆ GlFilterSet()

ImFusion::GlFilterSet::GlFilterSet ( SharedImageSet * images,
int mode = 0,
GlFilter * custom = 0 )

Constructor providing texture images and filter mode.

Parameters
imagesinput images
modeto use
customcustom filter for last mode

Member Function Documentation

◆ compute()

void ImFusion::GlFilterSet::compute ( )
overridevirtual

Execute the algorithm.

Implements ImFusion::Algorithm.

◆ takeOutput()

OwningDataList ImFusion::GlFilterSet::takeOutput ( )
overridevirtual

Return any new Data that was created by the Algorithm during the last call to compute().

The default implementation will return an empty list.

Note
Since ownership of the data is transferred, you can call this method only once between calls to compute().

Reimplemented from ImFusion::Algorithm.

◆ processImage()

std::pair< std::shared_ptr< SharedImage >, DataComponentList > ImFusion::GlFilterSet::processImage ( const SharedImage & image,
const DataComponentList & components ) const
overridevirtual

Processes a single image without modifying the algorithm's status.

The algorithm parameters should be configured in advance.

Returns
the result of the computation (may be null, e.g. if some frame should be dropped)

Implements ImFusion::SequentialImageProcessor.

◆ configure()

void ImFusion::GlFilterSet::configure ( const Properties * p)
overridevirtual

Configure this object instance by de-serializing the given Properties.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configuration() for the inverse functionality

Reimplemented from ImFusion::Configurable.

◆ configuration()

void ImFusion::GlFilterSet::configuration ( Properties * p) const
overridevirtual

Serialize the current object configuration into the given Properties object.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configure() for the inverse functionality

Reimplemented from ImFusion::Configurable.

◆ setMode()

void ImFusion::GlFilterSet::setMode ( int val,
GlFilter * custom = 0,
bool atInit = false,
bool config = false )

Specify which standard filter to use.

Parameters
atInitPrevents overwriting of config values if available

◆ filterOne()

virtual SharedImage * ImFusion::GlFilterSet::filterOne ( int whichImg = -1,
int whichSet = -1 )
virtual

Filter a single image. The returned image is owned by the FilterSet class.

If the which parameter is not set, the focus frame is filtered.

◆ filterSelection()

SharedImageSet * ImFusion::GlFilterSet::filterSelection ( int whichSet = -1)

Filter selection of images, if settings have changed.

Note
Yields the same result as filterAll() if all images of input selected.

◆ initParamInfos()

void ImFusion::GlFilterSet::initParamInfos ( )

Initialize the info for all available filters, i.e.

set name, type and range

Note
The ParamInfos in the inner vector will be successively matched to the controller's slider
Do not add more than three ParamInfos per mode since there are only three sliders.

The documentation for this class was generated from the following file:
  • ImFusion/GL/GlFilterSet.h
Search Tab / S to search, Esc to close