本文整理汇总了C++中IFrameDescription::get_BytesPerPixel方法的典型用法代码示例。如果您正苦于以下问题:C++ IFrameDescription::get_BytesPerPixel方法的具体用法?C++ IFrameDescription::get_BytesPerPixel怎么用?C++ IFrameDescription::get_BytesPerPixel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFrameDescription
的用法示例。
在下文中一共展示了IFrameDescription::get_BytesPerPixel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void KinectManager::Update(void)
{
if (!m_pColorFrameReader)
{
return;
}
IColorFrame* pColorFrame = NULL;
HRESULT hr = m_pColorFrameReader->AcquireLatestFrame(&pColorFrame);
if (SUCCEEDED(hr))
{
INT64 nTime = 0;
IFrameDescription* pFrameDescription = NULL;
int nWidth = 0;
int nHeight = 0;
ColorImageFormat imageFormat = ColorImageFormat_None;
hr = pColorFrame->get_RelativeTime(&nTime);
if (SUCCEEDED(hr))
{
hr = pColorFrame->get_FrameDescription(&pFrameDescription);
}
if (SUCCEEDED(hr))
{
hr = pFrameDescription->get_Width(&nWidth);
}
if (SUCCEEDED(hr))
{
hr = pFrameDescription->get_Height(&nHeight);
}
if (SUCCEEDED(hr))
{
hr = pFrameDescription->get_BytesPerPixel(&color_frame_bytes_per_pixel);
}
if (SUCCEEDED(hr))
{
hr = pFrameDescription->get_LengthInPixels(&color_frame_length_in_pixels);
}
if (SUCCEEDED(hr))
{
hr = pColorFrame->get_RawColorImageFormat(&imageFormat);
}
if (SUCCEEDED(hr))
{
if (imageFormat == ColorImageFormat_Rgba)
{
UINT nBufferSize = KINECT_STREAM_COLOR_WIDTH * KINECT_STREAM_COLOR_HEIGHT * color_frame_bytes_per_pixel;
hr = pColorFrame->AccessRawUnderlyingBuffer(&nBufferSize, reinterpret_cast<BYTE**>(&m_pColorRGBX));
}
else if (m_pColorRGBX)
{
IFrameDescription* pRGBFrameDescription = NULL;
pColorFrame->CreateFrameDescription(ColorImageFormat_Rgba, &pRGBFrameDescription);
unsigned int clpp = 0;
pRGBFrameDescription->get_BytesPerPixel(&clpp);
unsigned int clip = 0;
pRGBFrameDescription->get_LengthInPixels(&clip);
color_frame_bytes_per_pixel = clpp;
color_frame_length_in_pixels = clip;
UINT nBufferSize = clip * clpp;
hr = pColorFrame->CopyConvertedFrameDataToArray(nBufferSize, (reinterpret_cast<BYTE*>(&m_pColorRGBX)), ColorImageFormat_Rgba);
}
else
{
hr = E_FAIL;
}
}
SafeRelease(pFrameDescription);
}
SafeRelease(pColorFrame);
}