Skip to content

Commit

Permalink
Added support for high-res 1280x1024 IR and Image (at ~10 FPS)
Browse files Browse the repository at this point in the history
  • Loading branch information
avin2 committed Dec 12, 2010
1 parent d02b58c commit cc3dd7c
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 3 deletions.
Binary file modified Bin/SensorKinect-Win32-5.0.0.exe
Binary file not shown.
66 changes: 66 additions & 0 deletions OpenNI/Data/SamplesConfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<OpenNI>
<Licenses>
<!-- Add licenses here
<License vendor="vendor" key="key"/>
-->
</Licenses>
<Log writeToConsole="true" writeToFile="false">
<!-- 0 - Verbose, 1 - Info, 2 - Warning, 3 - Error (default) -->
<LogLevel value="3"/>
<Masks>
<Mask name="ALL" on="false"/>
</Masks>
<Dumps>
</Dumps>
</Log>
<ProductionNodes>
<!-- Normal Image -->
<Node type="Image" name="Image1">
<Configuration>
<MapOutputMode xRes="640" yRes="480" FPS="30"/>
<Mirror on="true"/>
</Configuration>
</Node>

<!-- HighRes Image -->
<!--
<Node type="Image" name="Image1">
<Configuration>
<MapOutputMode xRes="1280" yRes="1024" FPS="15"/>
<Mirror on="true"/>
</Configuration>
</Node>
-->

<!-- Normal IR -->
<!--
<Node type="IR" name="IR1">
<Configuration>
<MapOutputMode xRes="640" yRes="480" FPS="30"/>
<Mirror on="true"/>
</Configuration>
</Node>
-->

<!-- HighRes IR -->
<!--
<Node type="IR" name="IR1">
<Configuration>
<MapOutputMode xRes="1280" yRes="1024" FPS="15"/>
<Mirror on="true"/>
</Configuration>
</Node>
-->

<Node type="Depth" name="Depth1">
<Configuration>
<MapOutputMode xRes="640" yRes="480" FPS="30"/>
<Mirror on="true"/>
</Configuration>
</Node>
<!--
<Node type="Audio" name="Audio1">
</Node>
-->
</ProductionNodes>
</OpenNI>
5 changes: 5 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ Kinect Mod:
-----------

Changes:
v0.3:
1) Added support for high-res 1280x1024 IR and Image (at ~10 FPS)
Checkout the file OPENNI\Data\SamplesConfig.xml for usage example.
(Copy it to your OpenNI\Data dir and use NiViewer to test the different resolutions)

v0.2:
1) VS2010 redist will now be installed automatically.
2) The driver will now also be installed automatically on both x86 and x64 machines.
Expand Down
14 changes: 11 additions & 3 deletions Source/XnDeviceSensorV2/XnDeviceSensorIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@
//---------------------------------------------------------------------------
// Defines
//---------------------------------------------------------------------------
#define XN_SENSOR_VENDOR_ID 0x045E
#define XN_SENSOR_VENDOR_ID 0x1D27
#define XN_SENSOR_VENDOR_ID_KINECT 0x045E
#define XN_SENSOR_2_0_PRODUCT_ID 0x0200
#define XN_SENSOR_5_0_PRODUCT_ID 0x0500
#define XN_SENSOR_6_0_PRODUCT_ID 0x02AE
#define XN_SENSOR_6_0_PRODUCT_ID 0x0600
#define XN_SENSOR_KINECT_PRODUCT_ID 0x02AE

#if XN_PLATFORM == XN_PLATFORM_WIN32
#include <initguid.h>
Expand Down Expand Up @@ -102,7 +104,13 @@ XnStatus XnSensorIO::OpenDevice(const XnChar* strPath)
xnLogVerbose(XN_MASK_DEVICE_IO, "Can't find 5.0. Trying to open an older sensor...");
nRetVal = xnUSBOpenDevice(XN_SENSOR_VENDOR_ID, XN_SENSOR_2_0_PRODUCT_ID, USB_DEVICE_EXTRA_PARAM, (void*)strPath, &m_pSensorHandle->USBDevice);
}

if (nRetVal == XN_STATUS_USB_DEVICE_NOT_FOUND)
{
// if not found, try the kinect
xnLogVerbose(XN_MASK_DEVICE_IO, "Can't find 2.0 - 4.0. Trying to open a kinect sensor...");
nRetVal = xnUSBOpenDevice(XN_SENSOR_VENDOR_ID_KINECT, XN_SENSOR_KINECT_PRODUCT_ID, USB_DEVICE_EXTRA_PARAM, (void*)strPath, &m_pSensorHandle->USBDevice);
}

XN_IS_STATUS_OK(nRetVal);

nRetVal = xnUSBGetDeviceSpeed(m_pSensorHandle->USBDevice, &DevSpeed);
Expand Down
7 changes: 7 additions & 0 deletions Source/XnDeviceSensorV2/XnFirmwareStreams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,14 @@ XnStatus XnFirmwareStreams::CheckClaimStream(const XnChar* strType, XnResolution
XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Cannot set depth stream to resolution %d when IR is set to resolution %d!", nRes, pIRStreamData->nRes);
}

// Avin: Removed to enable 1280x1024 IR
/*
// check FPS
if (pIRStreamData->nFPS != nFPS)
{
XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Depth and IR streams must have the same FPS!");
}
*/
}
}
else if (strcmp(strType, XN_STREAM_TYPE_IR) == 0)
Expand Down Expand Up @@ -150,10 +153,14 @@ XnStatus XnFirmwareStreams::CheckClaimStream(const XnChar* strType, XnResolution
}

// check FPS
// Avin: Removed to enable 1280x1024 IR
/*
if (pDepthStreamData->nFPS != nFPS)
{
XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Depth and IR streams must have the same FPS!");
}
*/
}
}
else if (strcmp(strType, XN_STREAM_TYPE_IMAGE) == 0)
Expand Down
3 changes: 3 additions & 0 deletions Source/XnDeviceSensorV2/XnSensorFirmwareParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,13 @@ XnStatus XnSensorFirmwareParams::SetImageResolution(XnUInt64 nValue)
case XN_RESOLUTION_VGA:
break;
case XN_RESOLUTION_SXGA:
// Avin: Removed to enable 1280x1024 Image
/*
if (m_pInfo->nFWVer < XN_SENSOR_FW_VER_5_3)
{
XN_LOG_WARNING_RETURN(XN_STATUS_IO_INVALID_STREAM_IMAGE_RESOLUTION, XN_MASK_DEVICE_SENSOR, "Image resolution is not supported by this firmware!");
}
*/
break;
case XN_RESOLUTION_UXGA:
if (m_pInfo->nFWVer < XN_SENSOR_FW_VER_5_1)
Expand Down
3 changes: 3 additions & 0 deletions Source/XnDeviceSensorV2/XnSensorImageStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,14 @@ XnStatus XnSensorImageStream::ValidateMode()
XnOutputFormats nOutputFormat = GetOutputFormat();
XnResolutions nResolution = GetResolution();

// Avin: Removed to enable 1280x1024 Image
// check resolution
/*
if ((nResolution == XN_RESOLUTION_UXGA || nResolution == XN_RESOLUTION_SXGA) && nInputFormat != XN_IO_IMAGE_FORMAT_BAYER)
{
XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "UXGA resolution is only supported with BAYER input!");
}
*/

// check output format
if (nOutputFormat == XN_OUTPUT_FORMAT_GRAYSCALE8 && nInputFormat != XN_IO_IMAGE_FORMAT_BAYER)
Expand Down

0 comments on commit cc3dd7c

Please sign in to comment.