91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 14KB
    文件類型: .7z
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-05-06
  • 語言: 其他
  • 標(biāo)簽: C++??Kinect??

資源簡介

《Kinect for Windows SDK v2 0 開發(fā)筆記 九 面部幀獲取》所附帶資源

資源截圖

代碼片段和文件信息

#include?“stdafx.h“
#include?“included.h“
#include?


#define?PI_F???????3.1415926f

static?const?WCHAR*?FACE_TEXT?=?LR“face_text(面部旋轉(zhuǎn):
????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類構(gòu)造函數(shù)
ImageRenderer::ImageRenderer(){
????ZeroMemory(face_data?sizeof(face_data));
//?創(chuàng)建資源
m_hrInit?=?CreateDeviceIndependentResources();
????//?創(chuàng)建緩沖區(qū)
????m_pColorRGBX?=?new?RGBQUAD[IMAGE_WIDTH*IMAGE_HEIGHT];
????if?(!m_pColorRGBX)?m_hrInit?=?E_OUTOFMEMORY;
????m_timer.Start();
}


//?創(chuàng)建設(shè)備無關(guān)資源
HRESULT?ImageRenderer::CreateDeviceIndependentResources(){
HRESULT?hr?=?S_OK;

//?創(chuàng)建?Direct2D?工廠.
hr?=?D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED?&m_pD2DFactory);

if?(SUCCEEDED(hr))
{
//?創(chuàng)建?WIC?工廠.
hr?=?CoCreateInstance(
CLSID_WICImagingFactory
NULL
CLSCTX_INPROC_SERVER
IID_IWICImagingFactory
reinterpret_cast(&m_pWICFactory)
);
}

if?(SUCCEEDED(hr))
{
//?創(chuàng)建?DirectWrite?工廠.
hr?=?DWriteCreateFactory(
DWRITE_FACTORY_TYPE_SHARED
__uuidof(m_pDWriteFactory)
reinterpret_cast(&m_pDWriteFactory)
);
}

if?(SUCCEEDED(hr))
{
//?創(chuàng)建正文文本格式.
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

評論

共有 條評論