Skip to content

Instantly share code, notes, and snippets.

@adujardin
Created June 22, 2022 08:47
Show Gist options
  • Save adujardin/bbc32f993e5a0f15e034c426bed8873e to your computer and use it in GitHub Desktop.
Save adujardin/bbc32f993e5a0f15e034c426bed8873e to your computer and use it in GitHub Desktop.
Efficient CPU iterations over sl::Mat 32F and 8UC4
for (int y = 0; y < height; y++) {
// line pointer
float * ptr_disp = (float *) (disp.getPtr<uchar>(sl::MEM::CPU) + y * disp.getStepBytes(sl::MEM::CPU));
uchar4* ptr_image = (uchar4*) (img.getPtr<uchar>(sl::MEM::CPU) + y * img.getStepBytes(sl::MEM::CPU));
for (int x = 0; x < width; x++) {
float px_disp = ptr_disp[x];
uchar4 px = ptr_image[x];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment