What is the correct way of getting a pointer to an image/cv::Mat row?

asked 2016-03-08 10:39:42 -0600

Antonio gravatar image

The question in general is: What is the correct way of getting a pointer to an image/cv::Mat row?

Background: I was checking the code of CCStatsOp inside /modules/imgproc/src/connectedcomponents.cpp

I saw that to get a pointer to an image row the following code is used:

int *row = &statsv.at<int>(l, 0);

But I wonder: Wouldn't the following be more efficient?

int *row = statsv.ptr<int>(l);
edit retag flag offensive close merge delete

Comments

1

The second one is the preferred method, yes.

Tetragramm gravatar imageTetragramm ( 2016-03-08 19:19:34 -0600 )edit