Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The maximum channel count wasn't meant to support high numbers of channels. In fact, it wasn't meant to be changeable. If you change it, that makes your code incompatible with other users of OpenCV. Code that is compiled with one value of CV_CN_MAX cannot be linked to other code compiled with a different value.

For one thing, OpenCV assigns a constructed enum value to each matrix, consisting of a bitfield concatenation of the channel count and numeric type. Code that is compiled with a non-standard value of CV_CN_MAX will trash that enum value and will probably causes crashes and headaches for future maintainers of your code.

I think you will have to create higher-dimensional matrices instead. If you find that such higher-dimensional matrices did not provide all of the conveniences that were available to two-dimensional matrices, you have my sympathy. You might consider integrating with alternative libraries such as Eigen or NT2.


void Mat::create(int ndims, const int* sizes, int type)

Link to documentation