How to Set the Correspondence Threshold

Hi,

I am trying to set the correspondence Threshold in the on a FileCam using the C API the value is not written since the original values i locked and the variable value is structure locked.

Setting the value not applied with the File Camera open by the C Api..

So which i s the way to set the setting from a programming point of view?

Thanks and best,

Daniel

Hi,

You can set the CorrespondenceThreshold in C using e.g:

...
int error;
nxLibSetDouble(&error,"/Cameras/<serial>/Parameters/DisparityMap/PostProcessing/CorrespondenceThreshold", 20.);
...

Take a look at a full example

nxFileCamera.c (7.5 KB)

To test this you can use the following filecamera: “https://download.ensenso.com/s/sampledata/download?files=box_n35.zip”

Kind regards,

Joel

Hi

I forgot to mention that structure lock does not mean it is forbidden to change values. It is only forbidden to alter the structure and remove entries or add new ones.

Regards,

Joel

Hi,

so thats’ nice at least that seems to be functional with a VirtualCamera using Windows.

But on a FileCam under linux this does not work.

Best,

Daniel

Hi,

I don’t see why this should not work under linux. I am working on linux myself and executed the provided C code example using a file camera downloaded from the website. Can you outline the code you are using to set the threshold? Perhaps I can help you then. You can also send me a personal message if you dont want to share it in a public forum.

Greetings

Joel

The snippet was in the reply eMail … I got back …

So that was the content:

void camSetCorrThresh(int& res, const char *acam, double val)

{

    char path\[128\] = {0};



    strncpy(path, acam, strlen(acam));

    strncat(path, ACAM_CORR_THRESH, strlen(ACAM_CORR_THRESH));



    printf("setting %s to %g", path, val);



    nxLibSetDouble(&res, ACAM_CORR_THRESH, val);

}

From the printf: setting /Cameras/File260951/Parameters/DisparityMap/PostProcessing/CorrespondenceThreshold to 10

Since res is zero. There is absolutely no indication why this value is not being set. NxTree also shows that the value sticks with 60.

Okay, I think the situation is cleared, the nxLibSet call was using a path where the camera part was missing … so just /paramters/DisparityMap/PostProcessing/CorresponcenceThreshHold.

But instead throw ItemNotExistent the Error Code was no Error. Even more confusing, the Default Value seems to be set to the Open Camera, despite there are different Setting stored with the camera.

Hi, a file camera is always opened with default settings and one has to apply the parameters that are shipped alongside the filecam. You can read the set of parameters shipped with the filecam under "Cameras/<serial>/Original/Parameters" using the nxLibGetJson method and write it to "Cameras/<serial>/Parameters" using the nxLibSetJson method, see Using File Cameras — Guides - Ensenso SDK 4.3.1057 Documentation

I think there was no error since “/paramters/DisparityMap/PostProcessing/CorresponcenceThreshHold” got created.