Skip to content

Change datatype of ZPD to fload/double #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Source/Drivers/PS1080/DDK/XnDepthStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class XnDepthStream : public XnPixelStream
inline OniDepthPixel GetDeviceMaxDepth() const { return (OniDepthPixel)m_DeviceMaxDepth.GetValue(); }
inline XnUInt32 GetParamCoefficient() const { return (XnUInt32)m_ParamCoefficient.GetValue(); }
inline XnUInt32 GetShiftScale() const { return (XnUInt32)m_ShiftScale.GetValue(); }
inline OniDepthPixel GetZeroPlaneDistance() const { return (OniDepthPixel)m_ZeroPlaneDistance.GetValue(); }
inline XnDouble GetZeroPlaneDistance() const { return m_ZeroPlaneDistance.GetValue(); }
inline XnDouble GetZeroPlanePixelSize() const { return m_ZeroPlanePixelSize.GetValue(); }
inline XnDouble GetEmitterDCmosDistance() const { return m_EmitterDCmosDistance.GetValue(); }
inline XnDouble GetDCmosRCmosDistance() const { return m_GetDCmosRCmosDistance.GetValue(); }
Expand All @@ -75,7 +75,7 @@ class XnDepthStream : public XnPixelStream
inline XnActualIntProperty& DeviceMaxDepthProperty() { return m_DeviceMaxDepth; }
inline XnActualIntProperty& ParamCoefficientProperty() { return m_ParamCoefficient; }
inline XnActualIntProperty& ShiftScaleProperty() { return m_ShiftScale; }
inline XnActualIntProperty& ZeroPlaneDistanceProperty() { return m_ZeroPlaneDistance; }
inline XnActualRealProperty& ZeroPlaneDistanceProperty() { return m_ZeroPlaneDistance; }
inline XnActualRealProperty& ZeroPlanePixelSizeProperty() { return m_ZeroPlanePixelSize; }
inline XnActualRealProperty& EmitterDCmosDistanceProperty() { return m_EmitterDCmosDistance; }
inline XnActualRealProperty& GetDCmosRCmosDistanceProperty() { return m_GetDCmosRCmosDistance; }
Expand Down Expand Up @@ -108,7 +108,7 @@ class XnDepthStream : public XnPixelStream
XnActualIntProperty m_DeviceMaxDepth;
XnActualIntProperty m_ParamCoefficient;
XnActualIntProperty m_ShiftScale;
XnActualIntProperty m_ZeroPlaneDistance;
XnActualRealProperty m_ZeroPlaneDistance;
XnActualRealProperty m_ZeroPlanePixelSize;
XnActualRealProperty m_EmitterDCmosDistance;
XnActualRealProperty m_GetDCmosRCmosDistance;
Expand Down
2 changes: 1 addition & 1 deletion Source/Drivers/PS1080/DDK/XnShiftToDepth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ XnStatus XnShiftToDepthUpdate(XnShiftToDepthTables* pShiftToDepth, const XnShift
XnDouble dMetric = 0;
XnDouble dDepth = 0;
XnDouble dPlanePixelSize = pConfig->fZeroPlanePixelSize;
XnDouble dPlaneDsr = pConfig->nZeroPlaneDistance;
XnDouble dPlaneDsr = pConfig->fZeroPlaneDistance;
XnDouble dPlaneDcl = pConfig->fEmitterDCmosDistance;
XnInt32 nConstShift = pConfig->nParamCoeff * pConfig->nConstShift;

Expand Down
2 changes: 1 addition & 1 deletion Source/Drivers/PS1080/DDK/XnShiftToDepth.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
typedef struct XnShiftToDepthConfig
{
/** The zero plane distance in depth units. */
OniDepthPixel nZeroPlaneDistance;
XnFloat fZeroPlaneDistance;
/** The zero plane pixel size */
XnFloat fZeroPlanePixelSize;
/** The distance between the emitter and the Depth Cmos */
Expand Down
6 changes: 3 additions & 3 deletions Source/Drivers/PS1080/DDK/XnShiftToDepthStreamHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ XnStatus XnShiftToDepthStreamHelper::InitShiftToDepth()
XN_STREAM_PROPERTY_PARAM_COEFF,
XN_STREAM_PROPERTY_SHIFT_SCALE,
XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE,
XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE,
XN_STREAM_PROPERTY_ZERO_PLANE_PIXEL_SIZE,
XN_STREAM_PROPERTY_EMITTER_DCMOS_DISTANCE,
XN_STREAM_PROPERTY_OUTPUT_FORMAT,
};
Expand Down Expand Up @@ -149,10 +149,10 @@ XnStatus XnShiftToDepthStreamHelper::GetShiftToDepthConfig(XnShiftToDepthConfig&
XnUInt64 nTemp;
XnDouble dTemp;

nRetVal = m_pModule->GetProperty(XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE, &nTemp);
nRetVal = m_pModule->GetProperty(XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE, &dTemp);
XN_IS_STATUS_OK(nRetVal);

Config.nZeroPlaneDistance = (XnUInt16)nTemp;
Config.fZeroPlaneDistance = (XnFloat)dTemp;

nRetVal = m_pModule->GetProperty(XN_STREAM_PROPERTY_ZERO_PLANE_PIXEL_SIZE, &dTemp);
XN_IS_STATUS_OK(nRetVal);
Expand Down
8 changes: 4 additions & 4 deletions Source/Drivers/PS1080/DriverImpl/XnOniDepthStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ void XnOniDepthStream::notifyAllProperties()
getProperty(XN_STREAM_PROPERTY_SHIFT_SCALE, &nValue, &size);
raisePropertyChanged(XN_STREAM_PROPERTY_SHIFT_SCALE, &nValue, size);

// zero plane distance
getProperty(XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE, &nValue, &size);
raisePropertyChanged(XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE, &nValue, size);

XnDouble dValue;
size = sizeof(dValue);

// zero plane distance
getProperty(XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE, &dValue, &size);
raisePropertyChanged(XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE, &dValue, size);

// zero plane pixel size
getProperty(XN_STREAM_PROPERTY_ZERO_PLANE_PIXEL_SIZE, &dValue, &size);
raisePropertyChanged(XN_STREAM_PROPERTY_ZERO_PLANE_PIXEL_SIZE, &dValue, size);
Expand Down
12 changes: 6 additions & 6 deletions Source/Drivers/PS1080/Sensor/XnSensorDepthStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ XnStatus XnSensorDepthStream::Init()
XN_IS_STATUS_OK(nRetVal);

XnDouble fZPPS = m_Helper.GetFixedParams()->GetZeroPlanePixelSize();
XnInt nZPD = m_Helper.GetFixedParams()->GetZeroPlaneDistance();
XnDouble fZPD = m_Helper.GetFixedParams()->GetZeroPlaneDistance();

nRetVal = m_HorizontalFOV.UnsafeUpdateValue(2*atan(fZPPS*XN_SXGA_X_RES/2/nZPD));
nRetVal = m_HorizontalFOV.UnsafeUpdateValue(2*atan(fZPPS*XN_SXGA_X_RES/2/fZPD));
XN_IS_STATUS_OK(nRetVal);

nRetVal = m_VerticalFOV.UnsafeUpdateValue(2*atan(fZPPS*XN_VGA_Y_RES*2/2/nZPD));
nRetVal = m_VerticalFOV.UnsafeUpdateValue(2*atan(fZPPS*XN_VGA_Y_RES*2/2/fZPD));
XN_IS_STATUS_OK(nRetVal);

// init helper
Expand Down Expand Up @@ -1065,15 +1065,15 @@ XnStatus XnSensorDepthStream::PopulateSensorCalibrationInfo()
XnDouble dPlanePixelSize;
GetProperty(XN_STREAM_PROPERTY_ZERO_PLANE_PIXEL_SIZE, &dPlanePixelSize);

XnUInt64 nPlaneDsr;
GetProperty(XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE, &nPlaneDsr);
XnDouble dPlaneDsr;
GetProperty(XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE, &dPlaneDsr);

XnDouble dDCRCDist;
GetProperty(XN_STREAM_PROPERTY_DCMOS_RCMOS_DISTANCE, &dDCRCDist);

m_calibrationInfo.magic = ONI_DEPTH_UTILS_CALIBRATION_INFO_MAGIC;
m_calibrationInfo.version = 1;
m_calibrationInfo.params1080.zpd = (int)nPlaneDsr;
m_calibrationInfo.params1080.zpd = dPlaneDsr;
m_calibrationInfo.params1080.zpps = dPlanePixelSize;
m_calibrationInfo.params1080.dcrcdist = dDCRCDist;

Expand Down
6 changes: 3 additions & 3 deletions Source/Drivers/PS1080/Sensor/XnSensorFixedParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ XnSensorFixedParams::XnSensorFixedParams(XnDevicePrivateData* pDevicePrivateData
m_nSensorDepthCMOSI2CSlaveAddress(0),
m_nSensorImageCMOSI2CBus(0),
m_nSensorImageCMOSI2CSlaveAddress(0),
m_nZeroPlaneDistance(0),
m_dZeroPlaneDistance(0),
m_dZeroPlanePixelSize(0),
m_dEmitterDCmosDistance(0),
m_dDCmosRCmosDistance(0),
Expand Down Expand Up @@ -80,7 +80,7 @@ XnStatus XnSensorFixedParams::Init()
xnLogVerbose(XN_MASK_DEVICE_SENSOR, "Sensor serial number: %s", m_strSensorSerial);

// fill in properties
m_nZeroPlaneDistance = (OniDepthPixel)FixedParams.fReferenceDistance;
m_dZeroPlaneDistance = FixedParams.fReferenceDistance;
m_dZeroPlanePixelSize = FixedParams.fReferencePixelSize;
m_dEmitterDCmosDistance = FixedParams.fDCmosEmitterDistance;
m_dDCmosRCmosDistance = FixedParams.fDCmosRCmosDistance;
Expand All @@ -101,4 +101,4 @@ XnStatus XnSensorFixedParams::Init()
XN_IS_STATUS_OK(nRetVal);

return (XN_STATUS_OK);
}
}
4 changes: 2 additions & 2 deletions Source/Drivers/PS1080/Sensor/XnSensorFixedParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class XnSensorFixedParams
inline XnUInt16 GetImageCmosI2CBus() const { return m_nSensorImageCMOSI2CBus; }
inline XnUInt16 GetImageCmosI2CSlaveAddress() const { return m_nSensorImageCMOSI2CSlaveAddress; }

inline OniDepthPixel GetZeroPlaneDistance() const { return m_nZeroPlaneDistance; }
inline XnDouble GetZeroPlaneDistance() const { return m_dZeroPlaneDistance; }
inline XnDouble GetZeroPlanePixelSize() const { return m_dZeroPlanePixelSize; }
inline XnDouble GetEmitterDCmosDistance() const { return m_dEmitterDCmosDistance; }
inline XnDouble GetDCmosRCmosDistance() const { return m_dDCmosRCmosDistance; }
Expand All @@ -71,7 +71,7 @@ class XnSensorFixedParams
XnUInt16 m_nSensorImageCMOSI2CBus;
XnUInt16 m_nSensorImageCMOSI2CSlaveAddress;

OniDepthPixel m_nZeroPlaneDistance;
XnDouble m_dZeroPlaneDistance;
XnDouble m_dZeroPlanePixelSize;
XnDouble m_dEmitterDCmosDistance;
XnDouble m_dDCmosRCmosDistance;
Expand Down
6 changes: 3 additions & 3 deletions Source/Drivers/PS1080/Sensor/XnSensorImageStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ XnStatus XnSensorImageStream::Init()
XN_IS_STATUS_OK(nRetVal);

XnDouble fZPPS = m_Helper.GetFixedParams()->GetZeroPlanePixelSize();
XnInt nZPD = m_Helper.GetFixedParams()->GetZeroPlaneDistance();
XnDouble dZPD = m_Helper.GetFixedParams()->GetZeroPlaneDistance();

nRetVal = m_HorizontalFOV.UnsafeUpdateValue(2*atan(fZPPS*XN_SXGA_X_RES/2/nZPD));
nRetVal = m_HorizontalFOV.UnsafeUpdateValue(2*atan(fZPPS*XN_SXGA_X_RES/2/dZPD));
XN_IS_STATUS_OK(nRetVal);

nRetVal = m_VerticalFOV.UnsafeUpdateValue(2*atan(fZPPS*XN_VGA_Y_RES*2/2/nZPD));
nRetVal = m_VerticalFOV.UnsafeUpdateValue(2*atan(fZPPS*XN_VGA_Y_RES*2/2/dZPD));
XN_IS_STATUS_OK(nRetVal);

// init helper
Expand Down