Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

2 dim matrix, how can it be

Hello. I hope you all are fine.

Im new with this API and as every newbie I need a little help here. I'm using a banana pi m2 and a usb cam (a genius one). First of all I want to check the camera paramters, so:

    #include <stdio.h>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui.hpp>

using namespace cv;
using namespace std;

int main(int argc,char ** argv)
{
  VideoCapture cap(0);
  if (!cap.isOpened()) {
    cerr << "ERROR: Unable to open the camera" << endl;
    return 0;
  }
  Mat frame1, frame;
  cout << "Start grabbing, press a key on Live window to terminate" << endl;

        cap >> frame1;
        if (frame1.empty())
                {
                cerr << "ERROR: Unable to grab from the"<<endl;
                }
        int i, j, k,z;
i=frame1.dims;
j=frame1.cols;
k=frame1.rows;
z=frame1.type();

        printf("%d dim\n  %d col \n  %d row\n %d type\n", i, j, k, z);

return 1;
}

And this is what a I got:

Start grabbing, press a key on Live window to terminate
2 dim
640 col
480 row
16 type

How can be a matrix 2 dimension??? So, thats means that it has just 2 colors? its a two channel?

Also, a 16 type means CV_8U. So there is 8 bits per color(R G or B)? because VGA use 6bits per color Thanks in advance.