Error : assertion failed (depth ==5 || depth==6) in cv::pow,fill c:\opencv\...\mathfuncs.cpp
Getting assertion failed error ' cv::pow(sigma, double(0.5), sigma); // sigma = sqrt(sigma)' in this line.
// compute sigma
Mat sigma = im.size(), CV_64FC1, 1);
sigma = im.mul(im);
GaussianBlur(sigma, sigma, Size(7, 7), 1.166); // apply gaussian blur
subtract(sigma, mu_sq, sigma); // sigma = sigma - mu_sq
cv::pow(sigma, double(0.5), sigma); // sigma = sqrt(sigma)
add(sigma, Scalar(1.0/255), sigma); // to avoid DivideByZero Exception
Mat structdis(im.size(), CV_64FC1, 1);
subtract(im, mu, structdis); // structdis = im - mu
divide(structdis, sigma, structdis
1st line already does not compile. can you update it ?
code is quite buggy there ;)
you're overwriting sigma with whatever type
im
had. and this must be double or float, but probably isn't.@berak : how can i correct it ? and while debugging the errors shown in
cv::pow(sigma, double(0.5), sigma); // sigma = sqrt(sigma)
this linecan you look at the comment above, again ?
@berak: I can ,but i can't understand. Can u explain it by correcting the error?