Ask Your Question
0

Rows,cols,channels

asked 2013-06-13 13:00:37 -0600

residentelvio gravatar image

updated 2020-06-08 11:17:11 -0600

Hi people,

I have a question.

Code:

  int rows= img.rows;
  int cols= img.cols;
  int channels=img.channels();

Does this code give to me the numbers of rows,cols and channels of an image I read with imread function? Does the image I use must be in the same path of the project to be read?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-06-14 02:12:04 -0600

Heshan Sandeepa gravatar image

Q1 - If you use Mat structure to load the image, you can get rows, cols and channels as mentioned above.

Q2 - You can put image anywhere you need and set the correct path within imread() function.

edit flag offensive delete link more

Comments

I m running with eclipse in ubuntu. I finish my project but I have this error:

          OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or
          unsupported array type) in cvGetMat, file
          /build/buildd/opencv-2.3.1/modules/core/src/array.cpp, line 2482 terminate
          called after throwing an instance of 'cv::Exception' what():
           /build/buildd/opencv-2.3.1/modules/core/src/array.cpp:2482: error: (-206)
           Unrecognized or unsupported array type in function cvGetMat

I use imread and i have in the same path the picture and the work

residentelvio gravatar imageresidentelvio ( 2013-06-14 07:49:15 -0600 )edit

Question Tools

Stats

Asked: 2013-06-13 13:00:37 -0600

Seen: 1,117 times

Last updated: Jun 14 '13