opencv image filter

class BaseColumnFilter
{
public:
	virtual ~BaseColumnFilter();
	// To be overriden by the user.
	//
	// runs a filtering operation on the set of rows,
	// "dstcount + ksize - 1" rows on input,
	// "dstcount" rows on output,
	// each input and output row has "width" elements
	// the filtered rows are written into "dst" buffer.		
	virtual void operator()(const uchar** src, uchar* dst, int dststep,
	int dstcount, int width) = 0;
	// resets the filter state (may be needed for IIR filters)
	virtual void reset();
	int ksize; // the aperture size
	int anchor; // position of the anchor point,
	// normally not used during the processing
};
</pre><pre name="code" class="cpp">
class BaseFilter
{
public:
	virtual ~BaseFilter();
	// To be overriden by the user.
	//
	// runs a filtering operation on the set of rows,
	// "dstcount + ksize.height - 1" rows on input,
	// "dstcount" rows on output,
	// each input row has "(width + ksize.width-1) *cn" elements
	// each output row has "width*cn" elements.
	// the filtered rows are written into "dst" buffer.
	virtual void operator()(const uchar** src, uchar* dst, int dststep,
		int dstcount, int width, int cn) = 0;
	// resets the filter state (may be needed for IIR filters)
	virtual void reset();
	Size ksize;
	Point anchor;
};
class CV_EXPORTS FilterEngine
{
public:
    //! the default constructor
    FilterEngine();
    //! the full constructor. Either _filter2D or both _rowFilter and _columnFilter must be non-empty.
    FilterEngine(const Ptr<basefilter>& _filter2D,
                 const Ptr<baserowfilter>& _rowFilter,
                 const Ptr<basecolumnfilter>& _columnFilter,
                 int srcType, int dstType, int bufType,
                 int _rowBorderType=BORDER_REPLICATE,
                 int _columnBorderType=-1,
                 const Scalar& _borderValue=Scalar());
    //! the destructor
    virtual ~FilterEngine();
    //! reinitializes the engine. The previously assigned filters are released.
    void init(const Ptr<basefilter>& _filter2D,
              const Ptr<baserowfilter>& _rowFilter,
              const Ptr<basecolumnfilter>& _columnFilter,
              int srcType, int dstType, int bufType,
              int _rowBorderType=BORDER_REPLICATE, int _columnBorderType=-1,
              const Scalar& _borderValue=Scalar());
    //! starts filtering of the specified ROI of an image of size wholeSize.
    virtual int start(Size wholeSize, Rect roi, int maxBufRows=-1);
    //! starts filtering of the specified ROI of the specified image.
    virtual int start(const Mat& src, const Rect& srcRoi=Rect(0,0,-1,-1),
                      bool isolated=false, int maxBufRows=-1);
    //! processes the next srcCount rows of the image.
    virtual int proceed(const uchar* src, int srcStep, int srcCount,
                        uchar* dst, int dstStep);
    //! applies filter to the specified ROI of the image. if srcRoi=(0,0,-1,-1), the whole image is filtered.
    virtual void apply( const Mat& src, Mat& dst,
                        const Rect& srcRoi=Rect(0,0,-1,-1),
                        Point dstOfs=Point(0,0),
                        bool isolated=false);
    //! returns true if the filter is separable
    bool isSeparable() const { return (const BaseFilter*)filter2D == 0; }
    //! returns the number
    int remainingInputRows() const;
    int remainingOutputRows() const;

    int srcType, dstType, bufType;
    Size ksize;
    Point anchor;
    int maxWidth;
    Size wholeSize;
    Rect roi;
    int dx1, dx2;
    int rowBorderType, columnBorderType;
    vector<int> borderTab;
    int borderElemSize;
    vector<uchar> ringBuf;
    vector<uchar> srcRow;
    vector<uchar> constBorderValue;
    vector<uchar> constBorderRow;
    int bufStep, startY, startY0, endY, rowCount, dstY;
    vector<uchar> rows;

    Ptr<basefilter> filter2D;
    Ptr<baserowfilter> rowFilter;
    Ptr<basecolumnfilter> columnFilter;
};
</basecolumnfilter></baserowfilter></basefilter></uchar></uchar></uchar></uchar></uchar></int></basecolumnfilter></baserowfilter></basefilter></basecolumnfilter></baserowfilter></basefilter>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值