![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Base/BasicImageProcessing.h>
Basic image processing such as downsample, flip, rotate or data type change. More...
Inheritance diagram for BasicImageProcessing:Basic image processing such as downsample, flip, rotate or data type change.
Public Types | |
| enum | Mode { DOWNSAMPLE = 0 , RESAMPLE = 1 , FLIP = 2 , ROTATE = 3 , THRESHOLDING = 4 , INVERT = 5 , CROP = 6 , CONVERTGRAY = 7 , NORMALIZE = 8 , SHARPNESS = 9 , REDUCE_BIT_DEPTH = 10 , GRADATION = 11 , EQUALIZE_HISTOGRAM = 12 , RESIZE = 14 , EMBED_ROTATION = 15 , SHIFT_N_SCALE = 16 , CONVERT_TO_FLOAT = 17 , BRIGHTNESS_PRESERVING_HE = 18 , BAYER_PATTERN_TO_COLOR = 19 , INCREASE_BIT_DEPTH , ADD_REMOVE_ALPHA , NR_MODES } |
Public Types inherited from Algorithm | |
| enum | Status { Unknown = -1 , Success = 0 , Error = 1 , InvalidInput , IncompleteInput , OutOfMemoryHost , OutOfMemoryGPU , UnsupportedGPU , UnknownAction , AbortedByUser , User = 1000 } |
| Status codes. More... | |
Public Member Functions | |
| BasicImageProcessing (SharedImageSet *img) | |
| Creates the algorithm instance with an image. | |
| void | setMode (Mode mode) |
| Specify the processing mode. | |
| Mode | mode () const |
| Get current mode. | |
| void | setSharpnessMeasure (int measure) |
| int | sharpnessMeasure () const |
| void | setCreateNew (bool flag) |
| Specify whether a new image shall be created. | |
| bool | createNew () const |
| void | setDownsampling (int dx, int dy, int dz, bool filter=true) |
| Set the downsampling parameters. | |
| void | downsampling (int &dx, int &dy, int &dz, bool &filter) const |
| void | setResampling (double resx, double resy, double resz) |
| Set the resampling parameters. | |
| void | resampling (double &resx, double &resy, double &resz) const |
| void | setFlipAxis (int val) |
| Set the flip axis. | |
| int | flipAxis () const |
| Get flip axis. | |
| void | setRotationAngle (int angle) |
| Set the rotation angle Supported values: -90, 90, -180, 180, -270, 270. | |
| int | rotationAngle () const |
| Get rotation angle. | |
| void | setRotationAxis (int axis) |
| Set the rotation axis. | |
| int | rotationAxis () const |
| Get the rotation axis. | |
| void | setIgnoreAlphaChannel (bool b) |
| Define if alpha channel should be ignored during grayscale conversion. | |
| bool | ignoreAlphaChannel () const |
| Returns if the alpha channel will be ignored during grayscale conversion. | |
| void | setRangeThresholdParams (bool thresholdInside, double lowerThreshold, double upperThreshold) |
| Set the parameters for thresholding. | |
| void | rangeThresholdParams (bool &mode, double &lowerThreshold, double &upperThreshold) const |
| Get threshold parameters. | |
| void | setInvertImageRange (bool flag) |
| Set whether to use the range of the image intensities for inverting (true) or the range of the image type (false) | |
| bool | invertImageRange () const |
| Get the parameter for the range of inverted image. | |
| void | setCropParams (const vec3i &lower, const vec3i &upper) |
| Set the parameters for cropping in pixel coordinates (inclusive) | |
| void | cropParams (vec3i &lowerOut, vec3i &upperOut) const |
| Get cropping parameters. | |
| void | setGradationMode (int mode) |
| Set gradation mode (0 = interactive, 1 = log, 2 = square root, 3 = square) | |
| int | gradationMode () const |
| Get gradation mode. | |
| void | setGradationNormalize (bool normalize) |
| Set whether to normalize image after gradation. | |
| bool | gradationNormalize () const |
| Get gradation normalization. | |
| void | setGradationMap (const TypedImage< float > *gradationMap) |
| Set gradation map. Output range is [0;1]. Ownership remains with caller. | |
| void | shiftScale (double &shift, double &scale) const |
| void | setShift (double val) |
| void | setScale (double val) |
| void | setTargetResolution (const vec3i &resolution) |
| vec3i | targetResolution () const |
| void | setInterpolateOnResolutionChange (bool val) |
| bool | interpolateOnResolutionChange () const |
| void | setPreserveValuesOnBitReduction (bool flag) |
| If enabled, 16-bit values are clamped to 8-bit during REDUCE_BIT_DEPTH. | |
| bool | preserveValuesOnBitReduction () const |
| void | setBlockListenersSignal (bool flag) |
| Set the flag blocking signals to listeners. | |
Public Member Functions inherited from 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. | |
| Progress * | progress () 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 FactoryInfo & | factoryInfo () 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 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 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. | |
Static Public Member Functions | |
| static void | downsample (SharedImageSet *sis, int dx, int dy, int dz, bool zeroMask=false, bool interpolate=true) |
| Convenience function to downsample by binning on the CPU, and adjusting the image matrix afterwards. | |
Static Public Member Functions inherited from Algorithm | |
| static bool | createCompatible (const DataList &data, Algorithm **a=nullptr) |
| Factory function to check algorithm compatibility with input data and optionally instantiate it. | |
Methods implementing the algorithm interface | |
| void | setBayerPatternMode (int val) |
| Set the bayer pattern mode. | |
| int | bayerPatternMode () const |
| Get Bayer pattern mode. | |
| void | compute () override |
| Applies the processing in the offline case. | |
| std::pair< std::shared_ptr< SharedImage >, DataComponentList > | processImage (const SharedImage &image, const DataComponentList &components) const override |
| Applies the processing to an individual image, used in stream processing case. | |
| const SharedImageSet * | input () const |
| OwningDataList | takeOutput () override |
| If new data was created, make it available here. | |
| static bool | createCompatible (const DataList &data, Algorithm **a=0) |
Methods implementing the Configurable interface | |
| 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 | |
Public Attributes inherited from 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 Configurable | |
| Signal | signalParametersChanged |
Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
Protected Member Functions inherited from 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 inherited from Algorithm | |
| std::string | m_name |
| Algorithm name. | |
| Progress * | m_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< Action > | m_actions |
| Map of key given by the id of the action, of the available actions of this algorithm. | |
Protected Attributes inherited from Configurable | |
| std::vector< Param > | m_params |
| List of all registered Parameter and SubProperty instances. | |
Protected Attributes inherited from SequentialImageProcessor | |
| bool | m_isSequentialMode = false |
| Flag to determine if algorithm is running in sequential mode. | |
| enum Mode |
| Enumerator | |
|---|---|
| DOWNSAMPLE | Use ImageResamplingAlgorithm instead. |
| RESAMPLE | Use ImageResamplingAlgorithm instead. |
| FLIP | Flip the image along the flipAxis. |
| ROTATE | Rotate the image around the rotationAngle. |
| THRESHOLDING | Thresholdsthe image according to the rangeThresholdParams. |
| INVERT | Invert all intensities in the image. |
| CROP | Crop the image dimensions according to the cropParams. |
| CONVERTGRAY | Convert a multichannel image to a single channel by averaging. |
| NORMALIZE | Convert the image to float by normalizing the value range of the image to [0,1]. |
| SHARPNESS | Compute the image sharpness and prints it to the console (see GlImageMetric) |
| REDUCE_BIT_DEPTH | Convert a 16-bit image to a 8-bit one. |
| GRADATION | Convert intensities according to the gradationMap. |
| EQUALIZE_HISTOGRAM | Perform a standard histogram equalization. |
| RESIZE | Use ImageResamplingAlgorithm instead. |
| EMBED_ROTATION | Similar to ROTATE but uses the image matrix. Only works if the rotation in the matrix is a multiple of 90° |
| SHIFT_N_SCALE | Set shift and scale of the image. |
| CONVERT_TO_FLOAT | Convert the image to float without normalizing it. |
| BRIGHTNESS_PRESERVING_HE | Brightness preserving histogram equalization (internal only, use at your own risk!) |
| BAYER_PATTERN_TO_COLOR | Convert a bayer pattern images to color coded images. |
| NR_MODES | Internal end marker of available modes, don't use directly! |
|
inline |
Set the flip axis.
0: X-axis 1: Y-axis 2: Z-axis
|
inline |
Set the rotation axis.
0: X-axis 1: Y-axis 2: Z-axis
| void setRangeThresholdParams | ( | bool | thresholdInside, |
| double | lowerThreshold, | ||
| double | upperThreshold ) |
Set the parameters for thresholding.
| thresholdInside | Whether the values inside the tresholding range should be assigned the value of 1 (true) or the values outside the range (false) |
|
inline |
If enabled, 16-bit values are clamped to 8-bit during REDUCE_BIT_DEPTH.
Otherwise 16-bit values are bit shifted by 8.
Factory method to check for applicability or to create the algorithm
|
inline |
Set the bayer pattern mode.
0: Bayer RGGB to RGB 1: Bayer GRBG to RGB 2: Bayer BGGR to RGB 3: Bayer GBRG to RGB
|
overridevirtual |
Applies the processing in the offline case.
Implements Algorithm.
|
overridevirtual |
Applies the processing to an individual image, used in stream processing case.
Implements SequentialImageProcessor.
|
overridevirtual |
If new data was created, make it available here.
Reimplemented from Algorithm.
|
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.
Reimplemented from Configurable.
|
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.
Reimplemented from Configurable.