Briefly, I would like to know if it is possible to directly access pixel value of a CV_32F Mat, through Mat member \"uchar* data\".
I can do it with no problem if Ma
You can use ptr
method which returns pointer to matrix row:
for (int y = 0; y < mat.rows; ++y)
{
float* row_ptr = mat.ptr(y);
for (int x = 0; x < mat.cols; ++x)
{
float val = row_ptr[x];
}
}
You can also cast data
pointer to float and use elem_step
instead of step
if matrix is continous:
float* ptr = (float*) mat.data;
size_t elem_step = mat.step / sizeof(float);
float val = ptr[i * elem_step + j];