OpenCV C++11 Timeline

asked 2016-12-21 11:28:34 -0500

addisonElliott gravatar image

I am working on a project that involves working with 3D images. I am using OpenCV because they have the best multidimensional matrix support. With that in mind, many of the functionality in OpenCV is geared towards 2D matrices.

When creating matrices, the general functionality is:
    (int ndims, const int* sizes, ...)

The issue with this is that it requires two lines of code; one to initialize the int pointer and another to actual create the array. Although this is a small issue, it can be solved using C++11 with std::initializer_list.

Old syntax:

int dims[] = { 12, 2, 3 };
cv::Mat mat(3, dims, CV_32FC1);

New syntax:

cv::Mat mat({ 12, 2, 3 }, CV_32FC1);

This syntax can be added to the following functions: Mat::zeros, Mat::ones, Mat constructor, Mat::create, UMat constructor, OutputArray::create.

What is the timeline for C++11 support? Any approximate date when it will be added? I noticed that OpenCV has discussed adding it in the near future according to their meeting notes.

edit retag flag offensive close merge delete


see this post about 3dmat

LBerger gravatar imageLBerger ( 2016-12-21 11:37:38 -0500 )edit

Hm, that is an interesting way to do things. However, the method is a 'hack' to using multidimensional arrays. For example, I need to flip my 3D matrix along the Z dimension. This becomes very difficult to do efficiently using the channel method. (I am currently working on a flip function that works on multidimensional arrays).

addisonElliott gravatar imageaddisonElliott ( 2016-12-21 17:04:58 -0500 )edit

I have try inrange method for 3D mat as in this post but I am not able to get data.

May be your question is Does opencv must be able to process 3D data and if yes which algorithm must be implemented?

LBerger gravatar imageLBerger ( 2016-12-21 23:23:32 -0500 )edit

Well, no, my question is more along the lines of "When will C++11 be implemented into OpenCV?" I do think 3D matrices are necessary in OpenCV because 3D images are very common. I am working with MRI data that is a 3D image and can even be 4D images if you factor in a time element. The fact is that a lot of the algorithms like findNonZero or flip are applicable to multidimensional matrices as well but are not implemented in OpenCV that way.

addisonElliott gravatar imageaddisonElliott ( 2016-12-22 08:59:28 -0500 )edit