image height and width
Hi Guys,
Is it possible to get the height and width of an image? I tried using image.get(3) and image.get(4) as I do with video captures but it doesn't seem to work with still images.
Thanks
Assuming this is c++
cv::Size sz = image.size();
int imageWidth = sz.width;
int imageHeight = sz.height;
Note: if the image has higher dimension than 2D (i.e. representing time-lapse or a stack of images), this may throw an exception.
Thank you!
Is there a reason why I can't use a pointer for these statements? I get an error message saying that the expression must have a class type (*image is underlined). I'm planning to use this in a function.
Size sz = *image.size(); int imageWidth = sz.width; int imageHeight = sz.height;
Hi berak,
can you explain what you mean by "but do not keep or pass around pointers to cv::Mat. those are already refcounted smartpointers, and you will inevitably wreck the internal refcounts this way."?
I thought it was more efficient to pass your images as pointers?
Asked: 2014-09-20 23:13:11 -0600
Seen: 14,388 times
Last updated: Sep 21 '14