cv::Mat::size() cannot be found here
Hi,
I cannot find the size() in the class reference but I know that it is there. So what am I missing?
Here is a link to the documentation
Thank you
Hi,
I cannot find the size() in the class reference but I know that it is there. So what am I missing?
Here is a link to the documentation
Thank you
I stand to be corrected but according to their documentation, there are two ways of attaining the size of a Matrix.
So let us say we have Mat temp. If we want to find its size, you could either:
1. Old School method
From their documentation, a Mat consists of a size attribute which returns a MatSize struct object. By doing temp.size, you will get the correct matrix size but in MatSize return type and of height X width format.
2. Operator method
A look into MatSize, you will see that it implements the () operator. With this method though, its return type is Size and of the famously adapted format width X height. So by doing temp.size(), the MatSize's operator() method gets called.
You might ask, so which one should be used? It depends on your scenario.
I believe the MatSize version was there for the old C-API (speculation). If you are still using it (you shouldn't be by now), then .size makes sense. During my lazy coding days, I tend to use it as well just for quick matrix size checkups.
I mostly use .size() because other functions adapted Size. For example, this default constructor takes Size instead of MSize.
Either one you choose to use, keep in mind of the returned format.
Asked: 2017-09-11 10:22:41 -0600
Seen: 687 times
Last updated: Sep 11 '17
Do all opencv functions support in-place mode for their arguments?
What is the most effective way to access cv::Mat elements in a loop?
How to add documentation to a class?
Is there penalty for reference counting in Mat?
Saving an image with unset pixels
android: how to put a column into Mat
Best site for general documentation
how to understand which functions available in python bindings?
http://docs.opencv.org/master/d3/d63/...
I saw that but it returned the
MatSizeobject