diff --git a/applications/reconstruct/include/ftl/ray_cast_util.hpp b/applications/reconstruct/include/ftl/ray_cast_util.hpp index ecd82ea17f30abd4788777bb8a61c9d591a22a3d..ed01c5e657b6e7634fc5e1b85525e924db108c29 100644 --- a/applications/reconstruct/include/ftl/ray_cast_util.hpp +++ b/applications/reconstruct/include/ftl/ray_cast_util.hpp @@ -61,7 +61,7 @@ struct RayCastData { __host__ void download(float3 *points, uchar3 *colours, const RayCastParams& params) const { //printf("Download: %d,%d\n", params.m_width, params.m_height); - cudaSafeCall(cudaMemcpy(points, d_depth3, sizeof(float3) * params.m_width * params.m_height, cudaMemcpyDeviceToHost)); + //cudaSafeCall(cudaMemcpy(points, d_depth3, sizeof(float3) * params.m_width * params.m_height, cudaMemcpyDeviceToHost)); cudaSafeCall(cudaMemcpy(colours, d_colors, sizeof(uchar3) * params.m_width * params.m_height, cudaMemcpyDeviceToHost)); } diff --git a/applications/reconstruct/src/main.cpp b/applications/reconstruct/src/main.cpp index d715e19fa5bd20d3f0b34316a4654e83e99581ff..dcbc47a46f718dd90b2d37de17ffecbdebcbc3b5 100644 --- a/applications/reconstruct/src/main.cpp +++ b/applications/reconstruct/src/main.cpp @@ -396,18 +396,19 @@ static void run() { LOG(INFO) << "Scene created"; float3 *point_array = new float3[rayparams.m_width*rayparams.m_height]; - uchar3 *colour_array = new uchar3[rayparams.m_width*rayparams.m_height]; + //uchar3 *colour_array = new uchar3[rayparams.m_width*rayparams.m_height]; + cv::Mat colour_array(cv::Size(rayparams.m_width,rayparams.m_height), CV_8UC3); float bounce = 0.0; int bounce_dir = 1; - net.broadcast("grab"); // To sync cameras + //net.broadcast("grab"); // To sync cameras int active = inputs.size(); while (active > 0 && display_merged.active()) { active = 0; - + net.broadcast("grab"); // To sync cameras PointCloud<PointXYZRGB>::Ptr cloud(new PointCloud<PointXYZRGB>); @@ -462,7 +463,7 @@ static void run() { else bounce -= 0.02f; if (fabs(bounce) > 1.0f) bounce_dir = (bounce_dir > 0) ? -1 : 1; - Eigen::Affine3f transform(Eigen::Translation3f(bounce,0.0f,0.0f)); + Eigen::Affine3f transform(Eigen::Translation3f(-1.0f+bounce*0.3f,0.0f,bounce)); Eigen::Matrix4f viewPose = transform.matrix(); //viewPose = inputs[0].source->getPose(); @@ -471,11 +472,11 @@ static void run() { rays.render(scene.getHashData(), scene.getHashParams(), inputs[0].gpu, viewPose); LOG(INFO) << "Download points"; - rays.getRayCastData().download(point_array, colour_array, rayparams); + rays.getRayCastData().download(point_array, (uchar3*)colour_array.data, rayparams); int pc = 0; - LOG(INFO) << "Convert points..."; + /*LOG(INFO) << "Convert points..."; for (int i=0; i<rayparams.m_width*rayparams.m_height; i++) { if (point_array[i].x == MINF || point_array[i].z == 0.0f) continue; pcl::PointXYZRGB p(colour_array[i].z, colour_array[i].y, colour_array[i].x); @@ -487,14 +488,14 @@ static void run() { pc++; } - if (pc > 0) { - display_merged.render(cloud); + if (pc > 0) {*/ + display_merged.render(colour_array); display_merged.wait(1); - } + //} } delete [] point_array; - delete [] colour_array; + //delete [] colour_array; #endif // TODO non-PCL (?) } diff --git a/components/renderers/cpp/src/display.cpp b/components/renderers/cpp/src/display.cpp index a768c10e84ce0de5d5a10e04e5283e659de2b922..9e8e72cadf3b003de0adccb7394655406eda8aae 100644 --- a/components/renderers/cpp/src/display.cpp +++ b/components/renderers/cpp/src/display.cpp @@ -222,6 +222,7 @@ bool Display::render(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr pc) { #endif // HAVE_PCL bool Display::render(const cv::Mat &img, style_t s) { if (s == STYLE_NORMAL) { + cv::namedWindow("Image", cv::WINDOW_KEEPRATIO); cv::imshow("Image", img); } else if (s = STYLE_DISPARITY) { Mat idepth;