bug in matrix.cpp / _OutputArray::create OpenCV 2.4.0 (Bug #1944)
Description
Calling cv::subtract with cv::Mat_<float> as destination array produces the following error (was working in 2.3.1):
If I use cv::Mat it works as espected. In 2.3.1 was working alsow with Mat_<float>. What's going on?
Code causing the issue:
cv::Mat_<float> M; cv::Point3f c = _findCloudCentroid (M); //a function that computes centroid for a N x 3 single channel float matrix cv::Mat tmp1; cv::subtract (M, Scalar (c.x, c.y, c.z), tmp1); //OK cv::Mat_<float> tmp2; cv::subtract (M, Scalar (c.x, c.y, c.z), tmp2); //BREAKING - was working in 2.3.1
As a workaround, I use the first form wit cv::Mat without type and then return it as cv::Mat_<float>(tmp1);
But this is rather ugly now and it was working well with the previous release!
Error:
OpenCV Error: Assertion failed (!fixedType() || (CV_MAT_CN(type) == m.channels() && ((1 << CV_MAT_TYPE(flags)) & fixedDepthMask) != 0)) in create, file /home/vito/SourceFolders/OpenCV-2.4.0/modules/core/src/matrix.cpp, line 1355 terminate called after throwing an instance of 'cv::Exception' what(): /home/vito/SourceFolders/OpenCV-2.4.0/modules/core/src/matrix.cpp:1355: error: (-215) !fixedType() || (CV_MAT_CN(type) == m.channels() && ((1 << CV_MAT_TYPE(flags)) & fixedDepthMask) != 0) in function create
Associated revisions
Merge pull request #1944 from ilya-lavrenov:minor_commits
History
Updated by Andrey Kamaev almost 13 years ago
Closing as duplicate.
Fix is already available in trunk.
- Status changed from Open to Cancelled
- Target version set to 2.4.1
- Category set to core
- Assignee set to Andrey Kamaev