I am trying to convolve an image with a filter and storing it to a matrix of type CV_64F with the help of filter2D function in opencv. but the type of the destination matrix get changed and i try to change it back to CV_64F with the help of assignTo 0r ConvertTo function but i am not able to do so. Can someone help? This is lines of my code
cv::Mat op = cv::Mat(25,25,a.type(),Arr1); // a is the image m开发者_JAVA百科atrix and op is the filter.
cv::Point anchor = Point(-1,-1);
cv::Mat b = cv::Mat(a.size(),CV_64F);
cv::Mat l = cv::Mat(a.size(),CV_64F);
cv::Mat m = cv::Mat(a.size(),CV_64F);
//prnmt(a);
filter2D(a,b,-1,op,anchor,0,BORDER_DEFAULT);
b.assignTo(l,CV_64F);
I tried running the following similar code with OpenCV 2.3 and it worked i.e. b
's type was CV_64F
after the call to filter2D
:
cv::Mat a(100, 100, CV_64F);
cv::Mat op(25, 25, CV_64F);
cv::Mat b(a.size(), CV_64F);
cv::Mat l(a.size(), CV_64F);
cv::Mat m(a.size(), CV_64F);
cv::Point anchor(-1, -1);
filter2D(a, b, -1, op, anchor, 0, cv::BORDER_DEFAULT);
Are you sure a
is CV_64F
in your code?
To what type is b
getting converted to by filter2D
?
Which version of OpenCV are you using?
精彩评论