Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Matx Data-Type Short-Hand Rules?

Hi Guys, I was reviewing the various OpenCV data types and have a question about the Matx data type (the question also applies to the Vec data type).

We know that you can declare a Matx object using regular notation and short hand notation as below (to define a 2x2 matrix):

Matx<float,2,2> m1 = {1.1,2.2,3.3,4.4};     //regular notation

Matx22f m2 = {1.1,2.2,3.3,4.4};         //shorthand notation

From testing I can see that there are limitations on what size dimensions can be used for short hand notation. For example we can write Matx43f but not Matx42f to define a 4x2 matrix of floats.

Why is this and is there some standard rule for determining what dimensions can be used when defining Vec's or Matx's? Also why can't we use short-hand notation to declare a Matx of int's using Matx22i? It seems really confusing and I wish it was somehow standardized.