Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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);