5 Replies Latest reply on Apr 10, 2018 1:47 AM by MartyG

    alignment fails when enable_device(serialid) is used

    omerbrandis

      Dear Realsense community,

       

      I'm new to realsense, and i have encountered a strange problem:

       

       

      I'm using d415 , firmware 5.9.2, sdk 2.10.1, cpp interface.

       

      i've managed to write a program that "captures" an rgb and depth image/frame, and aligns them . ( i've written the data to files in order to check this).

      i've followed the examples on github for this

      (

       

      config.enable_stream(color..)

      config.enble_stream(depth)

      pipeline.start(config)

      wait_for_frames();

      rs2::align align(RS2_STREAM_COLOR);

      align.process(..)

      .get_depth_frame();

      .first(RS2_STREAM_COLOR);

      )

       

      now i must take my app to the next level, my app needs to support multiple camera in parallel,

      so i've added an explicit enable_device(serialid) after the enable_stream commands ( i have not yet even connected the second camera),

      but now the alignment fails , it does not return and error or exception, it simply does not perform full alignment ( there is about a 10 pixel difference).

       

      can someone suggest a solution ?

       

      thanks,

      Omer

        • 1. Re: alignment fails when enable_device(serialid) is used
          MartyG

          Have you seen the Multicam SDK example?

           

          librealsense/examples/multicam at master · IntelRealSense/librealsense · GitHub

           

          Using the Multicam SDK example's code as a reference, if you are using the name 'serialid' to look for connected cameras, I guess the code for looking for those cameras would look like this:

           

          for (auto&& serialid : info.get_new_devices())

              {

                  connected_devices.enable_device(serialid);

              }

           

          Is that what you are using in your own script, please?

          • 2. Re: alignment fails when enable_device(serialid) is used
            omerbrandis

            hello,

             

             

            I have added the "enable_device(serialid)" to my code ( the same one from the multicam example)

            it allows me to connect to a specific camera when more then one is connected.

            but when i use it , the alignment "fails"

             

            thanks,

            omer.

            • 3. Re: alignment fails when enable_device(serialid) is used
              MartyG

              Have you applied the 'serialid' name consistently, using in place of wherever the original Multicam code used the term 'dev'?  For example, after the get_new_devices section quoted above, there is a similar section to check the device list that would also have to have its 'dev' reference changed to 'serialid'.

              From:

               

              // Initial population of the device list

              for (auto&& dev : ctx.query_devices()) // Query the list of connected RealSense devices

              {

                  connected_devices.enable_device(dev);

              }

               

              To:

               

              // Initial population of the device list

              for (auto&& serialid: ctx.query_devices()) // Query the list of connected RealSense devices

              {

                  connected_devices.enable_device(serialid);

              }

              • 4. Re: alignment fails when enable_device(serialid) is used
                omerbrandis

                I did not use/copy the entire multicam example , i don't need all of it,

                i just used the enable_device(serialid) to explicitly enable streams from one of several cameras connected to the pc.

                 

                this is my code:

                 

                 

                // create a pipiline config object
                    rs2::config   myconfig;
                    myconfig.enable_stream(RS2_STREAM_DEPTH, -1,640, 480, RS2_FORMAT_Z16 , 6);
                    myconfig.enable_stream(RS2_STREAM_COLOR, -1,640, 480, RS2_FORMAT_RGB8, 6);
                    //myconfig.enable_device(cameraid);
                    // Create a Pipeline - this serves as a top-level API for streaming and processing frames
                    //rs2::pipeline myp;  --> moved to header file to become a class member
                    // Configure and start the pipeline
                    MyPipelineProfile = myp.start(myconfig);
                • 5. Re: alignment fails when enable_device(serialid) is used
                  MartyG

                  own approach when adapting a script is to add as much of the original code as possible and then strip it out piece by piece until the program stops working, telling you which bits are vital and which can be disposed of.  I'm afraid I can't be of much more help than that in this case.