Items with no label
3335 Discussions

alignment fails when enable_device(serialid) is used

obran
Beginner
1,725 Views

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

0 Kudos
5 Replies
MartyG
Honored Contributor III
496 Views

Have you seen the Multicam SDK example?

https://github.com/IntelRealSense/librealsense/tree/master/examples/multicam 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?

0 Kudos
obran
Beginner
496 Views

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.

0 Kudos
MartyG
Honored Contributor III
496 Views

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);

}

0 Kudos
obran
Beginner
496 Views

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);
0 Kudos
MartyG
Honored Contributor III
496 Views

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.

0 Kudos
Reply