2013년 7월 14일 일요일

getGaussianKernel

getGaussianKernel : Returns Gaussian filter coefficients.
getGaussianKernel(int ksize, double sigma, int ktype=CV_64F )

ksize – Aperture size. It should be odd ( \texttt{ksize} \mod 2 = 1 ) and positive.
sigma – Gaussian standard deviation. If it is non-positive, it is computed from ksize as sigma = 0.3*((ksize-1)*0.5 - 1) + 0.8 .
ktype – Type of filter coefficients. It can be CV_32f or CV_64F .



int M = 101;
double sigma = 10;
Mat_ g = getGaussianKernel(M, sigma, CV_64F);

for(int i=0; i
{
double g1 = g(i,0);
Dbg("%f", g1);
}

Mat_ 접근
// more convenient forms of row and element access operators 
    _Tp* operator [](int y);
    const _Tp* operator [](int y) const;

    _Tp& operator ()(int row, int col);
    const _Tp& operator ()(int row, int col) const;
    _Tp& operator ()(Point pt);
    const _Tp& operator ()(Point pt) const;


아래는 http://bytefish.de/blog/opencv/code_snippets/ 에서 가져옴

template
void printMat(const cv::Mat_<_tp>& mat) {
    typedef typename DataType<_tp>::work_type _wTp;
    for(int i = 0; i < mat.rows; i++)
        for(int j=0; j < mat.cols; j++)
            cout << (_wTp) mat(i,j) << " ";
    cout << endl;
}



댓글 없음:

댓글 쓰기