1 | initial version |
first, your cvtColor
call is useless, beacuse ppm's can have at most 3 channels, and you're reading it as bgr.
then, you got rows and cols wrong in Size(rgbImage.rows, rgbImage.cols)
and last, for a multi-dimensional Mat you cannot use rows
and cols
, those apply only in a 2d world. use:
int N = blob.size[0], C = blob.size[1], H = blob.size[2], W = blob.size[3];
there's also an operator for printing:
cout << blob.size << endl; // NO () !
2 | No.2 Revision |
first, your cvtColor
call is useless, beacuse ppm's can have at most 3 channels, and you're reading it as bgr.
then, you got rows and cols wrong in Size(rgbImage.rows, rgbImage.cols)
and last, for a multi-dimensional Mat you cannot use rows
and cols
, those apply only in a 2d world. use:use Mat::size
instead:
int N = blob.size[0], C = blob.size[1], H = blob.size[2], W = blob.size[3];
there's also an operator for printing:
cout << blob.size << endl; // NO () !