Skip to content
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

Changed Color Image Mapping to be more accurate #48

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 7 additions & 7 deletions ICP/ICP.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,46 +29,46 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{973EE923-B423-4BCD-AA08-B03DA40CB51F}</ProjectGuid>
<RootNamespace>ICP</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
Expand Down
14 changes: 7 additions & 7 deletions LiveScanClient/KinectClient.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,32 +60,32 @@
<ProjectGuid>{9B550BBA-EAFB-4D12-8B1C-8FDA39361F52}</ProjectGuid>
<RootNamespace>KinectClient</RootNamespace>
<ProjectName>LiveScanClient</ProjectName>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down Expand Up @@ -193,12 +193,12 @@
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\Microsoft.Azure.Kinect.Sensor.1.2.0\build\native\Microsoft.Azure.Kinect.Sensor.targets" Condition="Exists('..\packages\Microsoft.Azure.Kinect.Sensor.1.2.0\build\native\Microsoft.Azure.Kinect.Sensor.targets')" />
<Import Project="..\packages\Microsoft.Azure.Kinect.Sensor.1.4.1\build\native\Microsoft.Azure.Kinect.Sensor.targets" Condition="Exists('..\packages\Microsoft.Azure.Kinect.Sensor.1.4.1\build\native\Microsoft.Azure.Kinect.Sensor.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Azure.Kinect.Sensor.1.2.0\build\native\Microsoft.Azure.Kinect.Sensor.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.Kinect.Sensor.1.2.0\build\native\Microsoft.Azure.Kinect.Sensor.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Azure.Kinect.Sensor.1.4.1\build\native\Microsoft.Azure.Kinect.Sensor.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.Kinect.Sensor.1.4.1\build\native\Microsoft.Azure.Kinect.Sensor.targets'))" />
</Target>
</Project>
2 changes: 1 addition & 1 deletion LiveScanClient/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Azure.Kinect.Sensor" version="1.2.0" targetFramework="native" />
<package id="Microsoft.Azure.Kinect.Sensor" version="1.4.1" targetFramework="native" />
</packages>
Binary file added bin/ICP.dll
Binary file not shown.
Binary file added bin/ICP.exp
Binary file not shown.
Binary file added bin/ICP.iobj
Binary file not shown.
Binary file added bin/ICP.ipdb
Binary file not shown.
Binary file added bin/ICP.lib
Binary file not shown.
Binary file added bin/LiveScanClient.exe
Binary file not shown.
Binary file added bin/LiveScanClient.iobj
Binary file not shown.
Binary file added bin/LiveScanClient.ipdb
Binary file not shown.
Binary file added bin/LiveScanClientD.exe
Binary file not shown.
Binary file added bin/LiveScanPlayer.exe
Binary file not shown.
6 changes: 6 additions & 0 deletions bin/LiveScanPlayer.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
ChristopherRemde marked this conversation as resolved.
Show resolved Hide resolved
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
Binary file added bin/LiveScanServer.exe
Binary file not shown.
6 changes: 6 additions & 0 deletions bin/LiveScanServer.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
Binary file added bin/depthengine_2_0.dll
Binary file not shown.
Binary file added bin/k4a.dll
Binary file not shown.
Binary file added bin/k4arecord.dll
Binary file not shown.
Binary file added bin/settings.bin
Binary file not shown.
16 changes: 14 additions & 2 deletions include/LiveScanClient/azureKinectCapture.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
#include "stdafx.h"
#include "ICapture.h"
#include <k4a/k4a.h>
#include <opencv2/opencv.hpp>
#include "utils.h"
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>

class AzureKinectCapture : public ICapture
{
Expand All @@ -17,16 +20,25 @@ class AzureKinectCapture : public ICapture
void MapColorFrameToCameraSpace(Point3f *pCameraSpacePoints);
void MapDepthFrameToColorSpace(UINT16 *pDepthInColorSpace);
void MapColorFrameToDepthSpace(RGB *pColorInDepthSpace);
k4a_image_t Downscale_image_2x2_binning(const k4a_image_t color_image);

private:
k4a_device_t kinectSensor = NULL;
int32_t captureTimeoutMs = 1000;

k4a_image_t colorImage = NULL;
k4a_image_t depthImage = NULL;
k4a_image_t depthPointCloudImage = NULL;
k4a_image_t pointCloudImage = NULL;
k4a_image_t transformed_depth_image = NULL;
ChristopherRemde marked this conversation as resolved.
Show resolved Hide resolved
k4a_image_t colorImageInDepth = NULL;
k4a_image_t depthImageInColor = NULL;
k4a_image_t color_image_downscaled = NULL;
int color_image_downscaled_width;
int color_image_downscaled_height;
k4a_transformation_t transformation = NULL;

k4a_transformation_t transformation_color_downscaled = NULL;
k4a_image_t opencv_to_k4a_image(const cv::Mat cImg);
cv::Mat color_to_opencv(const k4a_image_t im);
void UpdateDepthPointCloud();
void UpdateDepthPointCloudForColorFrame();
};
2 changes: 1 addition & 1 deletion include/LiveScanClient/liveScanClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class LiveScanClient
DWORD m_nFramesSinceUpdate;

Point3f* m_pCameraSpaceCoordinates;
RGB* m_pColorInDepthSpace;
RGB* m_pColorInColorSpace;
UINT16* m_pDepthInColorSpace;

// Direct2D
Expand Down
10 changes: 10 additions & 0 deletions include/LiveScanClient/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,26 @@ typedef struct Point3f
this->X = 0;
this->Y = 0;
this->Z = 0;
this->Invalid = false;
}
Point3f(float X, float Y, float Z, bool invalid)
{
this->X = X;
this->Y = Y;
this->Z = Z;
this->Invalid = invalid;
}
Point3f(float X, float Y, float Z)
{
this->X = X;
this->Y = Y;
this->Z = Z;
this->Invalid = false;
}
float X;
float Y;
float Z;
bool Invalid = false;
} Point3f;

typedef struct Point3s
Expand Down
Loading