Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Increase the maximum amount of channels in cv::Mat

Hi,

In my current work, I need to represent an input image (e.g. 200x200 color) as a matrix of feature vectors extracted from fixed sub-regions of the image. So the final feature representation forms a matrix with ColRowDepth dimensional size, where Col and Row are always smaller than the original size(i.e. 200* 200), and the Depth (channel) needs to be 512, 1024, ..., up to 8192. And the feature is already extracted and stored in a text file offline, so all I have to do is just declare a cv::Mat variable and initialize it with values loaded from the text file. But one problem was that maximum amount of channels of cv::Mat is currently defined and limited to 512 by constant CV_CN_MAX, as mentioned in http://answers.opencv.org/question/13601/cv2split-doesnt-work-beyond-512/. So I tried to modify the constant and recompiled the opencv and my programs, and it seems to be able to accommodate higher channel such as 1024, 2048, and so on. But after I increase the constant, I have matrix computation results different from before the constant modification, even though I've used same feature text file and same numerical operation. For example, if the dot product of two feature vectors (row==1, col==1) and (row==2, col==2) was "1.1", then I expected the result must be same for the same feature vectors and dot product operation after the constant modification, but it wasn't. Also the computation time and memory usage have been drastically increased. I guess CV_CN_MAX not only influence on the maximum amount of channels, but also something else in opencv.

So my question is that is there another way to represent a high-depth (e.g. 4096 and 8192) matrix other that modifying CV_CN_MAX? If no, then what else would I need to look at to solve this issue? Sorry for the non-straightforward question :(

Increase the maximum amount of channels in cv::Mat

Hi,

In my current work, I need to represent an input image (e.g. 200x200 color) as a matrix of feature vectors extracted from fixed sub-regions of the image. So the final feature representation forms a matrix with ColRowCol * Row * Depth dimensional size, where Col and Row are always smaller than the original size(i.e. 200* 200), and the Depth (channel) needs to be 512, 1024, ..., up to 8192. And the feature is already extracted and stored in a text file offline, so all I have to do is just declare a cv::Mat variable and initialize it with values loaded from the text file. But one problem was that maximum amount of channels of cv::Mat is currently defined and limited to 512 by constant CV_CN_MAX, as mentioned in http://answers.opencv.org/question/13601/cv2split-doesnt-work-beyond-512/. So I tried to modify the constant and recompiled the opencv and my programs, and it seems to be able to accommodate higher channel such as 1024, 2048, and so on. But after I increase the constant, I have matrix computation results different from before the constant modification, even though I've used same feature text file and same numerical operation. For example, if the dot product of two feature vectors (row==1, col==1) and (row==2, col==2) was "1.1", then I expected the result must be same for the same feature vectors and dot product operation after the constant modification, but it wasn't. Also the computation time and memory usage have been drastically increased. I guess CV_CN_MAX not only influence on the maximum amount of channels, but also something else in opencv.

So my question is that is there another way to represent a high-depth (e.g. 4096 and 8192) matrix other that modifying CV_CN_MAX? If no, then what else would I need to look at to solve this issue? Sorry for the non-straightforward question :(

Increase the maximum amount of channels in cv::Mat

Hi,

In my current work, I need to represent an input image (e.g. 200x200 color) as a matrix of feature vectors extracted from fixed sub-regions of the image. So the final feature representation forms a matrix with Col * Row * Depth dimensional size, where Col and Row are always smaller than the original size(i.e. 200* 200), and the Depth (channel) needs to be 512, 1024, ..., up to 8192. And the feature is already extracted and stored in a text file offline, so all I have to do is just declare a cv::Mat variable and initialize it with values loaded from the text file. But one problem was that maximum amount of channels of cv::Mat is currently defined and limited to 512 by constant CV_CN_MAX, as mentioned in http://answers.opencv.org/question/13601/cv2split-doesnt-work-beyond-512/. So I tried to modify the constant and recompiled the opencv and my programs, and it seems to be able to accommodate higher channel such as 1024, 2048, and so on. But after I increase the constant, I have matrix computation results different from before the constant modification, even though I've used same feature text file and same numerical operation. For example, if the dot product of two feature vectors (row==1, col==1) and (row==2, col==2) was "1.1", then I expected the result must be same for the same feature vectors and dot product operation after the constant modification, but it wasn't. Also the computation time and memory usage have been drastically increased. I guess CV_CN_MAX not only influence on the maximum amount of channels, but also something else in opencv.

So my question is that is there another way to represent a high-depth (e.g. 4096 and 8192) matrix other that than modifying CV_CN_MAX? If no, then what else would I need to look at to solve this issue? Sorry for the non-straightforward question :(