When using multiple cameras, the response of ComputeDisparityMap becomes very slow

Continuing the discussion from How to use a common hardware trigger with multiple cameras:

General Information

  • Product: C57-6-M
  • Serial Number: 244888, 245218
  • Ensenso SDK Version: 4.0.1502
  • Operating System: Windows 10 64bit
  • Data Attachments

Problem / Question

As in the code below, we open two C57 cameras, specify hardware triggers for each, execute the Trigger and Retrieve commands, and then execute the ComputeDisparityMap command.

	nxLibSetString(&error, "/Execute/Parameters/Cameras", m_serial);
	nxLibSetString(&error, "/Execute/Command", "Open");
	nxLibSetString(&error, "/Execute/Parameters/Cameras", m_serial2);
	nxLibSetString(&error, "/Execute/Command", "Open");
	nxLibSetString(&error, "/Execute/Parameters/Cameras", m_serial_C);
	nxLibSetString(&error, "/Execute/Command", "Open");
	nxLibWaitForType(&error, "/Execute/Command", NxLibItemTypeNull, 1);
	nxLibSetString(&error, "/Execute/Parameters/Cameras", m_serial_C2);
	nxLibSetString(&error, "/Execute/Command", "Open");
	nxLibWaitForType(&error, "/Execute/Command", NxLibItemTypeNull, 1);

	NxLibCommand trigger(cmdTrigger);
	trigger.parameters()[itmSubset] = valAll;
	trigger.execute();

	NxLibCommand retrieve(cmdRetrieve);
	retrieve.parameters()[itmTimeout] = -1;
	retrieve.parameters()[itmCameras][0] = m_serial;
	retrieve.parameters()[itmCameras][1] = m_serial2;
	retrieve.execute(static_cast<bool>(false));

	while (1) {
		std::this_thread::sleep_for(std::chrono::microseconds(10));
		if (retrieve.finished()) {
			retrieve.assertSuccessful();
			assert(retrieve.result()[m_serial][itmRetrieved].asBool());
			assert(retrieve.result()[m_serial2][itmRetrieved].asBool());
			bool rc2 = retrieve.result()[m_serial2][itmRetrieved].asBool();
			if (rc2) {
				break;
			}
		}
		if(cancel){
			retrieve.cancel();
			while (true) {
				if (retrieve.finished()) {
					return(1);
				}
			}
		}
	}
	retrieve.parameters()[itmTimeout] = 1000;
	retrieve.parameters()[itmCameras][0] = m_serial_C;
	retrieve.parameters()[itmCameras][1] = m_serial_C2;
	retrieve.execute();

	nxLibSetString(&error, "/Execute/Command", "ComputeDisparityMap");
	nxLibWaitForType(&error, "/Execute/Command", NxLibItemTypeNull, 1);

	nxLibSetString(&error, "/Execute/Command", "ComputePointMap");
	nxLibWaitForType(&error, "/Execute/Command", NxLibItemTypeNull, 1);
	//・・・

However, it takes more than a minute for the ComputeDisparityMap command to complete.

(We are waiting for a response with

nxLibWaitForType(&error, “/Execute/Command”, NxLibItemTypeNull, 1);)

Is there something wrong with how we are using it?

I am attaching the profile obtained at that time.

The single-camera version of the above code works normally.

Thank you in advance.

Best regards,
K.N,

Dear Techno,

We have never seen such strange behavior before. Note that the computation of the disparity map takes a very long time every second time. The first takes about 40 ms, and the second takes about one minute.

It would be helpful if you

  • record a file-camera,
  • check that the effect is reproducible for this file-camera,
  • share this file-camera with us.

Meanwhile, you can try updating to the next version of the SDK.

Best wishes,
Grisha

1 Like

HI Grisha.

First, thanks a lot for your quick response!

The phenomenon is occurring constantly during the test,

20260427101210.enscam (24.9 MB)

and we have the filecamera generated at that time, so I am attaching it.

Could you please take a look?

Thank you very much.

Best regards,
K.N,