问题
I've just used the multiply functions using C api (cvMul) and C++ api (mul and multiply). But I get a different result from the C function and the C++ ones
- Result of cvMul (it is a white image)
- Result of mul and multiply
Here is the code I use for both implementations:
C
IplImage * gh = cvCreateImage(cvGetSize(input),IPL_DEPTH_32F,1) ;
cvSobel(input,gh,1,0) ;
IplImage * gh2 = cvCreateImage(cvGetSize(input),IPL_DEPTH_32F,1) ;
cvMul(gh,gh,gh2) ;
C++
Mat gh = Mat (input.size(), CV_32FC1);
Sobel(input, gh, CV_32FC1, 1, 0);
Mat gh2 = Mat (input.size(), CV_32FC1);
gh2 = gh.mul(gh); // multiply (gh, gh, gh2);
The input image is the same, and when I check the horizontal gradient it is also the same for both implementations, so why would the multiplication give different results? (I am interested in getting the result of the C implementation)
来源:https://stackoverflow.com/questions/33601241/opencv-multiply-images-in-c-and-c