This fragment of code was taken from OpenNI sample called NiUserTracker
//... some codes...
#define XN_CALIBRATION_FILE_NAME "UserCalibration.bin"
// Save calibration to file
void SaveCalibration()
{
XnUserID aUserIDs[20] = {0};
XnUInt16 nUsers = 20;
g_UserGenerator.GetUsers(aUserIDs, nUsers);
for (int i = 0; i < nUsers; ++i)
{
// Find a user who is already calibrated
if (g_UserGenerator.GetSkeletonCap().IsCalibrated(aUserIDs[i]))
{
// Save user's calibration to file
g_UserGenerator.GetSkeletonCap().SaveCalibrationDataToFile(aUserIDs[i], XN_CALIBRATION_FILE_NAME);
break;
}
}
}
//... some codes ...
//... some codes ...
void glutKeyboard (unsigned char key, int x, int y)
{
switch (key)
{
case 27:
CleanupExit();
//... some codes...
case 'S':
SaveCalibration();
break;
case 'L':
LoadCalibration();
break;
}
}
When I press Shift+s or S (with caps lock on), it does not generate the “UserCalibration.bin.” I searched my hard drive entirely, and no such file was found. Afterwards, I disable the “read-only” property from OpenNI folder.
The console, when I execute NiUserTracker.exe, does not report any error.
I am most happy with its on-line calibration, which takes a moment to calibrate, I thought this process can be made quicker by loading a user-calibrated file.
Could some point me in the right direction, why I am unable to generate this “UserCalibration.bin” file? I am using Win7 64 bit with 64 bit OpenNI, and Visual Studio 2010 Ultimate (provided by our University for research purpose).
Greatly appreciated.
Regards,
ikel
I just did a quick test with two different configurations:
It doesn’t look like a permission’s issue. I’ve modified the SaveCalibration function a bit:
I’ve got STATUS_OK on osx, but XN_STATUS_NOT_IMPLEMENTED (value 65550) on Windows. I’ve found an interesting post on the OpenNI group. I’m not 100% sure, but it sounds like
SaveCalibrationDataToFile might be deprecated in newer versions. This would sort of make sense since the psi(Ψ) pose is no longer required for calibration.
Try to revert to an older version. The OpenNI configuration I use on osx works (saves calibration file but this version also can track skeleton without requiring the psi(Ψ) pose).
HTH