Ask Your Question
2

cv::Vec3f vs cv::Point3f

asked 2017-02-22 09:28:42 -0600

Nbb gravatar image

May sound like a stupid question. I have always wondered if there is an important difference between the two ?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
4

answered 2018-01-21 16:11:55 -0600

infoclogged gravatar image

The way you access thelements. cv::Vec3f is a vector of 3 float elements and hence belongs to the class Vector. You access each element by dereferencing the index.

Point3f is more intuitive, because you access the elements using a struct that is made of 3 floats. So the first element is accessed using point.x, the second is accessed using point.y and the third by point.z. The Point class also gives access to other coordinate related stuffs such as cross and dot product.

The class vector where in is primarily used to store and access data.

I am not sure, about the speed difference between the two. But as an end user, Point makes life pretty simple.

edit flag offensive delete link more
2

answered 2018-01-20 07:23:41 -0600

updated 2018-01-20 07:44:20 -0600

you can refer the documentation to get the answer

typedef Vec<float, 3> cv::Vec3f

see Vec

typedef Point3_<float> cv::Point3f

see Point3_

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-02-22 09:28:42 -0600

Seen: 7,008 times

Last updated: Jan 21 '18