Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
Point anchor( -1 ,-1 );
double delta = 0;

// this kernel does not make sense, but anyway.
float data[2][5] = {{11,11,11,11,11},{11,11,11,11,11}}; 

int row = input.rows; int col = input.cols;
cout<<"--------------------"<<endl;
cout<<"Input Image"<<endl;
cout<<"--------------------"<<endl;
cout<<"Row = "<<row<<endl;
cout<<"Col = "<<col<<endl;
/// oh noes! the address of a Mat is *not* pixel data. 
/// also, you can't convert to float this way 
//Mat src = Mat(input.size(), CV_32FC1, &input);
Mat src = input;                   // just keep it as is.
Mat ker = Mat(5, 5, CV_32F, data); // float data == CV_32F Mat
Mat dst = Mat(src.size(), CV_32F); // here, too.

Ptr<FilterEngine> fe =  createLinearFilter(input.type(), ker.type(), ker, anchor, 
      delta, BORDER_CONSTANT, BORDER_CONSTANT, Scalar(0));

fe->apply(src, dst);
Point anchor( -1 ,-1 );
double delta = 0;

// this kernel does not make sense, but anyway.
float data[2][5] = {{11,11,11,11,11},{11,11,11,11,11}}; 

int row = input.rows; int col = input.cols;
cout<<"--------------------"<<endl;
cout<<"Input Image"<<endl;
cout<<"--------------------"<<endl;
cout<<"Row = "<<row<<endl;
cout<<"Col = "<<col<<endl;
/// oh noes! the address of a Mat is *not* pixel data. 
/// also, you can't convert to float this way 
//Mat src = Mat(input.size(), CV_32FC1, &input);
Mat src = input;                   // just keep it as is.
Mat ker = Mat(5, Mat(2, 5, CV_32F, data); // float data == CV_32F Mat
Mat dst = Mat(src.size(), CV_32F); // here, too.

Ptr<FilterEngine> fe =  createLinearFilter(input.type(), ker.type(), ker, anchor, 
      delta, BORDER_CONSTANT, BORDER_CONSTANT, Scalar(0));

fe->apply(src, dst);
Point anchor( -1 ,-1 );
double delta = 0;

// this kernel does not make sense, but anyway.
float data[2][5] = {{11,11,11,11,11},{11,11,11,11,11}}; 

int row = input.rows; int col = input.cols;
cout<<"--------------------"<<endl;
cout<<"Input Image"<<endl;
cout<<"--------------------"<<endl;
cout<<"Row = "<<row<<endl;
cout<<"Col = "<<col<<endl;
/// oh noes! the address of a Mat is *not* pixel data. 
/// also, you can't convert to float this way 
//Mat src = Mat(input.size(), CV_32FC1, &input);
Mat src = input;                   // just keep it as is.
Mat ker = Mat(2, 5, CV_32F, data); // float data == CV_32F Mat
Mat dst = Mat(src.size(), CV_32F); // here, too.

Point anchor( -1 ,-1 );
double delta = 0;

Ptr<FilterEngine> fe =  createLinearFilter(input.type(), ker.type(), ker, anchor, 
      delta, BORDER_CONSTANT, BORDER_CONSTANT, Scalar(0));

fe->apply(src, dst);