Assertion failed error
i am trying to use below code for my work but when i run it , it show me error on assertion failed (type=b.type() && (type = ....) ) , Actually i am trying to convert the python code into c++ from here
Mat img = imread ("D:\\33.jpg");
Mat a,b,c,d,e;
a = getGaussianKernel(img.cols,300,64F);
b = getGaussianKernel(img.rows,300,64F);
c=b*a.t();
double minVal;
double maxVal;
cv::minMaxLoc(c, &minVal, &maxVal);
d = c/maxVal;
e = img*d;
But it showing me error of assertion failed , most probably on line e= img*d
Its not showing me error when i simply did img*d
but when i assign it to any Mat it show me error
This is the algorithm which i am trying to implement
- Load the image, Get its number of rows and columns
- Create two Gaussian Kernels of size rows and columns, say A,B. Its variance depends upon your needs.
- C = transpose(A)*B, ie multiply a column vector with a row vector such that result array should be same size as that of the image.
- D = C/C.max()
- E = img*D
here is its python versionversion which is working accordingly
img = cv2.imread('temp.jpg',0)
row,cols = img.shape
a = cv2.getGaussianKernel(cols,300)
b = cv2.getGaussianKernel(rows,300)
c = b*a.T
d = c/c.max()
e = img*d
cv2.imwrite('vig2.png',e)