I’m working with some filters in OpenCV and don’t know how to multiply a number (1/5) in this example
CvMat* kernel=0;
IplImage* dst = cvCreateImage(cvGetSize( entrada ), IPL_DEPTH_8U, 3);
kernel = cvCreateMat(3, 3,CV_32FC1);
cvSet2D( kernel, 0, 0, cvRealScalar(1));
cvSet2D( kernel, 0, 1, cvRealScalar(1));
cvSet2D( kernel, 0, 2, cvRealScalar(1));
cvSet2D( kernel, 1, 0, cvRealScalar(1));
cvSet2D( kernel, 1, 1, cvRealScalar(2));
cvSet2D( kernel, 1, 2, cvRealScalar(1));
cvSet2D( kernel, 2, 0, cvRealScalar(1));
cvSet2D( kernel, 2, 1, cvRealScalar(1));
cvSet2D( kernel, 2, 2, cvRealScalar(1));
// Matriz utilizada para el filtrado paso alto
// 1 1 1
// 1 2 1
// 1 1 1
cvFilter2D(entrada, dst, kernel, cvPoint(-1,-1));
What about
cvScale(src, dst, scale)withscalebeing the number, whatever matrix you want to multiply it with. If you want to multiply it with the kernel, what about just initializing the kernel with the multiplied values?