void NonRigid::setUserTrans(vtkSmartPointer<vtkMatrix4x4> mat) { if (!temp_mesh_vec.empty()) { // convert vertices to eigen 4*n matrix Eigen::MatrixXd v_mat(4, temp_mesh_vec.size()/3); v_mat << Eigen::Map<Eigen::MatrixXd>(&temp_mesh_vec[0], 3, temp_mesh_vec.size()/3), Eigen::RowVectorXd::Ones(temp_mesh_vec.size()/3); // set transform Eigen::Matrix4d trans_mat; for (size_t i = 0; i < 4; ++i) { for (size_t j = 0; j < 4; ++j) { trans_mat(i, j) = mat->GetElement(i, j); } } Eigen::MatrixXd new_v_mat = trans_mat * v_mat; temp_mesh_vec.clear(); for (size_t i = 0; i < new_v_mat.cols(); ++i) { temp_mesh_vec.push_back(new_v_mat(0, i)/new_v_mat(3, i)); temp_mesh_vec.push_back(new_v_mat(1, i)/new_v_mat(3, i)); temp_mesh_vec.push_back(new_v_mat(2, i)/new_v_mat(3, i)); } } }
void MatCache::set_yuv422(uint8_t *y, int rs_y, uint8_t *u, int rs_u, uint8_t *v, int rs_v) { invalidate(); cv::Mat y_mat(height, width, CV_8UC1, (void*)y, rs_y); update_image("gray_8u", y_mat); cv::Mat u_mat(height / 2, width / 2, CV_8UC1, (void*)u, rs_u); update_image("yuv422_u_8u", u_mat); cv::Mat v_mat(height / 2, width / 2, CV_8UC1, (void*)v, rs_v); update_image("yuv422_v_8u", v_mat); }