TuttleOFX
1
|
Main class of the lens distortion. More...
#include <LensDistortPlugin.hpp>
Public Types | |
typedef double | Scalar |
typedef boost::gil::point2 < double > | Point2 |
Public Member Functions | |
LensDistortPlugin (OfxImageEffectHandle handle) | |
void | render (const OFX::RenderArguments &args) |
The overridden render function. | |
void | changedParam (const OFX::InstanceChangedArgs &args, const std::string ¶mName) |
called when a param has just had its value changed | |
bool | isIdentity (const OFX::RenderArguments &args, OFX::Clip *&identityClip, double &identityTime) |
client is identity function, returns the clip and time for the identity function | |
bool | getRegionOfDefinition (const OFX::RegionOfDefinitionArguments &args, OfxRectD &rod) |
The get RoD action. | |
void | getRegionsOfInterest (const OFX::RegionsOfInterestArguments &args, OFX::RegionOfInterestSetter &rois) |
the get region of interest action | |
LensDistortProcessParams< Scalar > | getProcessParams (const OfxRectD &inputRod, const OfxRectD &outputRod, const OfxRectD &optionalInputRod, const double pixelAspectRatio, const bool reverse=false) const |
LensDistortProcessParams< Scalar > | getProcessParams (const OfxRectD &inputRod, const OfxRectD &outputRod, const double pixelAspectRatio, const bool reverse=false) const |
LensDistortParams | getProcessParams () const |
const EParamLensType | getLensType () const |
const EParamCenterType | getCenterType () const |
const EParamResizeRod | getResizeRod () const |
Data Fields | |
OFX::Clip * | _srcRefClip |
OFX::BooleanParam * | _reverse |
reverse the effect | |
OFX::BooleanParam * | _displaySource |
do nothing (so host displays input) | |
OFX::ChoiceParam * | _lensType |
choice to select lens type | |
OFX::DoubleParam * | _coef1 |
distortion coeffiscient | |
OFX::DoubleParam * | _coef2 |
distortion coeffiscient for fish-eye lens | |
OFX::DoubleParam * | _squeeze |
squeeze coefficient horizontally/vertically (not implemented yet) | |
OFX::Double2DParam * | _asymmetric |
lens distortion is asymmetric horizontally/vertically (not implemented yet) | |
OFX::Double2DParam * | _center |
center coordonnates | |
OFX::BooleanParam * | _centerOverlay |
lens center overlay | |
OFX::ChoiceParam * | _centerType |
centered the lens distortion on source RoD or image size (not implemented yet) | |
OFX::DoubleParam * | _postScale |
scale after applying the lens distortion | |
OFX::DoubleParam * | _preScale |
scale before applying the lens distortion | |
OFX::ChoiceParam * | _resizeRod |
Choice how to resize the RoD (default 'no' resize) | |
OFX::DoubleParam * | _resizeRodManualScale |
scale the output RoD | |
OFX::GroupParam * | _groupDisplayParams |
group of all overlay options (don't modify the output image) | |
OFX::BooleanParam * | _gridOverlay |
grid overlay | |
OFX::Double2DParam * | _gridCenter |
grid center | |
OFX::BooleanParam * | _gridCenterOverlay |
grid center overlay | |
OFX::Double2DParam * | _gridScale |
grid scale | |
OFX::BooleanParam * | _debugDisplayRoi |
debug display options | |
Static Public Attributes | |
static OfxRectD | _dstRoi = { 0, 0, 0, 0 } |
static OfxRectD | _srcRoi = { 0, 0, 0, 0 } |
static OfxRectD | _srcRealRoi = { 0, 0, 0, 0 } |
Private Member Functions | |
void | initParamsProps () |
Main class of the lens distortion.
Definition at line 28 of file LensDistortPlugin.hpp.
typedef boost::gil::point2<double> tuttle::plugin::lens::LensDistortPlugin::Point2 |
Definition at line 32 of file LensDistortPlugin.hpp.
typedef double tuttle::plugin::lens::LensDistortPlugin::Scalar |
Definition at line 31 of file LensDistortPlugin.hpp.
tuttle::plugin::lens::LensDistortPlugin::LensDistortPlugin | ( | OfxImageEffectHandle | handle | ) |
Definition at line 20 of file LensDistortPlugin.cpp.
References _asymmetric, _center, _centerOverlay, _centerType, _coef1, _coef2, _debugDisplayRoi, _displaySource, _gridCenter, _gridCenterOverlay, _gridOverlay, _gridScale, _groupDisplayParams, _lensType, _postScale, _preScale, _resizeRod, _resizeRodManualScale, _reverse, _squeeze, _srcRefClip, OFX::ParamSet::fetchBooleanParam(), OFX::ParamSet::fetchChoiceParam(), OFX::ImageEffect::fetchClip(), OFX::ParamSet::fetchDouble2DParam(), OFX::ParamSet::fetchDoubleParam(), OFX::ParamSet::fetchGroupParam(), initParamsProps(), tuttle::plugin::lens::kClipOptionalSourceRef(), tuttle::plugin::lens::kParamAsymmetric(), tuttle::plugin::lens::kParamCenter(), tuttle::plugin::lens::kParamCenterOverlay(), tuttle::plugin::lens::kParamCenterType(), tuttle::plugin::lens::kParamCoef1(), tuttle::plugin::lens::kParamCoef2(), tuttle::plugin::lens::kParamDebugDisplayRoi(), tuttle::plugin::lens::kParamDisplayOptions(), tuttle::plugin::lens::kParamDisplaySource(), tuttle::plugin::lens::kParamGridCenter(), tuttle::plugin::lens::kParamGridCenterOverlay(), tuttle::plugin::lens::kParamGridOverlay(), tuttle::plugin::lens::kParamGridScale(), tuttle::plugin::lens::kParamLensType(), tuttle::plugin::lens::kParamPostScale(), tuttle::plugin::lens::kParamPreScale(), tuttle::plugin::lens::kParamResizeRod(), tuttle::plugin::lens::kParamResizeRodManualScale(), tuttle::plugin::lens::kParamReverse(), and tuttle::plugin::lens::kParamSqueeze().
void tuttle::plugin::lens::LensDistortPlugin::changedParam | ( | const OFX::InstanceChangedArgs & | args, |
const std::string & | paramName | ||
) | [virtual] |
called when a param has just had its value changed
Reimplemented from tuttle::plugin::SamplerPlugin.
Definition at line 67 of file LensDistortPlugin.cpp.
References _asymmetric, _coef2, _lensType, _resizeRod, _resizeRodManualScale, _squeeze, tuttle::plugin::lens::eParamResizeRodManual, OFX::ChoiceParam::getValue(), tuttle::plugin::lens::kParamGridCenter(), tuttle::plugin::lens::kParamGridOverlay(), tuttle::plugin::lens::kParamGridScale(), tuttle::plugin::lens::kParamLensType(), tuttle::plugin::lens::kParamResizeRod(), OFX::ImageEffect::redrawOverlays(), and OFX::Param::setIsSecret().
Referenced by initParamsProps().
const EParamCenterType tuttle::plugin::lens::LensDistortPlugin::getCenterType | ( | ) | const [inline] |
Definition at line 97 of file LensDistortPlugin.hpp.
References _centerType, and OFX::ChoiceParam::getValue().
Referenced by getProcessParams().
const EParamLensType tuttle::plugin::lens::LensDistortPlugin::getLensType | ( | ) | const [inline] |
Definition at line 96 of file LensDistortPlugin.hpp.
References _lensType, and OFX::ChoiceParam::getValue().
Referenced by tuttle::plugin::lens::LensDistortOverlayInteract::draw(), getRegionOfDefinition(), and getRegionsOfInterest().
LensDistortProcessParams< LensDistortPlugin::Scalar > tuttle::plugin::lens::LensDistortPlugin::getProcessParams | ( | const OfxRectD & | inputRod, |
const OfxRectD & | outputRod, | ||
const OfxRectD & | optionalInputRod, | ||
const double | pixelAspectRatio, | ||
const bool | reverse = false |
||
) | const |
Definition at line 327 of file LensDistortPlugin.cpp.
References _asymmetric, tuttle::plugin::lens::AdvancedLensDistortParams< F >::_asymmetric, _center, _coef1, tuttle::plugin::lens::NormalLensDistortParams< F >::_coef1, _coef2, tuttle::plugin::lens::FisheyeLensDistortParams< F >::_coef2, tuttle::plugin::lens::NormalLensDistortParams< F >::_distort, tuttle::plugin::lens::CoordonatesSystemParams< F >::_imgCenterDst, tuttle::plugin::lens::CoordonatesSystemParams< F >::_imgCenterSrc, tuttle::plugin::lens::CoordonatesSystemParams< F >::_imgHalfDiagonal, tuttle::plugin::lens::CoordonatesSystemParams< F >::_imgSizeSrc, tuttle::plugin::lens::NormalLensDistortParams< F >::_lensCenterDst, tuttle::plugin::lens::NormalLensDistortParams< F >::_lensCenterSrc, tuttle::plugin::lens::CoordonatesSystemParams< F >::_pixelRatio, _postScale, tuttle::plugin::lens::NormalLensDistortParams< F >::_postScale, _preScale, tuttle::plugin::lens::NormalLensDistortParams< F >::_preScale, _reverse, _squeeze, tuttle::plugin::lens::AdvancedLensDistortParams< F >::_squeeze, tuttle::plugin::lens::eParamCenterTypeRoW, tuttle::plugin::lens::eParamCenterTypeSource, getCenterType(), OFX::DoubleParam::getValue(), OFX::Double2DParam::getValue(), OFX::BooleanParam::getValue(), tuttle::plugin::ofxToGil(), tuttle::plugin::pointNormalizedXXcToCanonicalXY(), OfxRectD::x1, OfxRectD::x2, OfxRectD::y1, and OfxRectD::y2.
Referenced by tuttle::plugin::lens::LensDistortOverlayInteract::draw().
LensDistortProcessParams<Scalar> tuttle::plugin::lens::LensDistortPlugin::getProcessParams | ( | const OfxRectD & | inputRod, |
const OfxRectD & | outputRod, | ||
const double | pixelAspectRatio, | ||
const bool | reverse = false |
||
) | const [inline] |
Definition at line 87 of file LensDistortPlugin.hpp.
References getProcessParams().
LensDistortParams tuttle::plugin::lens::LensDistortPlugin::getProcessParams | ( | ) | const |
Definition at line 393 of file LensDistortPlugin.cpp.
References tuttle::plugin::lens::LensDistortParams::_centerType, _centerType, tuttle::plugin::lens::LensDistortParams::_lensType, _lensType, tuttle::plugin::lens::LensDistortParams::_samplerProcessParams, and tuttle::plugin::SamplerPlugin::fillProcessParams().
Referenced by getProcessParams(), getRegionOfDefinition(), and getRegionsOfInterest().
bool tuttle::plugin::lens::LensDistortPlugin::getRegionOfDefinition | ( | const OFX::RegionOfDefinitionArguments & | args, |
OfxRectD & | rod | ||
) | [virtual] |
The get RoD action.
If the effect wants change the rod from the default value (which is the union of RoD's of all input clips) it should set the rod argument and return true.
This is all in cannonical coordinates.
Reimplemented from OFX::ImageEffect.
Definition at line 150 of file LensDistortPlugin.cpp.
References tuttle::plugin::ImageEffectGilPlugin::_clipDst, tuttle::plugin::ImageEffectGilPlugin::_clipSrc, tuttle::plugin::lens::NormalLensDistortParams< F >::_lensCenterSrc, _resizeRod, _resizeRodManualScale, _srcRefClip, tuttle::plugin::lens::eParamResizeRodManual, tuttle::plugin::lens::eParamResizeRodMax, tuttle::plugin::lens::eParamResizeRodMin, tuttle::plugin::lens::eParamResizeRodNo, tuttle::plugin::lens::eParamResizeRodSourceRef, OFX::Clip::getCanonicalRod(), getLensType(), OFX::Clip::getPixelAspectRatio(), getProcessParams(), OFX::DoubleParam::getValue(), OFX::ChoiceParam::getValue(), OFX::Clip::isConnected(), tuttle::max(), tuttle::min(), tuttle::plugin::viewer::scale, OFX::RegionOfDefinitionArguments::time, tuttle::plugin::lens::transformValues(), OfxRectD::x1, OfxRectD::x2, OfxRectD::y1, and OfxRectD::y2.
void tuttle::plugin::lens::LensDistortPlugin::getRegionsOfInterest | ( | const OFX::RegionsOfInterestArguments & | args, |
OFX::RegionOfInterestSetter & | rois | ||
) | [virtual] |
the get region of interest action
the get RoI action
If the effect wants change its region of interest on any input clip from the default values (which is the same as the RoI in the arguments) it should do so by calling the OFX::RegionOfInterestSetter::setRegionOfInterest function on the rois argument.
Note, everything is in cannonical coordinates.
Reimplemented from OFX::ImageEffect.
Definition at line 241 of file LensDistortPlugin.cpp.
References tuttle::plugin::ImageEffectGilPlugin::_clipDst, tuttle::plugin::ImageEffectGilPlugin::_clipSrc, _debugDisplayRoi, _dstRoi, _srcRealRoi, _srcRefClip, _srcRoi, terry::sampler::eParamFilterBC, terry::sampler::eParamFilterBicubic, terry::sampler::eParamFilterBilinear, terry::sampler::eParamFilterCatrom, terry::sampler::eParamFilterGaussian, terry::sampler::eParamFilterKeys, terry::sampler::eParamFilterLanczos, terry::sampler::eParamFilterLanczos12, terry::sampler::eParamFilterLanczos3, terry::sampler::eParamFilterLanczos4, terry::sampler::eParamFilterLanczos6, terry::sampler::eParamFilterMitchell, terry::sampler::eParamFilterNearest, terry::sampler::eParamFilterParzen, terry::sampler::eParamFilterRifman, terry::sampler::eParamFilterSimon, OFX::Clip::getCanonicalRod(), tuttle::plugin::SamplerPlugin::getInterpolation(), getLensType(), OFX::Clip::getPixelAspectRatio(), getProcessParams(), OFX::BooleanParam::getValue(), OFX::Clip::isConnected(), tuttle::rectanglesIntersection(), OFX::RegionsOfInterestArguments::regionOfInterest, OFX::RegionOfInterestSetter::setRegionOfInterest(), OFX::RegionsOfInterestArguments::time, tuttle::plugin::lens::transformValues(), OfxRectD::x1, OfxRectD::x2, OfxRectD::y1, and OfxRectD::y2.
const EParamResizeRod tuttle::plugin::lens::LensDistortPlugin::getResizeRod | ( | ) | const [inline] |
Definition at line 98 of file LensDistortPlugin.hpp.
References _resizeRod, and OFX::ChoiceParam::getValue().
void tuttle::plugin::lens::LensDistortPlugin::initParamsProps | ( | ) | [private] |
Definition at line 49 of file LensDistortPlugin.cpp.
References changedParam(), tuttle::plugin::kParamFilter, tuttle::plugin::lens::kParamLensType(), and tuttle::plugin::lens::kParamResizeRod().
Referenced by LensDistortPlugin().
bool tuttle::plugin::lens::LensDistortPlugin::isIdentity | ( | const OFX::RenderArguments & | args, |
OFX::Clip *& | identityClip, | ||
double & | identityTime | ||
) | [virtual] |
client is identity function, returns the clip and time for the identity function
If the effect would do no processing for the given param set and render arguments, then this function should return true and set the identityClip pointer to point to the clip that is the identity and identityTime to be the time at which to access the clip for the identity operation.
Reimplemented from OFX::ImageEffect.
Definition at line 124 of file LensDistortPlugin.cpp.
References _asymmetric, tuttle::plugin::ImageEffectGilPlugin::_clipSrc, _coef1, _coef2, _displaySource, _postScale, _preScale, _squeeze, OFX::DoubleParam::getDefault(), OFX::Double2DParam::getDefault(), OFX::Param::getIsEnable(), OFX::DoubleParam::getValue(), OFX::Double2DParam::getValue(), OFX::BooleanParam::getValue(), and OFX::RenderArguments::time.
void tuttle::plugin::lens::LensDistortPlugin::render | ( | const OFX::RenderArguments & | args | ) | [virtual] |
The overridden render function.
[in] | args | Rendering parameters |
Implements OFX::ImageEffect.
Definition at line 62 of file LensDistortPlugin.cpp.
lens distortion is asymmetric horizontally/vertically (not implemented yet)
Definition at line 46 of file LensDistortPlugin.hpp.
Referenced by changedParam(), getProcessParams(), isIdentity(), and LensDistortPlugin().
center coordonnates
Definition at line 47 of file LensDistortPlugin.hpp.
Referenced by getProcessParams(), tuttle::plugin::lens::LensDistortOverlayInteract::LensDistortOverlayInteract(), and LensDistortPlugin().
lens center overlay
Definition at line 48 of file LensDistortPlugin.hpp.
Referenced by tuttle::plugin::lens::LensDistortOverlayInteract::LensDistortOverlayInteract(), and LensDistortPlugin().
centered the lens distortion on source RoD or image size (not implemented yet)
Definition at line 49 of file LensDistortPlugin.hpp.
Referenced by getCenterType(), getProcessParams(), and LensDistortPlugin().
distortion coeffiscient
Definition at line 43 of file LensDistortPlugin.hpp.
Referenced by getProcessParams(), isIdentity(), and LensDistortPlugin().
distortion coeffiscient for fish-eye lens
Definition at line 44 of file LensDistortPlugin.hpp.
Referenced by changedParam(), getProcessParams(), isIdentity(), and LensDistortPlugin().
debug display options
Definition at line 61 of file LensDistortPlugin.hpp.
Referenced by tuttle::plugin::lens::LensDistortOverlayInteract::draw(), getRegionsOfInterest(), and LensDistortPlugin().
do nothing (so host displays input)
Definition at line 41 of file LensDistortPlugin.hpp.
Referenced by tuttle::plugin::lens::LensDistortOverlayInteract::draw(), isIdentity(), and LensDistortPlugin().
OfxRectD tuttle::plugin::lens::LensDistortPlugin::_dstRoi = { 0, 0, 0, 0 } [static] |
can't use static because it's common to all plugin instances... so it's not perfect but it's just here for debug purpose (used in overlay)
Definition at line 68 of file LensDistortPlugin.hpp.
Referenced by tuttle::plugin::lens::LensDistortOverlayInteract::draw(), and getRegionsOfInterest().
grid center
Definition at line 57 of file LensDistortPlugin.hpp.
Referenced by tuttle::plugin::lens::LensDistortOverlayInteract::draw(), tuttle::plugin::lens::LensDistortOverlayInteract::LensDistortOverlayInteract(), and LensDistortPlugin().
grid center overlay
Definition at line 58 of file LensDistortPlugin.hpp.
Referenced by tuttle::plugin::lens::LensDistortOverlayInteract::LensDistortOverlayInteract(), and LensDistortPlugin().
grid overlay
Definition at line 56 of file LensDistortPlugin.hpp.
Referenced by tuttle::plugin::lens::LensDistortOverlayInteract::draw(), and LensDistortPlugin().
grid scale
Definition at line 59 of file LensDistortPlugin.hpp.
Referenced by tuttle::plugin::lens::LensDistortOverlayInteract::draw(), and LensDistortPlugin().
group of all overlay options (don't modify the output image)
Definition at line 55 of file LensDistortPlugin.hpp.
Referenced by LensDistortPlugin().
choice to select lens type
Definition at line 42 of file LensDistortPlugin.hpp.
Referenced by changedParam(), getLensType(), getProcessParams(), and LensDistortPlugin().
scale after applying the lens distortion
Definition at line 50 of file LensDistortPlugin.hpp.
Referenced by getProcessParams(), isIdentity(), and LensDistortPlugin().
scale before applying the lens distortion
Definition at line 51 of file LensDistortPlugin.hpp.
Referenced by getProcessParams(), isIdentity(), and LensDistortPlugin().
Choice how to resize the RoD (default 'no' resize)
Definition at line 52 of file LensDistortPlugin.hpp.
Referenced by changedParam(), getRegionOfDefinition(), getResizeRod(), and LensDistortPlugin().
scale the output RoD
Definition at line 53 of file LensDistortPlugin.hpp.
Referenced by changedParam(), getRegionOfDefinition(), and LensDistortPlugin().
reverse the effect
Definition at line 40 of file LensDistortPlugin.hpp.
Referenced by getProcessParams(), and LensDistortPlugin().
squeeze coefficient horizontally/vertically (not implemented yet)
Definition at line 45 of file LensDistortPlugin.hpp.
Referenced by changedParam(), getProcessParams(), isIdentity(), and LensDistortPlugin().
OfxRectD tuttle::plugin::lens::LensDistortPlugin::_srcRealRoi = { 0, 0, 0, 0 } [static] |
Definition at line 70 of file LensDistortPlugin.hpp.
Referenced by tuttle::plugin::lens::LensDistortOverlayInteract::draw(), and getRegionsOfInterest().
source ref image clip
Definition at line 36 of file LensDistortPlugin.hpp.
Referenced by tuttle::plugin::lens::LensDistortOverlayInteract::draw(), getRegionOfDefinition(), getRegionsOfInterest(), tuttle::plugin::lens::LensDistortOverlayInteract::LensDistortOverlayInteract(), and LensDistortPlugin().
OfxRectD tuttle::plugin::lens::LensDistortPlugin::_srcRoi = { 0, 0, 0, 0 } [static] |
Definition at line 69 of file LensDistortPlugin.hpp.
Referenced by tuttle::plugin::lens::LensDistortOverlayInteract::draw(), and getRegionsOfInterest().