Search code examples
visual-studio-2010visual-c++opencvc++-clicomputer-vision

Unable to get the number of columns and rows of a Mat


I am facing to a very weird situation where I am unable to get the number of cols() and rows() of a Mat. Following is my code:

    current = new Mat();


    int cols = current->cols();
    int rows = current->rows();

The current is a pointer and declared in the header file. It is necessary to keep it as a pointer.

Whenever the code reaches the place where I try to get cols() and rows() I get the following error twice, one per each method

term does not evaluate to a function taking 0 arguments

I tried different ways like (*current).cols() but they did not help because that was another error.

How can I solve this?


Solution

  • cols and rows are properties, not methods, therefore you can just use:

     int cols = current->cols;
     int rows = current->rows;