Need help to convert nvbuffer to cv::mat using libargus on TX2

I figured out the issue. Since I used pitch layout, I have to specify the pitch as step size when creating the cv::Mat. So the to create cv::Mat, the following code should be used:

cv::Mat imgbuf = cv::Mat(iSensorMode->getResolution().height(), iSensorMode->getResolution().width(),CV_8UC4, pdata, nvbufparams.pitch[0]);

Now I have another question, this post has clearly explained how pitch layout works. But what about block linear? So in block linear layout, if I have image size WxH and if I would like to access pixel P at location (r,c), what do I do?


Jon Liu