本文整理汇总了C++中CFrame::GetPixel方法的典型用法代码示例。如果您正苦于以下问题:C++ CFrame::GetPixel方法的具体用法?C++ CFrame::GetPixel怎么用?C++ CFrame::GetPixel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFrame
的用法示例。
在下文中一共展示了CFrame::GetPixel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BufferCB
HRESULT CVideoProcessor::BufferCB(double SampleTime, BYTE *pBuffer, long BufferLen)
{
if (MEDIATYPE_Video == m_mt.majortype)
{
if (MEDIASUBTYPE_YUY2 == m_mt.subtype)
{
//[ Y0 U0 Y1 V0] [ Y2 U1 Y3 V1]
VIDEOINFOHEADER* pVIH=(VIDEOINFOHEADER*)m_mt.pbFormat;
CFrame* pF = new CFrame(
pVIH->bmiHeader.biWidth,
pVIH->bmiHeader.biHeight);
struct YUY2
{
unsigned char y0, u0, y1, v0;
};
//Remember: Macropixel Y0 U0 Y1 V0 = 2 image pixel
for (int j = 0; j < pVIH->bmiHeader.biHeight; j++)
{
YUY2* pRow = (YUY2*)(pBuffer + j*pVIH->bmiHeader.biWidth * 2);
for (int i = 0; i < pVIH->bmiHeader.biWidth / 2; i++)
{
CFrame::PIXEL pixel_1, pixel_2;
//YUY2 to RGB
YUY2* MacroPixel = &pRow[i];
int C = (int)MacroPixel->y0 - 15;
int D = (int)MacroPixel->u0 - 128;
int E = (int)MacroPixel->v0 - 128;
pixel_1.r = max(0,min(255,(298 * C + 409 * E + 128) / 256));
pixel_1.g = max(0, min(255,(298 * C - 100 * D - 208 * E + 128) / 256));
pixel_1.b = max(0, min(255, (298 * C + 516 * D + 128) / 256));
C = (int)MacroPixel->y1 -16;
pixel_2.r = max(0, min(255, (298 * C + 409 * E + 128) / 256));
pixel_2.g = max(0, min(255, (298 * C - 100 * D - 208 * E + 128) / 256));
pixel_2.b = max(0, min(255, (298 * C + 516 * D + 128) / 256));
pF->GetPixel(i * 2, j) = pixel_1;
pF->GetPixel((i * 2) + 1, j) = pixel_2;
/*LummaGray.r = LummaGray.g = LummaGray.b = pRow->y0;
pF->GetPixel(i * 2, j) = LummaGray;
LummaGray.r = LummaGray.g = LummaGray.b = pRow->y1;
pF->GetPixel((i * 2)+1, j) = LummaGray;*/
//pRow++;
}
}
Push(pF);
}
}
return S_OK;
}