资源简介
Kinect2.0 人脸识别 及面部帧的获取,表情,骨架 Kinect2.0 人脸识别 及面部帧的获取,表情,骨架
代码片段和文件信息
#include “stdafx.h“
#include “included.h“
#include
#define PI_F 3.1415926f
static const WCHAR* FACE_TEXT = LR“face_text(面部旋转:
Picth: %03.03f
Yaw: %03.03f
Roll: %03.03f
面部属性:
表情高兴: %s
Engaged: %s
戴着眼镜: %s
左眼闭着: %s
右眼闭着: %s
张着嘴巴: %s
嘴巴在动: %s
看着一边: %s
)face_text“;
static const WCHAR* RRSULT_TEXT[] = {
L“未知“
L“确定不“
L“不确定“
L“确定“
};
// ImageRender类构造函数
ImageRenderer::ImageRenderer(){
ZeroMemory(face_data sizeof(face_data));
// 创建资源
m_hrInit = CreateDeviceIndependentResources();
// 创建缓冲区
m_pColorRGBX = new RGBQUAD[IMAGE_WIDTH*IMAGE_HEIGHT];
if (!m_pColorRGBX) m_hrInit = E_OUTOFMEMORY;
m_timer.Start();
}
// 创建设备无关资源
HRESULT ImageRenderer::CreateDeviceIndependentResources(){
HRESULT hr = S_OK;
// 创建 Direct2D 工厂.
hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED &m_pD2DFactory);
if (SUCCEEDED(hr))
{
// 创建 WIC 工厂.
hr = CoCreateInstance(
CLSID_WICImagingFactory
NULL
CLSCTX_INPROC_SERVER
IID_IWICImagingFactory
reinterpret_cast(&m_pWICFactory)
);
}
if (SUCCEEDED(hr))
{
// 创建 DirectWrite 工厂.
hr = DWriteCreateFactory(
DWRITE_FACTORY_TYPE_SHARED
__uuidof(m_pDWriteFactory)
reinterpret_cast(&m_pDWriteFactory)
);
}
if (SUCCEEDED(hr))
{
// 创建正文文本格式.
hr = m_pDWriteFactory->CreateTextFormat(
L“Microsoft YaHei“
nullptr
DWRITE_FONT_WEIGHT_NORMAL
DWRITE_FONT_style_NORMAL
DWRITE_FONT_STRETCH_NORMAL
45.f
L““ //locale
&m_pTextFormatMain
);
}
return hr;
}
// 从文件读取位图
HRESULT ImageRenderer::LoadBitmapFromFile(
ID2D1RenderTarget *pRenderTarget
IWICImagingFactory *pIWICFactory
PCWSTR uri
UINT destinationWidth
UINT destinationHeight
ID2D1Bitmap **ppBitmap
)
{
IWICBitmapDecoder *pDecoder = NULL;
IWICBitmapframeDecode *pSource = NULL;
IWICStream *pStream = NULL;
IWICFormatConverter *pConverter = NULL;
IWICBitmapScaler *pScaler = NULL;
HRESULT hr = pIWICFactory->CreateDecoderFromFilename(
uri
NULL
GENERIC_READ
WICDecodemetadataCacheonload
&pDecoder
);
if (SUCCEEDED(hr))
{
hr = pDecoder->Getframe(0 &pSource);
}
if (SUCCEEDED(hr))
{
hr = pIWICFactory->CreateFormatConverter(&pConverter);
}
if (SUCCEEDED(hr))
{
if (destinationWidth != 0 || destinationHeight != 0)
{
UINT originalWidth originalHeight;
hr = pSource->GetSize(&originalWidth &originalHeight);
if (SUCCEEDED(hr))
{
if (destinationWidth == 0)
{
FLOAT scalar = static_cast(destinationHeight) / static_cast(originalHeight);
destinationWidth = static_cast(scalar * static_cast(originalWidth));
}
else if (destinationHeight == 0)
{
FLOAT scalar = static_cast(destinationWidth) / static_cast(originalWidth);
destination
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..H. 33792 2017-10-25 19:46 KinectFace\.vs\KinectFace\v14\.suo
文件 1372144 2014-10-19 13:11 KinectFace\Debug\Kinect20.Face.dll
文件 83968 2017-10-25 17:50 KinectFace\Debug\KinectFace.exe
文件 605284 2017-10-25 17:50 KinectFace\Debug\KinectFace.ilk
文件 2805760 2017-10-25 17:50 KinectFace\Debug\KinectFace.pdb
文件 150826 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 55253 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 65394 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 126338 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 73 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 28092 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 206455 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 66 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 42847 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 35926 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 58835 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 293 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 10757400 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 8547122 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 5710456 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 2958150 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 2266594 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 2842376 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 1148180 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 2688160 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 2385776 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 2444006 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 2410214 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 2384 2014-10-19 12:42 KinectFace\Debug\NuiDataba
文件 2345 2014-10-19 12:42 KinectFace\Debug\NuiDataba
............此处省略84个文件信息
评论
共有 条评论