I am trying to understand data contained in FusionConfiguration that is created from the ReadConfigurationFile method. My setup is two cameras ZED2 calibrated with ZED360 app with the 4.1 SDK.
When I check data from script or debug, they don’t seem consistent compared to the json file.
var multiCamConfig = Config.ConfigDirectory + Config.MULTI_CAMERA_FILENAME;
var fusion = new Fusion();
fusion.ReadConfigurationFile(new StringBuilder(multiCamConfig), COORDINATE_SYSTEM.LEFT_HANDED_Y_UP, UNIT.METER, ref configurations, ref nbCameras);
The content of configurations is an array of 20 elements where the three first are:
and the seventeen others are:
I think there is a problem with the FusionConfiguration class that has an enum INPUT_TYPEinputType attribute but is supposed to have a struct InputTypeinputType that contain this enum instead.
Fixing InputType is not enought to make Fusion working, I had to do a lot of minor changes in both C and C# wrapper.
One other important fix is in ZEDFusion.RetrieveBodies method that transmit bodies as ref instead of IntPtr compared to ZEDCamera.RetrieveBodies otherwise there is a Marshall error.
/// <summary>
/// retrieves the body data, can be the fused data (default), or the raw data provided by a specific sender
/// </summary>
/// <param name="bodies"></param>
/// <param name="rtparams"></param>
/// <param name="uuid"></param>
/// <returns></returns>
public FUSION_ERROR_CODE RetrieveBodies(ref Bodies bodies, ref BodyTrackingFusionRuntimeParameters rtparams, CameraIdentifier uuid)
{
//(Changed by VR) original method is commented, new is based on ZedCamera.RetrieveBodies
//return dllz_fusion_retrieve_bodies(ref bodies, ref rtparams, uuid);
IntPtr p = Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf<sl.Bodies>());
sl.FUSION_ERROR_CODE err = dllz_fusion_retrieve_bodies(p, ref rtparams, uuid);
if (p != IntPtr.Zero)
{
bodies = (sl.Bodies)Marshal.PtrToStructure(p, typeof(sl.Bodies));
Marshal.FreeHGlobal(p);
return err;
}
else
{
Marshal.FreeHGlobal(p);
return sl.FUSION_ERROR_CODE.FAILURE;
}
}
I still have a bad result using Fusion.ReadConfigurationFile method but I achieved a functional Multicamera body-tracking by parsing the ZED360 by myself to generate the required FusionConfiguration[ ].