/** * @brief Function called to describe the plugin controls and features. * @param[in, out] desc Effect descriptor * @param[in] context Application context */ void DiffPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, OFX::EContext context ) { OFX::ClipDescriptor* srcClipA = desc.defineClip( kDiffSourceA ); assert( srcClipA ); srcClipA->addSupportedComponent( OFX::ePixelComponentRGBA ); srcClipA->addSupportedComponent( OFX::ePixelComponentAlpha ); srcClipA->setSupportsTiles( kSupportTiles ); srcClipA->setOptional( false ); OFX::ClipDescriptor* srcClipB = desc.defineClip( kDiffSourceB ); assert( srcClipB ); srcClipB->addSupportedComponent( OFX::ePixelComponentRGBA ); srcClipB->addSupportedComponent( OFX::ePixelComponentAlpha ); srcClipB->setSupportsTiles( kSupportTiles ); srcClipB->setOptional( false ); // Create the mandated output clip OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); assert( dstClip ); dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); dstClip->setSupportsTiles( kSupportTiles ); OFX::ChoiceParamDescriptor* diffFunction = desc.defineChoiceParam( kMeasureFunction ); assert( diffFunction ); diffFunction->setLabel( "Quality mesure function" ); diffFunction->appendOption( "PSNR (Peak Signal to Noise Ratio)" ); // diffFunction->appendOption( "MSE (Mean Square Error)" ); // diffFunction->appendOption( "SSIM (Structural SIMilarity)" ); diffFunction->setDefault( 0 ); OFX::RGBAParamDescriptor* outputQualityMesure = desc.defineRGBAParam( kOutputQualityMesure ); assert( outputQualityMesure ); outputQualityMesure->setLabel( "Quality" ); outputQualityMesure->setEvaluateOnChange( false ); // OFX::PushButtonParamDescriptor* helpButton = desc.definePushButtonParam( kHelpButton ); // assert( helpButton ); // helpButton->setLabel( "Help" ); }
OFX::PageParamDescriptor* CImgFilterPluginHelperBase::describeInContextBegin(bool sourceIsOptional, OFX::ImageEffectDescriptor &desc, OFX::ContextEnum context, bool supportsRGBA, bool supportsRGB, bool supportsXY, bool supportsAlpha, bool supportsTiles, bool processRGB, bool processAlpha, bool processIsSecret) { #ifdef OFX_EXTENSIONS_NATRON desc.setChannelSelector(OFX::ePixelComponentNone); // we have our own channel selector #endif OFX::ClipDescriptor *srcClip = desc.defineClip(kOfxImageEffectSimpleSourceClipName); if (supportsRGBA) { srcClip->addSupportedComponent(OFX::ePixelComponentRGBA); } if (supportsRGB) { srcClip->addSupportedComponent(OFX::ePixelComponentRGB); } if (supportsXY) { srcClip->addSupportedComponent(OFX::ePixelComponentXY); } if (supportsAlpha) { srcClip->addSupportedComponent(OFX::ePixelComponentAlpha); } srcClip->setTemporalClipAccess(false); srcClip->setSupportsTiles(supportsTiles); srcClip->setIsMask(false); if (context == OFX::eContextGeneral && sourceIsOptional) { srcClip->setOptional(sourceIsOptional); } OFX::ClipDescriptor *dstClip = desc.defineClip(kOfxImageEffectOutputClipName); if (supportsRGBA) { dstClip->addSupportedComponent(OFX::ePixelComponentRGBA); } if (supportsRGB) { dstClip->addSupportedComponent(OFX::ePixelComponentRGB); } if (supportsXY) { dstClip->addSupportedComponent(OFX::ePixelComponentXY); } if (supportsAlpha) { dstClip->addSupportedComponent(OFX::ePixelComponentAlpha); } dstClip->setSupportsTiles(supportsTiles); OFX::ClipDescriptor *maskClip = (context == OFX::eContextPaint) ? desc.defineClip("Brush") : desc.defineClip("Mask"); maskClip->addSupportedComponent(OFX::ePixelComponentAlpha); maskClip->setTemporalClipAccess(false); if (context != OFX::eContextPaint) { maskClip->setOptional(true); } maskClip->setSupportsTiles(supportsTiles); maskClip->setIsMask(true); // create the params OFX::PageParamDescriptor *page = desc.definePageParam("Controls"); { OFX::BooleanParamDescriptor* param = desc.defineBooleanParam(kNatronOfxParamProcessR); param->setLabel(kNatronOfxParamProcessRLabel); param->setHint(kNatronOfxParamProcessRHint); param->setDefault(processRGB); param->setIsSecret(processIsSecret); param->setLayoutHint(OFX::eLayoutHintNoNewLine); if (page) { page->addChild(*param); } } { OFX::BooleanParamDescriptor* param = desc.defineBooleanParam(kNatronOfxParamProcessG); param->setLabel(kNatronOfxParamProcessGLabel); param->setHint(kNatronOfxParamProcessGHint); param->setDefault(processRGB); param->setIsSecret(processIsSecret); param->setLayoutHint(OFX::eLayoutHintNoNewLine); if (page) { page->addChild(*param); } } { OFX::BooleanParamDescriptor* param = desc.defineBooleanParam(kNatronOfxParamProcessB); param->setLabel(kNatronOfxParamProcessBLabel); param->setHint(kNatronOfxParamProcessBHint); param->setDefault(processRGB); param->setIsSecret(processIsSecret); param->setLayoutHint(OFX::eLayoutHintNoNewLine); if (page) { page->addChild(*param); } } { OFX::BooleanParamDescriptor* param = desc.defineBooleanParam(kNatronOfxParamProcessA); param->setLabel(kNatronOfxParamProcessALabel); param->setHint(kNatronOfxParamProcessAHint); param->setDefault(processAlpha); param->setIsSecret(processIsSecret); if (page) { page->addChild(*param); } } return page; }
/** * @brief Function called to describe the plugin controls and features. * @param[in, out] desc Effect descriptor * @param[in] context Application context */ void PushPixelPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, OFX::EContext context ) { // Create the mandated output clip OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); dstClip->setSupportsTiles( kSupportTiles ); OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName ); srcClip->addSupportedComponent( OFX::ePixelComponentRGBA ); srcClip->addSupportedComponent( OFX::ePixelComponentAlpha ); // no tiles on src clip, because it depends on the mask content so we can't // define the maximal bounding box needed... srcClip->setSupportsTiles( false ); OFX::ClipDescriptor* maskClip = desc.defineClip( kClipMask ); maskClip->addSupportedComponent( OFX::ePixelComponentRGBA ); maskClip->addSupportedComponent( OFX::ePixelComponentAlpha ); maskClip->setIsMask( true ); maskClip->setOptional( true ); maskClip->setSupportsTiles( true ); OFX::ChoiceParamDescriptor* output = desc.defineChoiceParam( kParamOutput ); output->setLabel( "Output" ); output->appendOption( kParamOutputMotionVectors ); output->appendOption( kParamOutputPushPixel ); output->setDefault( 1 ); OFX::DoubleParamDescriptor* size = desc.defineDoubleParam( kParamSize ); size->setLabel( "Size" ); size->setHint( "Size of the gradient window." ); size->setRange( 0.0, std::numeric_limits<double>::max() ); size->setDisplayRange( 1.0, 10.0 ); size->setDefault( 2.0 ); OFX::BooleanParamDescriptor* normalizedKernel = desc.defineBooleanParam( kParamNormalizedKernel ); normalizedKernel->setLabel( "Normalized kernel" ); normalizedKernel->setHint( "Use a normalized kernel to compute the gradient." ); normalizedKernel->setDefault( true ); //#ifndef TUTTLE_PRODUCTION normalizedKernel->setIsSecret( true ); //#endif OFX::DoubleParamDescriptor* intensity = desc.defineDoubleParam( kParamIntensity ); intensity->setLabel( "Intensity" ); intensity->setHint( "Scale motion vectors." ); intensity->setDisplayRange( 0.0, 2.0 ); intensity->setDefault( 0.75 ); OFX::DoubleParamDescriptor* angle = desc.defineDoubleParam( kParamAngle ); angle->setLabel( "Angle" ); angle->setHint( "Rotation on the gradient." ); angle->setDisplayRange(-180, 180); angle->setDoubleType( OFX::eDoubleTypeAngle ); angle->setDefault( 0.0 ); OFX::ChoiceParamDescriptor* interpolation = desc.defineChoiceParam( kParamInterpolation ); interpolation->setLabel( "Interpolation" ); interpolation->setHint( "Interpolation method." ); interpolation->appendOption( kParamInterpolationNearest ); interpolation->appendOption( kParamInterpolationBilinear ); interpolation->setDefault( 1 ); OFX::ChoiceParamDescriptor* border = desc.defineChoiceParam( kParamBorder ); border->setLabel( "Gradient border" ); border->setHint( "Border method for gradient computation." ); border->appendOption( kParamBorderMirror ); border->appendOption( kParamBorderConstant ); border->appendOption( kParamBorderBlack ); border->appendOption( kParamBorderPadded ); }
/** * @brief Function called to describe the plugin controls and features. * @param[in, out] desc Effect descriptor * @param[in] context Application context */ void ColorTransferPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, OFX::EContext context ) { OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName ); srcClip->addSupportedComponent( OFX::ePixelComponentRGBA ); srcClip->addSupportedComponent( OFX::ePixelComponentRGB ); // srcClip->addSupportedComponent( OFX::ePixelComponentAlpha ); srcClip->setSupportsTiles( true ); // Create the mandated output clip OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); dstClip->addSupportedComponent( OFX::ePixelComponentRGB ); // dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); dstClip->setSupportsTiles( true ); OFX::ClipDescriptor* srcRefClip = desc.defineClip( kClipSrcRef ); srcRefClip->addSupportedComponent( OFX::ePixelComponentRGBA ); srcRefClip->addSupportedComponent( OFX::ePixelComponentRGB ); // srcRefClip->addSupportedComponent( OFX::ePixelComponentAlpha ); srcRefClip->setSupportsTiles( false ); srcRefClip->setOptional( true ); OFX::ClipDescriptor* dstRefClip = desc.defineClip( kClipDstRef ); dstRefClip->addSupportedComponent( OFX::ePixelComponentRGBA ); dstRefClip->addSupportedComponent( OFX::ePixelComponentRGB ); // dstRefClip->addSupportedComponent( OFX::ePixelComponentAlpha ); dstRefClip->setSupportsTiles( false ); OFX::ChoiceParamDescriptor* colorspace = desc.defineChoiceParam( kParamColorspace ); colorspace->setLabel( "Transformation colorspace" ); colorspace->setHint( "Select colorspace in which to apply the transformation" ); colorspace->appendOption( kParamColorspaceNone, "without colorspace transformation" ); colorspace->appendOption( kParamColorspaceLMS, "apply correction in LMS colorspace" ); colorspace->appendOption( kParamColorspaceLab, "apply correction in L(alpha)(beta) colorspace" ); colorspace->setDefault( eColorspaceLab ); OFX::DoubleParamDescriptor* averageCoef = desc.defineDoubleParam( kParamAverageCoef ); averageCoef->setLabel( "Average color coef" ); averageCoef->setDisplayRange( 0.0, 1.0 ); averageCoef->setDefault( 0.8 ); averageCoef->setHint( "Percentage of correction of the average color.\n" "It is often advantageous to reduce this ratio, " "especially if the two images are very different. " "Typical values are between 0.5 and 0.8." ); OFX::DoubleParamDescriptor* dynamicCoef = desc.defineDoubleParam( kParamDynamicCoef ); dynamicCoef->setLabel( "Dynamic coef" ); dynamicCoef->setDisplayRange( 0.0, 1.0 ); dynamicCoef->setDefault( 1.0 ); dynamicCoef->setHint( "Percentage of correction of the standard deviation." ); // // output region // OFX::Double2DParamDescriptor* regionA = desc.defineDouble2DParam( kParamRegionA ); // regionA->setLabel( "Region" ); // regionA->setDefault( -0.5, -0.5 ); // regionA->setIsSecret( true ); ///< @todo // OFX::Double2DParamDescriptor* regionB = desc.defineDouble2DParam( kParamRegionB ); // regionB->setLabel( "" ); // regionB->setDefault( 0.5, 0.5 ); // regionB->setIsSecret( true ); ///< @todo // // // same region // OFX::BooleanParamDescriptor* sameRegion = desc.defineBooleanParam( kParamSameRegion ); // sameRegion->setDefault( true ); // sameRegion->setIsSecret( true ); ///< @todo // // // input region // OFX::Double2DParamDescriptor* inputRegionA = desc.defineDouble2DParam( kParamInputRegionA ); // inputRegionA->setLabel( "Input region" ); // inputRegionA->setDefault( -0.5, -0.5 ); // inputRegionA->setIsSecret( true ); ///< @todo // OFX::Double2DParamDescriptor* inputRegionB = desc.defineDouble2DParam( kParamInputRegionB ); // inputRegionB->setLabel( "" ); // inputRegionB->setDefault( 0.5, 0.5 ); // inputRegionB->setIsSecret( true ); ///< @todo }
/** * @brief Function called to describe the plugin controls and features. * @param[in, out] desc Effect descriptor * @param[in] context Application context */ void TextPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, OFX::EContext context ) { OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName ); srcClip->addSupportedComponent( OFX::ePixelComponentRGBA ); srcClip->addSupportedComponent( OFX::ePixelComponentRGB ); srcClip->addSupportedComponent( OFX::ePixelComponentAlpha ); srcClip->setSupportsTiles( kSupportTiles ); srcClip->setOptional(true); // Create the mandated output clip OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); dstClip->addSupportedComponent( OFX::ePixelComponentRGB ); dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); dstClip->setSupportsTiles( kSupportTiles ); OFX::StringParamDescriptor* text = desc.defineStringParam( kParamText ); text->setLabel( "Text" ); text->setStringType( OFX::eStringTypeMultiLine ); OFX::BooleanParamDescriptor* isExpression = desc.defineBooleanParam( kParamIsExpression ); isExpression->setLabel( "Expression" ); isExpression->setHint( "If you check this parameter the text must be a python code.\n" "The final result must be in a variable with the name of the parameter.\n" "Example:\n" "from math import *\n" //+ kParamText + "text = 'At frame '+str(time)+', value is ' + str( sin(time) )\n" ); isExpression->setDefault( false ); OFX::StringParamDescriptor* font = desc.defineStringParam( kParamFont ); font->setLabel( "Font file" ); font->setStringType( OFX::eStringTypeFilePath ); font->setDefault( "/usr/share/fonts/truetype/msttcorefonts/arial.ttf" ); OFX::IntParamDescriptor* size = desc.defineIntParam( kParamSize ); size->setLabel( "Size" ); size->setDefault( 18 ); size->setRange( 0, std::numeric_limits<int>::max() ); size->setDisplayRange( 0, 60 ); OFX::DoubleParamDescriptor* ratio = desc.defineDoubleParam( kParamRatio ); ratio->setLabel( "Ratio" ); ratio->setRange( 0.0, std::numeric_limits<double>::max() ); ratio->setDisplayRange( 0.0, 2.0 ); ratio->setDefault( 1.0 ); OFX::RGBAParamDescriptor* color = desc.defineRGBAParam( kParamColor ); color->setLabel( "Color" ); color->setDefault( 1.0, 1.0, 1.0, 1.0 ); OFX::Double2DParamDescriptor* position = desc.defineDouble2DParam( kParamPosition ); position->setLabel( "Position" ); position->setDefault( 0.0, 0.0 ); OFX::DoubleParamDescriptor* letterSpacing = desc.defineDoubleParam( kParamLetterSpacing ); letterSpacing->setLabel( "Letter spacing" ); letterSpacing->setDisplayRange( -10.0, 10.0 ); letterSpacing->setDefault( 0.0 ); OFX::ChoiceParamDescriptor* vAlign = desc.defineChoiceParam( kParamVAlign ); vAlign->setLabel( "Vertically align" ); vAlign->appendOption( kParamVAlignTop ); vAlign->appendOption( kParamVAlignCenter ); vAlign->appendOption( kParamVAlignBottom ); vAlign->setDefault( eParamVAlignCenter ); OFX::ChoiceParamDescriptor* hAlign = desc.defineChoiceParam( kParamHAlign ); hAlign->setLabel( "Horizontally align" ); hAlign->appendOption( kParamHAlignLeft ); hAlign->appendOption( kParamHAlignCenter ); hAlign->appendOption( kParamHAlignRight ); hAlign->setDefault( eParamHAlignCenter ); OFX::BooleanParamDescriptor* verticalFlip = desc.defineBooleanParam( kParamVerticalFlip ); verticalFlip->setLabel( "Vertical flip" ); verticalFlip->setDefault( false ); verticalFlip->setAnimates( false ); verticalFlip->setHint( "Some hosts use inverted images, so you can correct this problem using this flag." ); }
void LensCalibrationPluginFactory::describeInContext(OFX::ImageEffectDescriptor& desc, OFX::ContextEnum context) { //Input Clip OFX::ClipDescriptor *srcClip = desc.defineClip(kOfxImageEffectSimpleSourceClipName); srcClip->addSupportedComponent(OFX::ePixelComponentRGBA); srcClip->setTemporalClipAccess(false); srcClip->setSupportsTiles(false); srcClip->setIsMask(false); srcClip->setOptional(false); //Output clip OFX::ClipDescriptor *dstClip = desc.defineClip(kOfxImageEffectOutputClipName); dstClip->addSupportedComponent(OFX::ePixelComponentRGBA); dstClip->setSupportsTiles(false); //Calibration Group { OFX::GroupParamDescriptor *groupCalibration = desc.defineGroupParam(kParamGroupCalibration); groupCalibration->setLabel("Calibration"); groupCalibration->setAsTab(); { OFX::Int2DParamDescriptor *param = desc.defineInt2DParam(kParamImageSize); param->setLabel("Image Size"); param->setHint("Input image size used to calibrate the optics. Obviously, all images should have the same size."); param->setDefault(0, 0); param->setDisplayRange(0, 0, 10000, 10000); param->setAnimates(false); param->setParent(*groupCalibration); param->setEnabled(false); // should not be edited by the user } { OFX::BooleanParamDescriptor *param = desc.defineBooleanParam(kParamInputImageIsGray); param->setLabel("Input image is gray"); param->setHint("Input image is gray"); param->setParent(*groupCalibration); } { OFX::ChoiceParamDescriptor *param = desc.defineChoiceParam(kParamPatternType); param->setLabel("Pattern Type"); param->setHint("Type of pattern to detect"); param->appendOptions(kStringParamPatternType); param->setDefault(eParamPatternTypeChessboard); param->setAnimates(false); param->setParent(*groupCalibration); } { OFX::Int2DParamDescriptor *param = desc.defineInt2DParam(kParamPatternSize); param->setLabel("Pattern Size"); param->setHint("Number of inner corners per one of board dimension Width Height"); param->setDefault(10, 7); param->setRange(2, 2, kOfxFlagInfiniteMax, kOfxFlagInfiniteMax); param->setDisplayRange(2, 2, 15, 15); param->setAnimates(false); param->setParent(*groupCalibration); } { OFX::DoubleParamDescriptor *param = desc.defineDoubleParam(kParamSquareSize); param->setLabel("Square Size"); param->setHint("Define the size of the grid's square cells (mm)"); param->setDisplayRange(0, 100); param->setDefault(1); param->setAnimates(false); param->setParent(*groupCalibration); param->setLayoutHint(OFX::eLayoutHintDivider); } { OFX::IntParamDescriptor *param = desc.defineIntParam(kParamNbRadialCoef); param->setLabel("Nb Radial Coef"); param->setHint("Number of radial coefficient."); param->setRange(0, 6); param->setDisplayRange(0, 6); param->setDefault(3); param->setAnimates(false); param->setParent(*groupCalibration); } { OFX::IntParamDescriptor *param = desc.defineIntParam(kParamMaxFrames); param->setLabel("Max Frames"); param->setHint("Maximal number of frames to extract from the video file."); param->setRange(0, kOfxFlagInfiniteMax); param->setDisplayRange(0, 1000); param->setDefault(0); param->setAnimates(false); param->setParent(*groupCalibration); } { OFX::IntParamDescriptor *param = desc.defineIntParam(kParamMaxCalibFrames); param->setLabel("Max Calibration Frames"); param->setHint("Maximal number of frames to use to calibrate from the selected frames."); param->setRange(0, kOfxFlagInfiniteMax); param->setDisplayRange(0, 1000); param->setDefault(100); param->setAnimates(false); param->setParent(*groupCalibration); } { OFX::IntParamDescriptor *param = desc.defineIntParam(kParamCalibGridSize); param->setLabel("Max Calibration Grid Size"); param->setHint("Define the number of cells per edge."); param->setRange(0, kOfxFlagInfiniteMax); param->setDisplayRange(0, 100); param->setDefault(10); param->setAnimates(false); param->setParent(*groupCalibration); } { OFX::IntParamDescriptor *param = desc.defineIntParam(kParamMinInputFrames); param->setLabel("Min Input Frames"); param->setHint("Minimal number of frames to limit the calibration refinement loop."); param->setRange(0, kOfxFlagInfiniteMax); param->setDisplayRange(0, 1000); param->setDefault(10); param->setAnimates(false); param->setParent(*groupCalibration); } { OFX::DoubleParamDescriptor *param = desc.defineDoubleParam(kParamMaxTotalAvgErr); param->setLabel("Max Total Average Error"); param->setHint("Maximal limit of the total average error"); param->setRange(0, 1); param->setDisplayRange(0, 1); param->setDefault(0.1); param->setAnimates(false); param->setParent(*groupCalibration); } { OFX::PushButtonParamDescriptor *param = desc.definePushButtonParam(kParamCalibrate); param->setLabel("Calibrate"); param->setHint("calibrate"); param->setParent(*groupCalibration); } } //Output Group { OFX::GroupParamDescriptor *groupOutput = desc.defineGroupParam(kParamGroupOutput); groupOutput->setLabel("Output"); groupOutput->setAsTab(); { OFX::BooleanParamDescriptor *param = desc.defineBooleanParam(kParamOutputIsCalibrated); param->setLabel("Is calibrated"); param->setHint("Is calibrated"); param->setParent(*groupOutput); } { OFX::DoubleParamDescriptor *param = desc.defineDoubleParam(kParamOutputAvgReprojErr); param->setLabel("Average Reprojection Error"); param->setDisplayRange(0, 10); param->setEvaluateOnChange(false); param->setEnabled(false); param->setAnimates(true); param->setParent(*groupOutput); param->setLayoutHint(OFX::eLayoutHintDivider); } { OFX::GroupParamDescriptor *groupCamera = desc.defineGroupParam(kParamOutputCameraGroup); groupCamera->setLabel("Intrinsics Camera Parameters"); groupCamera->setParent(*groupOutput); groupCamera->setOpen(true); { OFX::DoubleParamDescriptor *param = desc.defineDoubleParam(kParamOutputFocalLenght); param->setLabel("Focal Length"); param->setDisplayRange(1, 100); param->setAnimates(true); param->setEvaluateOnChange(false); param->setEnabled(false); param->setAnimates(false); param->setParent(*groupCamera); } { OFX::Double2DParamDescriptor *param = desc.defineDouble2DParam(kParamOutputPrincipalPointOffset); param->setLabel("Principal Point"); param->setAnimates(true); param->setEvaluateOnChange(false); param->setEnabled(false); param->setAnimates(false); param->setParent(*groupCamera); } } { OFX::GroupParamDescriptor *groupLensDistortion = desc.defineGroupParam(kParamOutputLensDistortionGroup); groupLensDistortion->setLabel("Lens Distortion Coefficients"); groupLensDistortion->setParent(*groupOutput); groupLensDistortion->setOpen(true); { OFX::DoubleParamDescriptor *param = desc.defineDoubleParam(kParamOutputRadialCoef1); param->setLabel("Radial Coef1"); param->setDisplayRange(0, 10); param->setAnimates(true); param->setEvaluateOnChange(false); param->setEnabled(false); param->setAnimates(false); param->setParent(*groupLensDistortion); } { OFX::DoubleParamDescriptor *param = desc.defineDoubleParam(kParamOutputRadialCoef2); param->setLabel("Radial Coef2"); param->setDisplayRange(0, 10); param->setAnimates(true); param->setEvaluateOnChange(false); param->setEnabled(false); param->setAnimates(false); param->setParent(*groupLensDistortion); } { OFX::DoubleParamDescriptor *param = desc.defineDoubleParam(kParamOutputRadialCoef3); param->setLabel("Radial Coef3"); param->setDisplayRange(0, 10); param->setAnimates(true); param->setEvaluateOnChange(false); param->setEnabled(false); param->setAnimates(false); param->setParent(*groupLensDistortion); } { OFX::DoubleParamDescriptor *param = desc.defineDoubleParam(kParamOutputTangentialCoef1); param->setLabel("Tangential Coef1"); param->setDisplayRange(0, 10); param->setAnimates(true); param->setEvaluateOnChange(false); param->setEnabled(false); param->setAnimates(false); param->setParent(*groupLensDistortion); } { OFX::DoubleParamDescriptor *param = desc.defineDoubleParam(kParamOutputTangentialCoef2); param->setLabel("Tangential Coef2"); param->setDisplayRange(0, 10); param->setAnimates(true); param->setEvaluateOnChange(false); param->setEnabled(false); param->setAnimates(false); param->setParent(*groupLensDistortion); param->setLayoutHint(OFX::eLayoutHintDivider); } } { OFX::PushButtonParamDescriptor *param = desc.definePushButtonParam(kParamOutputClear); param->setLabel("Clear"); param->setHint("clear"); param->setEnabled(false); param->setParent(*groupOutput); } } //Debug Group { OFX::GroupParamDescriptor *groupDebug = desc.defineGroupParam(kParamGroupDebug); groupDebug->setLabel("Debug"); groupDebug->setAsTab(); { OFX::BooleanParamDescriptor *param = desc.defineBooleanParam(kParamDebugEnable); param->setLabel("Enable Debug"); param->setHint("Would you want to export undistorted images?"); param->setParent(*groupDebug); } { OFX::StringParamDescriptor *param = desc.defineStringParam(kParamDebugRejectedImgFolder); param->setLabel("Rejected Frames"); param->setHint("Folder to export delete images during the calibration refinement loop."); param->setStringType(OFX::eStringTypeDirectoryPath); param->setFilePathExists(true); param->setParent(*groupDebug); } { OFX::StringParamDescriptor *param = desc.defineStringParam(kParamDebugSelectedImgFolder); param->setLabel("Selected Frames"); param->setHint("Folder to export debug images."); param->setStringType(OFX::eStringTypeDirectoryPath); param->setFilePathExists(true); param->setParent(*groupDebug); } } }
/** * @brief Function called to describe the plugin controls and features. * @param[in, out] desc Effect descriptor * @param[in] context Application context */ void LensDistortPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, OFX::EContext context ) { // Create the mandated output clip OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); dstClip->setSupportsTiles( true ); // create the mandated source clip OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName ); srcClip->addSupportedComponent( OFX::ePixelComponentRGBA ); srcClip->addSupportedComponent( OFX::ePixelComponentAlpha ); srcClip->setSupportsTiles( true ); // declare an optional clip reference for RoD OFX::ClipDescriptor* srcRefClip = desc.defineClip( kClipOptionalSourceRef ); srcRefClip->addSupportedComponent( OFX::ePixelComponentRGBA ); srcRefClip->addSupportedComponent( OFX::ePixelComponentAlpha ); srcRefClip->setSupportsTiles( true ); srcRefClip->setOptional( true ); srcRefClip->setLabel( "ref" ); OFX::BooleanParamDescriptor* reverse = desc.defineBooleanParam( kParamReverse ); reverse->setLabel( "Reverse" ); reverse->setDefault( false ); reverse->setHint( "Invert the effect.\n" "Distort becomes undistort, and vice versa." ); // Controls OFX::BooleanParamDescriptor* displaySource = desc.defineBooleanParam( kParamDisplaySource ); displaySource->setLabel( "displaySource" ); displaySource->setDefault( false ); displaySource->setHint( "Display the image source (usefull to parameter the distortion with lines overlays on the source image)." ); OFX::ChoiceParamDescriptor* lensType = desc.defineChoiceParam( kParamLensType ); lensType->setLabel( "Lens type" ); lensType->appendOption( kParamLensTypeStandard ); #ifndef TUTTLE_PRODUCTION lensType->appendOption( kParamLensTypeFishEye ); // not implemented yet... lensType->appendOption( kParamLensTypeAdvanced ); // not implemented yet... lensType->setIsSecret( true ); #endif lensType->setDefault( 0 ); OFX::DoubleParamDescriptor* coef1 = desc.defineDoubleParam( kParamCoef1 ); coef1->setScriptName( "Main" ); coef1->setDefault( 0.1 ); coef1->setDisplayRange( -1.0, 1.0 ); coef1->setHint( "Main distortion coeffecient\n" ">0 : Barrel distortion\n" "<0 : Pincushion distortion\n" ); OFX::DoubleParamDescriptor* coef2 = desc.defineDoubleParam( kParamCoef2 ); coef2->setLabel( "Secondary" ); coef2->setDefault( 0.0 ); coef2->setDisplayRange( -1.0, 1.0 ); coef2->setHint( "Secondary distortion coeffecient (usefull for fisheyes only)\n" ">0 : Barrel distortion\n" "<0 : Pincushion distortion\n" ); #ifdef TUTTLE_PRODUCTION coef2->setIsSecret( true ); #endif OFX::DoubleParamDescriptor* squeeze = desc.defineDoubleParam( kParamSqueeze ); squeeze->setLabel( "Squeeze" ); #ifdef TUTTLE_PRODUCTION squeeze->setIsSecret( true ); #endif // squeeze->setDoubleType( eDoubleTypeNormalisedX ); squeeze->setDefault( 1.0 ); squeeze->setRange( 0.00001, 1.0 ); squeeze->setDisplayRange( 0.01, 1.0 ); squeeze->setHint( "Squeeze distortion coeffecient (usefull for bad quality lens...)" ); OFX::Double2DParamDescriptor* asymmetric = desc.defineDouble2DParam( kParamAsymmetric ); asymmetric->setLabel( "Asymmetric" ); #ifdef TUTTLE_PRODUCTION asymmetric->setIsSecret( true ); #endif // asymmetric->setDoubleType( eDoubleTypeNormalisedXY ); asymmetric->setDefault( 0.0, 0.0 ); asymmetric->setRange( 0.0, 0.0, 1.0, 1.0 ); asymmetric->setDisplayRange( 0.0, 0.0, 1.0, 1.0 ); asymmetric->setHint( "asymmetric distortion coeffecient (usefull for bad quality lens...)" ); OFX::Double2DParamDescriptor* center = desc.defineDouble2DParam( kParamCenter ); center->setLabel( "Center" ); center->setDoubleType( OFX::eDoubleTypePlain ); center->setDefault( 0.0, 0.0 ); center->setDisplayRange( -1.0, -1.0, 1.0, 1.0 ); center->setHint( "Center parameter allows you to shift the center of distortion." ); OFX::BooleanParamDescriptor* centerOverlay = desc.defineBooleanParam( kParamCenterOverlay ); centerOverlay->setLabel( "Display distortion center" ); centerOverlay->setDefault( false ); centerOverlay->setEvaluateOnChange( false ); centerOverlay->setHint( "Active distortion center point overlay." ); OFX::ChoiceParamDescriptor* centerType = desc.defineChoiceParam( kParamCenterType ); centerType->setLabel( "Center type" ); #ifdef TUTTLE_PRODUCTION centerType->setIsSecret( true ); #endif centerType->appendOption( kParamCenterTypeSource ); centerType->appendOption( kParamCenterTypeRoW ); centerType->setDefault( 0 ); centerType->setHint( "Centered on source or output image." ); OFX::DoubleParamDescriptor* preScale = desc.defineDoubleParam( kParamPreScale ); preScale->setLabel( "Pre-scale" ); // preScale->setDoubleType( eDoubleTypeNormalisedXY ); preScale->setDefault( 1.0 ); preScale->setRange( 0.00001, std::numeric_limits<double>::max() ); preScale->setDisplayRange( 0.0, 2.5 ); preScale->setHint( "If the transformation of optics is high, you may need to change the scale of the result to be globally closer to the source image or preserve a good resolution." ); OFX::DoubleParamDescriptor* postScale = desc.defineDoubleParam( kParamPostScale ); postScale->setLabel( "Post-scale" ); // scale->setDoubleType( eDoubleTypeNormalisedXY ); postScale->setDefault( 1.0 ); postScale->setRange( 0.00001, std::numeric_limits<double>::max() ); postScale->setDisplayRange( 0.0, 2.5 ); postScale->setHint( "If the transformation of optics is high, you may need to change the scale of the result to be globally closer to the source image or preserve a good resolution." ); OFX::ChoiceParamDescriptor* interpolation = desc.defineChoiceParam( kParamInterpolation ); interpolation->setLabel( "Interpolation" ); interpolation->appendOption( kParamInterpolationNearest ); interpolation->appendOption( kParamInterpolationBilinear ); interpolation->setDefault( 1 ); interpolation->setHint( "Interpolation method" ); OFX::ChoiceParamDescriptor* resizeRod = desc.defineChoiceParam( kParamResizeRod ); resizeRod->setLabel( "Resize RoD" ); resizeRod->appendOption( kParamResizeRodNo ); resizeRod->appendOption( kParamResizeRodSourceRef ); resizeRod->appendOption( kParamResizeRodMin ); resizeRod->appendOption( kParamResizeRodMax ); resizeRod->appendOption( kParamResizeRodManual ); resizeRod->setDefault( 0 ); resizeRod->setHint( "Resize output RoD" ); OFX::DoubleParamDescriptor* scaleRod = desc.defineDoubleParam( kParamResizeRodManualScale ); scaleRod->setLabel( "Scale RoD" ); // scaleRod->setDoubleType( eDoubleTypeNormalisedXY ); // scaleRod->setIsSecret( true ); // scaleRod->setEnabled( false ); scaleRod->setDefault( 1.0 ); scaleRod->setRange( 0.0, std::numeric_limits<double>::max() ); scaleRod->setDisplayRange( 0, 2.5 ); scaleRod->setHint( "Adjust the output RoD." ); OFX::GroupParamDescriptor* displayOptions = desc.defineGroupParam( kParamDisplayOptions ); displayOptions->setLabel( "Display options" ); displayOptions->setHint( "Display options (change nothing on the image)" ); OFX::BooleanParamDescriptor* displayGrid = desc.defineBooleanParam( kParamGridOverlay ); displayGrid->setLabel( "Display grid" ); displayGrid->setParent( *displayOptions ); displayGrid->setDefault( false ); displayGrid->setEvaluateOnChange( false ); displayGrid->setHint( "Display the grid" ); OFX::Double2DParamDescriptor* gridCenter = desc.defineDouble2DParam( kParamGridCenter ); gridCenter->setLabel( "Grid center" ); gridCenter->setDoubleType( OFX::eDoubleTypePlain ); gridCenter->setParent( *displayOptions ); gridCenter->setDefault( 0.0, 0.0 ); gridCenter->setDisplayRange( -1.0, -1.0, 1.0, 1.0 ); gridCenter->setEvaluateOnChange( false ); gridCenter->setHint( "Allows you to shift the center of the display grid." ); OFX::BooleanParamDescriptor* gridCenterOverlay = desc.defineBooleanParam( kParamGridCenterOverlay ); gridCenterOverlay->setLabel( "Display grid center" ); gridCenterOverlay->setParent( *displayOptions ); gridCenterOverlay->setDefault( false ); gridCenterOverlay->setEvaluateOnChange( false ); gridCenterOverlay->setHint( "Active grid center point overlay." ); OFX::Double2DParamDescriptor* gridScale = desc.defineDouble2DParam( kParamGridScale ); gridScale->setLabel( "Grid scale" ); gridScale->setDoubleType( OFX::eDoubleTypePlain ); gridScale->setParent( *displayOptions ); gridScale->setDefault( 1.0, 1.0 ); gridScale->setDisplayRange( -10.0, -10.0, 10.0, 10.0 ); gridScale->setEvaluateOnChange( false ); gridScale->setHint( "Allows you to scale the display grid." ); OFX::GroupParamDescriptor* debugOptions = desc.defineGroupParam( kParamDebugOptions ); debugOptions->setLabel( "Debug options" ); debugOptions->setHint( "Debug options" ); debugOptions->setParent( *displayOptions ); #ifdef TUTTLE_PRODUCTION debugOptions->setIsSecret( true ); #endif OFX::BooleanParamDescriptor* debugDisplayRoi = desc.defineBooleanParam( kParamDebugDisplayRoi ); debugDisplayRoi->setLabel( "Display RoI" ); #ifdef TUTTLE_PRODUCTION debugDisplayRoi->setIsSecret( true ); #endif debugDisplayRoi->setParent( *debugOptions ); debugDisplayRoi->setDefault( false ); debugDisplayRoi->setEvaluateOnChange( false ); debugDisplayRoi->setHint( "Display RoI" ); OFX::PushButtonParamDescriptor* helpButton = desc.definePushButtonParam( kParamHelp ); helpButton->setLabel( "Help" ); }