Пример #1
0
// override the roi call
void 
BasicPlugin::getRegionsOfInterest(const OFX::RegionsOfInterestArguments &args, OFX::RegionOfInterestSetter &rois)
{
  // we don't actually need to do this as this is the default, but do it for examples sake
  rois.setRegionOfInterest(*srcClip_, args.regionOfInterest);

  // set it on the mask only if we are in an interesting context
  if(getContext() != OFX::eContextFilter)
    rois.setRegionOfInterest(*maskClip_, args.regionOfInterest);
}
Пример #2
0
void ImageStatisticsPlugin::getRegionsOfInterest( const OFX::RegionsOfInterestArguments& args, OFX::RegionOfInterestSetter& rois )
{
	ImageStatisticsProcessParams params = getProcessParams( args.time, args.renderScale );
	if( params._chooseOutput == eParamChooseOutputSource )
	{
		// In that case we need the full image input...
		// Not to compute statistics, but to copy the image.
		return;
	}
	OfxRectI inputRoi = params._rect; // we need the selected rectangle
	OfxRectD inputRoi_d = rectIntToDouble( inputRoi );

	rois.setRegionOfInterest( *_clipSrc, inputRoi_d );
	rois.setRegionOfInterest( *_clipMask, inputRoi_d );
}
Пример #3
0
void ThinningPlugin::getRegionsOfInterest( const OFX::RegionsOfInterestArguments& args, OFX::RegionOfInterestSetter& rois )
{
	const OfxRectD srcRod = _clipSrc->getCanonicalRod( args.time );
	
	const OfxRectD srcRoi = rectangleGrow( srcRod, 2 );

	rois.setRegionOfInterest( *_clipSrc, srcRoi );
}
Пример #4
0
void ColorTransferPlugin::getRegionsOfInterest( const OFX::RegionsOfInterestArguments& args, OFX::RegionOfInterestSetter& rois )
{
	if( _clipSrcRef->isConnected() )
	{
		OfxRectD srcRod = args.regionOfInterest;
		rois.setRegionOfInterest( *this->_clipSrc, srcRod );
	}
	else
	{
		OfxRectD srcRod = _clipSrc->getCanonicalRod( args.time );
		rois.setRegionOfInterest( *this->_clipSrc, srcRod );
	}
	
	OfxRectD srcRefRod = _clipSrcRef->getCanonicalRod( args.time );
	rois.setRegionOfInterest( *_clipSrcRef, srcRefRod );
	
	OfxRectD dstRefRod = _clipDstRef->getCanonicalRod( args.time );
	rois.setRegionOfInterest( *_clipDstRef, dstRefRod );
}
Пример #5
0
void NormalizePlugin::getRegionsOfInterest(const OFX::RegionsOfInterestArguments& args, OFX::RegionOfInterestSetter& rois)
{
    NormalizeProcessParams<Scalar> params = getProcessParams();
    OfxRectD srcRod = _clipSrc->getCanonicalRod(args.time);
    switch(params._mode)
    {
        case eParamModeAnalyse:
        {
            // in this case, we need the full input image to do the analyse.
            rois.setRegionOfInterest(*_clipSrc, srcRod);
            break;
        }
        case eParamModeCustom:
        {
            rois.setRegionOfInterest(*_clipSrc, args.regionOfInterest);
            break;
        }
    }
}
Пример #6
0
void ImageStatisticsPlugin::getRegionsOfInterest( const OFX::RegionsOfInterestArguments& args, OFX::RegionOfInterestSetter& rois )
{
	OfxRectI srcRealRoi = getProcessParams( _clipSrc->getPixelRod( args.time ) )._rect; // we need the selected rectangle
	OfxRectD srcRealRoiD;

	srcRealRoiD.x1 = srcRealRoi.x1;
	srcRealRoiD.y1 = srcRealRoi.y1;
	srcRealRoiD.x2 = srcRealRoi.x2;
	srcRealRoiD.y2 = srcRealRoi.y2;
//	TUTTLE_COUT_VAR( srcRealRoiD );
	
	rois.setRegionOfInterest( *_clipSrc, srcRealRoiD );
}
Пример #7
0
void ConvolutionPlugin::getRegionsOfInterest(const OFX::RegionsOfInterestArguments& args, OFX::RegionOfInterestSetter& rois)
{
    OfxRectD srcRoi = args.regionOfInterest;
    const OfxPointI size = _paramSize->getValue();
    OfxPointD halfSize;

    halfSize.x = size.x * 0.5;
    halfSize.y = size.y * 0.5;
    srcRoi.x1 -= halfSize.x;
    srcRoi.x2 += halfSize.x;
    srcRoi.y1 -= halfSize.y;
    srcRoi.y2 += halfSize.y;
    rois.setRegionOfInterest(*_clipSrc, srcRoi);
}
Пример #8
0
void FlipPlugin::getRegionsOfInterest(const OFX::RegionsOfInterestArguments& args, OFX::RegionOfInterestSetter& rois)
{
    //	FlipProcessParams params = getProcessParams( args.time, args.renderScale );
    //	if( params.flip )
    //	{
    //		/// @todo needs to transform args.regionOfInterest, like in the compute function
    //	}
    //	if( params.flop )
    //	{
    //		/// @todo needs to transform args.regionOfInterest, like in the compute function
    //	}
    OfxRectD srcRod = _clipSrc->getCanonicalRod(args.time);
    rois.setRegionOfInterest(*this->_clipSrc, srcRod);
}
Пример #9
0
void PushPixelPlugin::getRegionsOfInterest(const OFX::RegionsOfInterestArguments& args, OFX::RegionOfInterestSetter& rois)
{

    OfxRectD srcRod = _clipSrc->getCanonicalRod(args.time);
    // OfxRectD dstRod = _clipDst->getCanonicalRod( args.time );

    if(_clipMask->isConnected())
    {
        PushPixelProcessParams<Scalar> params(getProcessParams());
        // OfxRectD maskRod = _clipMask->getCanonicalRod( args.time );
        double maxKernelTL = std::max(params._kernelGaussian.left_size(), params._kernelGaussianDerivative.left_size());
        double maxKernelBR = std::max(params._kernelGaussian.right_size(), params._kernelGaussianDerivative.right_size());
        OfxRectD maskRoi;
        maskRoi.x1 = args.regionOfInterest.x1 - (maxKernelTL * _clipMask->getPixelAspectRatio());
        maskRoi.y1 = args.regionOfInterest.y1 - maxKernelTL;
        maskRoi.x2 = args.regionOfInterest.x2 + (maxKernelBR * _clipMask->getPixelAspectRatio());
        maskRoi.y2 = args.regionOfInterest.y2 + maxKernelBR;
        rois.setRegionOfInterest(*_clipMask, maskRoi);
    }

    // no tiles on src clip, because it depends on the mask content so we can't
    // define the maximal bounding box needed...
    rois.setRegionOfInterest(*_clipSrc, srcRod);
}
Пример #10
0
void LensDistortPlugin::getRegionsOfInterest( const OFX::RegionsOfInterestArguments& args, OFX::RegionOfInterestSetter& rois )
{
	OfxRectD srcRod = _clipSrc->getCanonicalRod( args.time );
	OfxRectD dstRod = _clipDst->getCanonicalRod( args.time );

	LensDistortProcessParams<Scalar> params;
	if( _srcRefClip->isConnected() )
	{
		OfxRectD srcRefRod = _srcRefClip->getCanonicalRod( args.time );
		params = getProcessParams( srcRod, dstRod, srcRefRod, _clipDst->getPixelAspectRatio() );
	}
	else
	{
		params = getProcessParams( srcRod, dstRod, _clipDst->getPixelAspectRatio() );
	}

	OfxRectD outputRoi = args.regionOfInterest;
	outputRoi.x1 -= dstRod.x1; // to dest rod coordinates
	outputRoi.y1 -= dstRod.y1;
	outputRoi.x2 -= dstRod.x1;
	outputRoi.y2 -= dstRod.y1;
	OfxRectD srcRoi = transformValues( getLensType(), params, outputRoi );
	srcRoi.x1    += srcRod.x1; // to RoW coordinates
	srcRoi.y1    += srcRod.y1;
	srcRoi.x2    += srcRod.x1;
	srcRoi.y2    += srcRod.y1;
	outputRoi.x1 += dstRod.x1; // to RoW coordinates
	outputRoi.y1 += dstRod.y1;
	outputRoi.x2 += dstRod.x1;
	outputRoi.y2 += dstRod.y1;
	//    srcRoi.x1 += 2; // if we remove 2 pixels to the needed RoI the plugin crash, because it tries to access to this pixels
	//    srcRoi.y1 += 2; // so the calcul of the RoI has a precision of one pixel
	//    srcRoi.x2 -= 2;
	//    srcRoi.y2 -= 2;
	OfxRectD srcRealRoi = rectanglesIntersection( srcRoi, srcRod );
	srcRealRoi = srcRod;

	rois.setRegionOfInterest( *_clipSrc, srcRealRoi );

	if( _debugDisplayRoi->getValue() )
	{
		_srcRealRoi = srcRealRoi;
		_srcRoi     = srcRoi;
		_dstRoi     = outputRoi;
	}
}
Пример #11
0
void SobelPlugin::getRegionsOfInterest( const OFX::RegionsOfInterestArguments& args, OFX::RegionOfInterestSetter& rois )
{
	SobelProcessParams<Scalar> params = getProcessParams();
	OfxRectD srcRod                  = _clipSrc->getCanonicalRod( args.time );

	OfxRectD marge;
	marge.x1 = std::max( params._xKernelGaussianDerivative.left_size(), params._yKernelGaussian.left_size() );
	marge.y1 = std::max( params._xKernelGaussian.left_size(), params._yKernelGaussianDerivative.left_size() );
	marge.x2 = std::max( params._xKernelGaussianDerivative.right_size(), params._yKernelGaussian.right_size() );
	marge.y2 = std::max( params._xKernelGaussian.right_size(), params._yKernelGaussianDerivative.right_size() );
	switch( params._pass )
	{
		case eParamPass1:
		{
			marge.y1 = 0;
			marge.y2 = 0;
			break;
		}
		case eParamPass2:
		{
			marge.x1 = 0;
			marge.x2 = 0;
			break;
		}
		case eParamPassFull:
		{
			break;
		}
	}
	OfxRectD srcRoi;
	srcRoi.x1 = srcRod.x1 - marge.x1;
	srcRoi.y1 = srcRod.y1 - marge.y1;
	srcRoi.x2 = srcRod.x2 + marge.x2;
	srcRoi.y2 = srcRod.y2 + marge.y2;
	rois.setRegionOfInterest( *_clipSrc, srcRoi );
}