Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Assertion failed error

i am trying to use this code for my work but when i run it , it show me error on assertion failed (type=b.type() && (type = ....) )

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

Assertion failed error

i am trying to use this code for my work but when i run it , it show me error on assertion failed (type=b.type() && (type = ....) )

Mat img = imread ("D:\\33.jpg");
Mat a,b,c,d,e;
a = getGaussianKernel(img.cols,300,64F);
b = getGaussianKernel(img.rows,300,64F);
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

Assertion failed error

i am trying to use this 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);
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

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

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

  1. Load the image, Get its number of rows and columns
  2. Create two Gaussian Kernels of size rows and columns, say A,B. Its variance depends upon your needs.
  3. 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.
  4. D = C/C.max()
  5. E = img*D

here is its python version

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)

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

  1. Load the image, Get its number of rows and columns
  2. Create two Gaussian Kernels of size rows and columns, say A,B. Its variance depends upon your needs.
  3. 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.
  4. D = C/C.max()
  5. 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)