Multi Sensor(4 kinects xbox 360) volume window is showing blank

Digitize Your World Forums SDK Development Multi Sensor(4 kinects xbox 360) volume window is showing blank

This topic contains 2 replies, has 2 voices, and was last updated by  Thomas Pönitz 1 year, 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #13579

    Priyash

    Hello Christoph ,

    I am using the 4 kinect sensor for a single fullbody scan(for single volume) but the volume is not updating , and I am using the sensor multi-independent code example url:-http://reconstructme.net/wpcontent/uploads/ReconstructMe/doc/example_reconstructmesdk_sensor_multi_independent_8cpp-example.html

      Below is the hardware specs

    :-
    Ram : 8GB
    Graphics Card : Zotac Nvidia geForce gtx 980 8GB
    Processor : Intel Core i7
    OS :- Windows 8.1 64 bit
    ReconstructMe SDK version :- 2.2940

    Problem is the the output :- 8 windows for 4 sensors for each sensor one window is for depth and one for volume ,only depth window is showing but the volume window is not rendering and updating its showing blank, can you please share your views where am I going wrong ?

    #13580

    Priyash

    To give you more details, the code that we are using is pasted below based on the sample provided, and updated for 3 sensors.

    The issue we are facing is that in the iteration for the first sensor, the function call reme_sensor_track_position(c, sensor[i]) succeeds and goes forward with updating the volume. However, for the other 2 slave sensors, the sensor track position fails and returns REME_ERROR_TRACK_LOST.

    ISSUE HAPPENING HERE:
    // Update the volume from both sensors when we sensor tracking succeeded.
    for (int i = 0; i < 3; ++i)
    {
    if (REME_SUCCESS(grab[i]))
    {
    reme_sensor_prepare_images(c, sensor[i]);
    if (REME_SUCCESS(reme_sensor_track_position(c, sensor[i])))
    {
    reme_sensor_update_volume(c, sensor[i]);
    }
    }
    }

    Would appreciate any thoughts on resolution here.

    FULL CODE:

    void MultiScan()
    {
    // Create a new context
    reme_context_t c;
    reme_context_create(&c);
    reme_context_set_log_callback(c, reme_default_log_callback);
    // Create a license object
    reme_license_t l;
    reme_license_create(c, &l);
    reme_error_t e = reme_license_authenticate(c, l, license);
    // Create options
    reme_options_t o;
    reme_options_create(c, &o);
    // Create a new volume
    reme_volume_t v;
    reme_volume_create(c, &v);
    // Create a sensors
    reme_sensor_t sensor[4];
    //# sensor 1
    reme_sensor_create(c, “mskinect”, false, &sensor[0]);
    reme_sensor_bind_camera_options(c, sensor[0], o);
    //# sensor 2
    reme_sensor_create(c, “C:\\Users\\Inkarn\\Documents\\Visual Studio 2013\\Projects\\ReconstructMeApps\\config\\mskinect.txt”, false, &sensor[1]);
    reme_sensor_bind_camera_options(c, sensor[1], o);
    //# sensor 3
    reme_sensor_create(c, “C:\\Users\\Inkarn\\Documents\\Visual Studio 2013\\Projects\\ReconstructMeApps\\config\\mskinect1.txt”, false, &sensor[2]);
    reme_sensor_bind_camera_options(c, sensor[2], o);
    /*//# sensor 4
    reme_sensor_create(c, “C:\\Users\\admin\\Documents\\mskinect2.txt”, false, &sensor[3]);
    reme_sensor_bind_camera_options(c, sensor[3], o);*/

    reme_options_set_bool(c, o, “enable_align_viewpoints”, true);

    reme_sensor_open(c, sensor[0]);
    reme_context_bind_reconstruction_options(c, o);

    reme_sensor_open(c, sensor[1]);
    reme_context_bind_reconstruction_options(c, o);

    reme_sensor_open(c, sensor[2]);
    reme_context_bind_reconstruction_options(c, o);

    //reme_sensor_open(c, sensor[3]);*/

    reme_options_set_bool(c, o, “data_integration.use_colors”, true);
    reme_context_tune_reconstruction_options(c, REME_TUNE_PROFILE_MAX_QUALITY);//REME_TUNE_PROFILE_MID_QUALITY

    reme_context_compile(c);

    reme_sensor_bind_render_options(c, sensor[0], o);
    reme_options_set(c, o, “shade_mode”, “SHADE_COLORS”);

    reme_sensor_bind_render_options(c, sensor[1], o);
    reme_options_set(c, o, “shade_mode”, “SHADE_COLORS”);

    reme_sensor_bind_render_options(c, sensor[2], o);
    reme_options_set(c, o, “shade_mode”, “SHADE_COLORS”);

    /*reme_sensor_bind_render_options(c, sensor[3], o);
    reme_options_set(c, o, “shade_mode”, “SHADE_COLORS”);*/
    // Apply
    reme_sensor_apply_render_options(c, sensor[0], o);
    reme_sensor_apply_render_options(c, sensor[1], o);
    reme_sensor_apply_render_options(c, sensor[2], o);
    //reme_sensor_apply_render_options(c, sensor[3], o);*/

    float pos[4][16];
    //puts(“Load camera position (y/n)?”);

    if (MessageBox(NULL, L”Load Camera Position?”, L”Camera Position”, MB_YESNO) == IDYES) {
    // Load sensor positions
    if (position_from_file(“C:\\Users\\admin\\Desktop\\ReconstructMe_Output\\UI_Win32\\sensor0.pos”, &pos[0][0], 16))
    {
    reme_sensor_set_position(c, sensor[0], &pos[0][0]);
    // Note, inital tracking is not required, since position is known
    reme_sensor_set_trackhint(c, sensor[0], REME_SENSOR_TRACKHINT_DONT_TRACK);
    //puts(“Loaded sensor0.pos”);
    }
    if (position_from_file(“C:\\Users\\admin\\Desktop\\ReconstructMe_Output\\UI_Win32\\sensor1.pos”, &pos[1][0], 16))
    {
    reme_sensor_set_position(c, sensor[1], &pos[1][0]);
    // Note, inital tracking is not required, since position is known
    reme_sensor_set_trackhint(c, sensor[1], REME_SENSOR_TRACKHINT_DONT_TRACK);
    //puts(“Loaded sensor1.pos”);
    }
    if (position_from_file(“C:\\Users\\admin\\Desktop\\ReconstructMe_Output\\UI_Win32\\sensor2.pos”, &pos[2][0], 16))
    {
    reme_sensor_set_position(c, sensor[2], &pos[2][0]);
    // Note, inital tracking is not required, since position is known
    reme_sensor_set_trackhint(c, sensor[2], REME_SENSOR_TRACKHINT_DONT_TRACK);
    //puts(“Loaded sensor2.pos”);
    }
    if (position_from_file(“C:\\Users\\admin\\Desktop\\ReconstructMe_Output\\UI_Win32\\sensor3.pos”, &pos[3][0], 16))
    {
    reme_sensor_set_position(c, sensor[3], &pos[3][0]);
    // Note, inital tracking is not required, since position is known
    reme_sensor_set_trackhint(c, sensor[3], REME_SENSOR_TRACKHINT_DONT_TRACK);
    //puts(“Loaded sensor3.pos”);
    }
    }
    else
    {
    // Enable registration of sensor’s. Note, it is required to place the sensor
    // pysically close to the first sensor and let them view in the same direction
    reme_sensor_set_trackhint(c, sensor[1], REME_SENSOR_TRACKHINT_USE_GLOBAL);
    reme_sensor_set_trackhint(c, sensor[2], REME_SENSOR_TRACKHINT_USE_GLOBAL);
    //reme_sensor_set_trackhint(c, sensor[3], REME_SENSOR_TRACKHINT_USE_GLOBAL);*/
    // Set default positon
    reme_sensor_set_prescan_position(c, sensor[0], REME_SENSOR_POSITION_INFRONT);
    reme_sensor_set_prescan_position(c, sensor[1], REME_SENSOR_POSITION_INFRONT);
    reme_sensor_set_prescan_position(c, sensor[2], REME_SENSOR_POSITION_INFRONT);
    //reme_sensor_set_prescan_position(c, sensor[3], REME_SENSOR_POSITION_INFRONT);*/
    //puts(“Using default postions for sensors”);
    }
    // Prepare viewers
    reme_viewer_t viewer;
    reme_viewer_create_image(c, “This is ReconstructMeSDK”, &viewer);
    reme_image_t imgs[6];
    reme_image_create(c, &imgs[0]);
    reme_image_create(c, &imgs[1]);
    reme_image_create(c, &imgs[2]);
    reme_image_create(c, &imgs[3]);
    reme_image_create(c, &imgs[4]);
    reme_image_create(c, &imgs[5]);
    //reme_image_create(c, &imgs[6]);
    //reme_image_create(c, &imgs[7]);*/

    reme_viewer_add_image(c, viewer, imgs[0]);
    reme_viewer_add_image(c, viewer, imgs[1]);
    reme_viewer_add_image(c, viewer, imgs[2]);
    reme_viewer_add_image(c, viewer, imgs[3]);
    reme_viewer_add_image(c, viewer, imgs[4]);
    reme_viewer_add_image(c, viewer, imgs[5]);
    /*reme_viewer_add_image(c, viewer, imgs[6]);
    reme_viewer_add_image(c, viewer, imgs[7]);*/

    bool continue_grabbing = true;
    reme_error_t grab[3] = { REME_ERROR_SUCCESS, REME_ERROR_SUCCESS, REME_ERROR_SUCCESS };
    while ((REME_SUCCESS(grab[0]) || REME_SUCCESS(grab[1]) || REME_SUCCESS(grab[2])) && continue_grabbing)
    {
    // Grab from both sensors.
    grab[0] = reme_sensor_grab(c, sensor[0]);
    grab[1] = reme_sensor_grab(c, sensor[1]);
    grab[2] = reme_sensor_grab(c, sensor[2]);
    //grab[3] = reme_sensor_grab(c, sensor[3]);*/
    // Update the volume from both sensors when we sensor tracking succeeded.
    for (int i = 0; i < 3; ++i)
    {
    if (REME_SUCCESS(grab[i]))
    {
    reme_sensor_prepare_images(c, sensor[i]);
    if (REME_SUCCESS(reme_sensor_track_position(c, sensor[i])))
    {
    reme_sensor_update_volume(c, sensor[i]);
    }
    }
    }
    reme_sensor_get_image(c, sensor[0], REME_IMAGE_DEPTH, imgs[0]);
    reme_sensor_get_image(c, sensor[0], REME_IMAGE_VOLUME, imgs[1]);
    reme_sensor_get_image(c, sensor[1], REME_IMAGE_DEPTH, imgs[2]);
    reme_sensor_get_image(c, sensor[1], REME_IMAGE_VOLUME, imgs[3]);
    reme_sensor_get_image(c, sensor[2], REME_IMAGE_DEPTH, imgs[4]);
    reme_sensor_get_image(c, sensor[2], REME_IMAGE_VOLUME, imgs[5]);
    /*reme_sensor_get_image(c, sensor[3], REME_IMAGE_DEPTH, imgs[6]);
    reme_sensor_get_image(c, sensor[3], REME_IMAGE_VOLUME, imgs[7]);*/
    reme_viewer_update(c, viewer);
    if (GetAsyncKeyState(VK_F1) & 0x1)
    {
    //exit
    continue_grabbing = false;
    }
    if (GetAsyncKeyState(VK_F2) & 0x1)
    {
    //save sensor position
    reme_sensor_get_position(c, sensor[0], &pos[0][0]);
    reme_sensor_get_position(c, sensor[1], &pos[1][0]);
    reme_sensor_get_position(c, sensor[2], &pos[2][0]);
    //reme_sensor_get_position(c, sensor[3], &pos[3][0]);*/
    if (position_to_file(“C:\\Users\\admin\\Desktop\\ReconstructMe_Output\\UI_Win32\\sensor0.pos”, &pos[0][0], 16))
    {
    MessageBox(NULL, L”Saved sensor0.pos”, L”Save”, MB_ICONINFORMATION);
    }
    if (position_to_file(“C:\\Users\\admin\\Desktop\\ReconstructMe_Output\\UI_Win32\\sensor1.pos”, &pos[1][0], 16))
    {
    MessageBox(NULL, L”Saved sensor1.pos”, L”Save”, MB_ICONINFORMATION);
    }
    /*if (position_to_file(“C:\\Users\\admin\\Desktop\\ReconstructMe_Output\\UI_Win32\\sensor2.pos”, &pos[2][0], 16))
    {
    MessageBox(NULL, L”Saved sensor2.pos”, L”Save”, MB_ICONINFORMATION);
    }
    if (position_to_file(“C:\\Users\\admin\\Desktop\\ReconstructMe_Output\\UI_Win32\\sensor3.pos”, &pos[3][0], 16))
    {
    MessageBox(NULL, L”Saved sensor3.pos”, L”Save”, MB_ICONINFORMATION);
    }*/
    }

    }
    // Create a new empty surface
    reme_surface_t m;
    reme_surface_create(c, &m);
    // Extract surface from volume.
    reme_surface_generate(c, m, v);
    reme_surface_colorize_vertices(c, m, v);
    // Inpaint vertices with invalid colors.
    reme_surface_inpaint_vertices(c, m);
    // Remesh the surface to generate an isotropic tessellation
    reme_surface_bind_remesh_options(c, m, o);
    // The following properties define the allowed edge length range
    // The tesselation will adhere to these values when splitting/collapsing
    // edges according to local color and geometry change.
    reme_options_set_real(c, o, “minimum_edge_length”, 3);
    reme_options_set_real(c, o, “maximum_edge_length”, 20);
    // Perform remeshing
    reme_surface_remesh(c, m);
    // Remeshing as decimation might change vertex positions,
    // we should update the color information
    reme_surface_colorize_vertices(c, m, v);
    reme_surface_inpaint_vertices(c, m);

    reme_viewer_t viewer_surface;
    reme_viewer_create_surface(c, m, “Final Output”, &viewer_surface);
    reme_viewer_wait(c, viewer_surface);
    // Export mesh
    reme_surface_save_to_file(c, m, “C:\\Users\\admin\\Desktop\\ReconstructMe_Output\\UI_Win32\\final_output.ply”);
    // Print pending errors
    reme_context_print_errors(c);
    // Make sure to release all memory acquired
    reme_context_destroy(&c);
    }

    #40520

    Thomas Pönitz
    Keymaster

    Please try each sensor separately and then add one sensor to the setup and test again until you reach four sensors. It could be that your problems are usb-hardware related.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.