Ask Your Question

Revision history [back]

Convolution operation over 1D array

Dear All, I'm trying to do convolution operation over 1D array, is it possible? If it is, please can you suggest how can do it?

following code I'm using:

cvLoadImage(argv[1], CV_LOAD_IMAGE_GRAYSCALE); // Load an image 640x64 CvMat* mat = cvCreateMat( 64, 1, CV_8UC1 ); // Create Mat structure to get the column CvMat* matLaplace = cvCreateMat( 64, 1, CV_16SC1 ); for(y=0; y<img->height; y++ ) {
uchar* ptr = (uchar*) (img->imageData + y * img->widthStep); mat->data.ptr[y] = ptr[200]; // Extract column 200 from image (img) and put in mat .... // need to do filter operation with filter2D function }