Skip to content

Instantly share code, notes, and snippets.

@adujardin
Created April 27, 2018 08:41
Show Gist options
  • Save adujardin/8133a0c49317b18fb3545f76c1bec5db to your computer and use it in GitHub Desktop.
Save adujardin/8133a0c49317b18fb3545f76c1bec5db to your computer and use it in GitHub Desktop.
Functions to cast the ZED SDK sl::Matrix4f to Eigen::Matrix4f
void Transform2Matrix4f(const sl::Matrix4f &array_, Eigen::Matrix4f &mat_) {
for(int y = 0; y < 4; y++) {
for(int x = 0; x < 4; x++)
mat_(y, x) = array_.m[y * 4 + x];
}
}
void Matrix4f2Transform(const Eigen::Matrix4f &mat_, sl::Matrix4f &array_) {
for(int y = 0; y < 4; y++) {
for(int x = 0; x < 4; x++)
array_.m[y * 4 + x] = mat_(y, x);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment