?? cv.hpp
字號:
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef _CV_HPP_
#define _CV_HPP_
#ifdef __cplusplus
/****************************************************************************************\
* CvBaseImageFilter: Base class for filtering operations *
\****************************************************************************************/
#define CV_WHOLE 0
#define CV_START 1
#define CV_END 2
#define CV_MIDDLE 4
#define CV_ISOLATED_ROI 8
typedef void (*CvRowFilterFunc)( const uchar* src, uchar* dst, void* params );
typedef void (*CvColumnFilterFunc)( uchar** src, uchar* dst, int dst_step, int count, void* params );
class CV_EXPORTS CvBaseImageFilter
{
public:
CvBaseImageFilter();
/* calls init() */
CvBaseImageFilter( int _max_width, int _src_type, int _dst_type,
bool _is_separable, CvSize _ksize,
CvPoint _anchor=cvPoint(-1,-1),
int _border_mode=IPL_BORDER_REPLICATE,
CvScalar _border_value=cvScalarAll(0) );
virtual ~CvBaseImageFilter();
/* initializes the class for processing an image of maximal width _max_width,
input image has data type _src_type, the output will have _dst_type.
_is_separable != 0 if the filter is separable
(specific behaviour is defined in a derived class), 0 otherwise.
_ksize and _anchor specify the kernel size and the anchor point. _anchor=(-1,-1) means
that the anchor is at the center.
to get interpolate pixel values outside the image _border_mode=IPL_BORDER_*** is used,
_border_value specify the pixel value in case of IPL_BORDER_CONSTANT border mode.
before initialization clear() is called if necessary.
*/
virtual void init( int _max_width, int _src_type, int _dst_type,
bool _is_separable, CvSize _ksize,
CvPoint _anchor=cvPoint(-1,-1),
int _border_mode=IPL_BORDER_REPLICATE,
CvScalar _border_value=cvScalarAll(0) );
/* releases all the internal buffers.
for the further use of the object, init() needs to be called. */
virtual void clear();
/* processes input image or a part of it.
input is represented either as matrix (CvMat* src)
or a list of row pointers (uchar** src2).
in the later case width, _src_y1 and _src_y2 are used to specify the size.
_dst is the output image/matrix.
_src_roi specifies the roi inside the input image to process,
(0,0,-1,-1) denotes the whole image.
_dst_origin is the upper-left corner of the filtered roi within the output image.
_phase is either CV_START, or CV_END, or CV_MIDDLE, or CV_START|CV_END, or CV_WHOLE,
which is the same as CV_START|CV_END.
CV_START means that the input is the first (top) stripe of the processed image [roi],
CV_END - the input is the last (bottom) stripe of the processed image [roi],
CV_MIDDLE - the input is neither first nor last stripe.
CV_WHOLE - the input is the whole processed image [roi].
*/
virtual int process( const CvMat* _src, CvMat* _dst,
CvRect _src_roi=cvRect(0,0,-1,-1),
CvPoint _dst_origin=cvPoint(0,0), int _flags=0 );
/* retrieve various parameters of the filtering object */
int get_src_type() const { return src_type; }
int get_dst_type() const { return dst_type; }
int get_work_type() const { return work_type; }
CvSize get_kernel_size() const { return ksize; }
CvPoint get_anchor() const { return anchor; }
int get_width() const { return prev_x_range.end_index - prev_x_range.start_index; }
CvRowFilterFunc get_x_filter_func() const { return x_func; }
CvColumnFilterFunc get_y_filter_func() const { return y_func; }
protected:
/* initializes work_type, buf_size and max_rows */
virtual void get_work_params();
/* it is called (not always) from process when _phase=CV_START or CV_WHOLE.
the method initializes ring buffer (buf_end, buf_head, buf_tail, buf_count, rows),
prev_width, prev_x_range, const_row, border_tab, border_tab_sz* */
virtual void start_process( CvSlice x_range, int width );
/* forms pointers to "virtual rows" above or below the processed roi using the specified
border mode */
virtual void make_y_border( int row_count, int top_rows, int bottom_rows );
virtual int fill_cyclic_buffer( const uchar* src, int src_step,
int y, int y1, int y2 );
enum { ALIGN=32 };
int max_width;
/* currently, work_type must be the same as src_type in case of non-separable filters */
int min_depth, src_type, dst_type, work_type;
/* pointers to convolution functions, initialized by init method.
for non-separable filters only y_conv should be set */
CvRowFilterFunc x_func;
CvColumnFilterFunc y_func;
uchar* buffer;
uchar** rows;
int top_rows, bottom_rows, max_rows;
uchar *buf_start, *buf_end, *buf_head, *buf_tail;
int buf_size, buf_step, buf_count, buf_max_count;
bool is_separable;
CvSize ksize;
CvPoint anchor;
int max_ky, border_mode;
CvScalar border_value;
uchar* const_row;
int* border_tab;
int border_tab_sz1, border_tab_sz;
CvSlice prev_x_range;
int prev_width;
};
/* Derived class, for linear separable filtering. */
class CV_EXPORTS CvSepFilter : public CvBaseImageFilter
{
public:
CvSepFilter();
CvSepFilter( int _max_width, int _src_type, int _dst_type,
const CvMat* _kx, const CvMat* _ky,
CvPoint _anchor=cvPoint(-1,-1),
int _border_mode=IPL_BORDER_REPLICATE,
CvScalar _border_value=cvScalarAll(0) );
virtual ~CvSepFilter();
virtual void init( int _max_width, int _src_type, int _dst_type,
const CvMat* _kx, const CvMat* _ky,
CvPoint _anchor=cvPoint(-1,-1),
int _border_mode=IPL_BORDER_REPLICATE,
CvScalar _border_value=cvScalarAll(0) );
virtual void init_deriv( int _max_width, int _src_type, int _dst_type,
int dx, int dy, int aperture_size, int flags=0 );
virtual void init_gaussian( int _max_width, int _src_type, int _dst_type,
int gaussian_size, double sigma );
/* dummy method to avoid compiler warnings */
virtual void init( int _max_width, int _src_type, int _dst_type,
bool _is_separable, CvSize _ksize,
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -