资源简介
《Kinect for Windows SDK v2 0 开发笔记 二 彩色帧获取》附加资源
代码片段和文件信息
#include “stdafx.h“
#include “included.h“
#include
// ImageRender类构造函数
ImageRenderer::ImageRenderer(){
// 创建资源
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
60.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);
destinationHeight = static_cast(scalar * static_cast(originalHeight));
}
hr = pIWICFactory->CreateBitmapScaler(&pScaler);
if (SUCCEEDED(hr))
{
hr = pScaler->Initialize(
pSource
destinationWidth
destinationHeight
WICBitmapInterpolationModeCubic
);
}
if (SUCCEEDED(hr))
{
hr = pConverter->Initialize(
pScaler
GUID_WICPixel
- 上一篇:股票查询工具(含前端页面)
- 下一篇:KinectSDK2.0深度帧获取
相关资源
- KinectSDK2.0深度帧获取
- Labview 中kinect使用例程
- kinect控制PPT翻页
- KinectV2 opencv qt 实现平面测量
- ROS下同时存储Kinect 深度和RGB图 代码包
- kinect深度图像去噪
- Kinect程序,包括简单的图像处理
- Kinect+PCL Demo程序 点云处理和显示 VS
- kinect 2.0生成点云,并用PCL存储
- kinect官方技术文档英文
- 基于 ROS 与 Kinect 的移动机器人同时定
- 微软KinectFusion开源实现
- Kinect获取彩色图像并保存为jpg图片
- kinect 2.0获取深度和彩色帧并存为jpg图
- KinectFusion: Real-time 3D Reconstruction论文翻
- 最新Kinect v2 with MS-SDK 2.10.1 for Unity3D
- 已安装ROS-Kinectic的树莓派ubuntu16的im
- Kinect for unity sdk v2.9.unitypackage
- sensor-win64-5.1.2.1-redist.msi
- Kinect2.0开发文档
- Kinect获取深度图像
- Kinect for Windows SDK开发初体验一环境配
- 多线程获取kinect2.0 视频并保存身体点
- Kinect运用OpenNI产生点云
- Kinect获取深度图,鼠标点击获取该点
- Kinect 保存彩色图和深度图
- windows intel_sdk_for_opencl
- Kinect驱动,PC上驱动之一
- Kinect for windows需要的头文件
- Kinect for windows 破解 一,简单的体感超
评论
共有 条评论