template Mat_<T> having issues with "long" types (Bug #838)


Added by hype blade about 14 years ago. Updated about 14 years ago.


Status:Done Start date:
Priority:Blocker Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:core
Target version:-
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

Hi there,
I just ran into an issue where the Mat-template won't work if the template is of type "long", "unsigned long".

Under Visual Studio 2010 the compiler throws the following error:
error C2039: 'fmt' : is not a member of 'cv::DataDepth<_Tp>' C:\_Sources\OpenCV\2.2_stable_branch\modules\core\include\opencv2\core\core.hpp 977

Looking at "core.hpp", line 389 and following there is no definition for "long" types which is - as far as I can see - the reason for this error.

Please complete your list of template types, so that ALL naive/standard types are supported.

By the way, OpenCV 2.1 did not have this issue!

Regards
Matthias


History

Updated by Vadim Pisarevsky about 14 years ago

Unlike char, short or int, long definition varies with the platform. sizeof(long) 4 on 32-bit Linux and 32- and 64-bit Windows, sizeof(long)8 on 64-bit Linux and MacOS X. 64-bit integers are not supported by OpenCV. Therefore, Mat_<long> can not be processed correctly.

In OpenCV 2.1 DataDepth<> has been declared incorrectly, so that you could create Mat_<T> for arbitrary type T, which could later result in memory corruption and other bad side effects. In OpenCV 2.2 it has been fixed, so that you can only create Mat_<T> if and only if T can be described with one of CV_8UC(n) ... CV_64FC(n).

Please, replace Mat_<long> with Mat_<int>, or, at your own risk, define DataDepth<long> specialization.

  • Status changed from Open to Done
  • (deleted custom field) set to wontfix

Also available in: Atom PDF