Items with no label
3335 Discussions

Issues with the json file does not loading, and image resolutions not get reported correctly

MAbdo2
New Contributor I
3,752 Views

I am coming across three (3) issues, as listed below:

1) The number of devices reported is 1 when no hardware is connected to the PC. When a RealSense device is actually connected to the PC, the reported number of devices is two (2). I thought that with no devices, I should get zero (0), and with one (1) device connected I should get one (1). Is this normal?

2) I am using the snippet of code shown below to load a json file; the file does not get loaded; I know the file is good, because I can actually load it using the Depth Quality Tool. In fact, the json file was produced by the Depth Quality Tool.Also, I know that the path parameter I am passing to load_json is good; the file is really where the path says it is.

3) using the same snippet of code shown below, I am trying get the image resolution (Width and Height). The reported resolution values are invalid; nothing like the resolution (1280 x 720) I expect

Can anyone tell me what is wrong with approach/code?

Thanks in advanced.

auto devices = context.query_devices();

 

size_t NumberOfRealSenseDevices = devices.size();

 

printf("NumberOfRealSenseDevices = %d\n", (int) NumberOfRealSenseDevices);

// Get the first connected device

 

auto RealSenseDevice = devices[0];

// Check if current device supports advanced mode

 

if (RealSenseDevice.is())

 

{

 

// Get the advanced mode functionality

 

auto AdvancedModeDevice = RealSenseDevice.as();

 

// Load the json file

 

try

 

{

 

AdvancedModeDevice.load_json(PathToConfigurationFile);

 

}

 

catch (...)

 

{

 

return false;

 

}

 

// Get the image resolution

 

try

 

{

 

rs2::stream_profile ColorImageProfile;

 

rs2_get_video_stream_resolution(ColorImageProfile.get(), &Width, &Height, NULL);

 

printf("Width = %d Height= %d\n", Width, Height);

 

}

 

catch (...)

 

{

 

return false;

 

}

 

}

 

else

 

return false;
0 Kudos
9 Replies
idata
Employee
1,429 Views

Hello MoA,

 

 

 

Thank you for your interest in the Intel RealSense Technology.

 

We have received your request and are currently investigating.

 

I will get back to you as soon as possible.

 

 

 

Regards,

 

Casandra
0 Kudos
idata
Employee
1,429 Views

Hello MoA,

 

 

 

After looking through your query and details, it seems that the PC embedded camera is also being detected and is camera 0.

 

This is why you are receiving wrong resolution values and multiple cameras. You are seeing the embedded camera of the PC and the Intel RealSense Depth Camera D435. Could you maybe try running the command: rs-enumerate-devices and tell me the output?

 

The following github thread may also have additional information: https://github.com/IntelRealSense/librealsense/issues/1159

 

 

 

Let me know how this turns out.

 

 

Regards,

 

Casandra

 

0 Kudos
MAbdo2
New Contributor I
1,429 Views

Upon further testing, I realized that the issue still persists.

Indeed, there are two devices on my system, the 1st neumerated being the D435 and the 2nd being the laptop camera. So, by chance, the D435 Sensor was being enumerated as device[0].. Also, when I check the serial number of the selected device, it matches my D435 Sensor.

As far as loading the json file, I am at a loss; just dont know what the issue is. Any assistance is apprecaited.

As far as getting the resolution of the image, I figured out what the problem is, but dont know how to fix. The problem is that I am passing an uninitialized stream_profile pointer to the rs2_get_video_stream_resolution (See the line highlighted in green below). The ColorImageProfile is declared but not set to any value!

rs2::stream_profile ColorImageProfile;

Rs2Error = 0;

rs2_get_video_stream_resolution(ColorImageProfile.get(),&Width,&Height,&Rs2Error);

if (Rs2Error)

printf("ALV_IntelRealsenseRS2 : ALV_IntelRealSenseRS2_Initialize : Failed to get the image resolution : %s\n", rs2_get_error_messag(Rs2Error));

How do I initialize the ColorImageProfile?

Thanks,

MoA

0 Kudos
idata
Employee
1,429 Views

Hello MoA,

 

 

 

Thank you for your reply. I am still investigating the json file issue and will give you an update as soon as possible.

 

 

Regarding the rs::stream_profile, please have a look at my answer in the community thread:

 

https://communities.intel.com/thread/126134 https://communities.intel.com/thread/126134

 

 

Regards,

 

Casandra

 

0 Kudos
idata
Employee
1,429 Views

Hello MoA,

 

 

Thank you for your patience.

 

In regards to loading a JSON file, I found the following guide: https://github.com/IntelRealSense/librealsense/blob/master/doc/rs400/rs400_advanced_mode.md

 

 

This guide provides a way to serialize and load parameters, using a JSON file structure.

 

 

Let me know if this is helpful.

 

 

Regards,

 

Casandra

 

0 Kudos
idata
Employee
1,429 Views

Hello MoA,

 

 

 

Following up on my previous reply. Was the solution provided helpful?

 

Is there anything else I can assist you with?

 

 

Regards,

 

Casandra
0 Kudos
MAbdo2
New Contributor I
1,429 Views

Thank you for your follow-up.

As it turned out, the problem was that somehow the documentation gave me the impression that the parameters passed into the load_json API is the path to the file, whereas it is a serialized version of the content of the file! Once I serialized the content, it all worked.

I developed my own serialization code, but my suggestion is that the SDK should provide a standard API for doing so.

Regards,

Mo

0 Kudos
idata
Employee
1,429 Views

Hello MoA,

 

 

 

Thank you very much for your confirmation and suggestion.

 

I am very happy it worked out.

 

 

Regards,

 

Casandra

 

0 Kudos
BMana
Novice
1,429 Views

Hi,

Supposing you're on linux, you can try this :

Find out the device string of the webcam you want to disable:

for device in $(ls /sys/bus/usb/devices/*/product); do

echo $device; cat $device;

done

This will show result lines like this:

/sys/bus/usb/devices/1-1.6/product

Integrated Camera

In which case the device string we look for is 1-1.6.

Disable the webcam using your device string in a command like this:

echo '1-1.6' | sudo tee /sys/bus/usb/drivers/usb/unbind

To enable your webcam at a later time, use your device string in a command like this:

echo '1-1.6' | sudo tee /sys/bus/usb/drivers/usb/bind

source : https://askubuntu.com/a/966308/787808 14.04 - How to disable integrated webcam on ubuntu? - Ask Ubuntu

0 Kudos
Reply