本文整理汇总了C++中ImageGenerator::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageGenerator::IsValid方法的具体用法?C++ ImageGenerator::IsValid怎么用?C++ ImageGenerator::IsValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageGenerator
的用法示例。
在下文中一共展示了ImageGenerator::IsValid方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readFrame
void readFrame()
{
if (!g_Depth.IsValid() && !g_Image.IsValid() && !g_IR.IsValid() && !g_Audio.IsValid()) // @@@dded
return;
XnStatus rc = XN_STATUS_OK;
if (g_pPrimary != NULL)
{
rc = g_Context.WaitOneUpdateAll(*g_pPrimary);
}
else
{
rc = g_Context.WaitAnyUpdateAll();
}
if (rc != XN_STATUS_OK)
{
printf("Error: %s\n", xnGetStatusString(rc));
}
if (g_Depth.IsValid())
{
g_Depth.GetMetaData(g_DepthMD);
}
if (g_Image.IsValid())
{
g_Image.GetMetaData(g_ImageMD);
}
if (g_IR.IsValid())
{
g_IR.GetMetaData(g_irMD);
}
if (g_Audio.IsValid())
{
g_Audio.GetMetaData(g_AudioMD);
}
}
示例2: seekFrame
void seekFrame(int nDiff)
{
XnStatus nRetVal = XN_STATUS_OK;
if (isPlayerOn())
{
const XnChar* strNodeName = NULL;
if (g_pPrimary != NULL)
{
strNodeName = g_pPrimary->GetName();
}
else if (g_Depth.IsValid())
{
strNodeName = g_Depth.GetName();
}
else if (g_Image.IsValid())
{
strNodeName = g_Image.GetName();
}
else if (g_IR.IsValid())
{
strNodeName = g_IR.GetName();
}
else if (g_Audio.IsValid())
{
strNodeName = g_Audio.GetName();
}
nRetVal = g_Player.SeekToFrame(strNodeName, nDiff, XN_PLAYER_SEEK_CUR);
if (nRetVal != XN_STATUS_OK)
{
displayMessage("Failed to seek: %s", xnGetStatusString(nRetVal));
return;
}
XnUInt32 nFrame = 0;
XnUInt32 nNumFrames = 0;
nRetVal = g_Player.TellFrame(strNodeName, nFrame);
if (nRetVal != XN_STATUS_OK)
{
displayMessage("Failed to tell frame: %s", xnGetStatusString(nRetVal));
return;
}
nRetVal = g_Player.GetNumFrames(strNodeName, nNumFrames);
if (nRetVal != XN_STATUS_OK)
{
displayMessage("Failed to get number of frames: %s", xnGetStatusString(nRetVal));
return;
}
displayMessage("Seeked %s to frame %u/%u", strNodeName, nFrame, nNumFrames);
}
}
示例3: GetColorAndDepthImages
// Gets the colour and depth data from the Kinect sensor.
bool GetColorAndDepthImages(ColorImage& colorImage, DepthImage& depthImage)
{
XnStatus rc = XN_STATUS_OK;
// Read a new frame, blocking operation
rc = deviceContext.WaitAnyUpdateAll();
if (rc != XN_STATUS_OK)
{
/*LOGE("Read failed: %s\n", xnGetStatusString(rc));*/
throw rc;
}
// Get handles to new data
static ImageMetaData colorImageMetaData;
static DepthMetaData depthImageMetaData;
colorImageGenerator.GetMetaData(colorImageMetaData);
depthImageGenerator.GetMetaData(depthImageMetaData);
// Validate images
if (!depthImageGenerator.IsValid() || !colorImageGenerator.IsValid())
{
/*LOGE("Error: Color or depth image is invalid.");*/
throw 1;
}
if (colorImageMetaData.Timestamp() <= mostRecentRGB)
return false;
// Fetch pointers to data
const XnRGB24Pixel* pColorImage = colorImageMetaData.RGB24Data(); //g_depth.GetRGB24ImageMap()
const XnDepthPixel* pDepthImage = depthImageMetaData.Data();// g_depth.GetDepthMap();
// Copy data over to arrays
memcpy(colorImage.data, pColorImage, sizeof(colorImage.data));
memcpy(depthImage.data, pDepthImage, sizeof(depthImage.data));
colorImage.rows = colorImage.maxRows;
colorImage.cols = colorImage.maxCols;
depthImage.rows = depthImage.maxRows;
depthImage.cols = depthImage.maxCols;
mostRecentRGB = colorImageMetaData.Timestamp();
return true;
}
示例4: changeRegistration
void changeRegistration(int nValue)
{
if (!g_Depth.IsValid() || !g_Depth.IsCapabilitySupported(XN_CAPABILITY_ALTERNATIVE_VIEW_POINT))
{
return;
}
if (!nValue)
{
g_Depth.GetAlternativeViewPointCap().ResetViewPoint();
}
else if (g_Image.IsValid())
{
g_Depth.GetAlternativeViewPointCap().SetViewPoint(g_Image);
}
}
示例5: getImageCoordinatesForDepthPixel
bool getImageCoordinatesForDepthPixel(int x, int y, int& imageX, int& imageY)
{
if (!g_Depth.IsValid())
return false; // no depth
if (!g_Image.IsValid())
return false; // no image
if (!g_Depth.IsCapabilitySupported(XN_CAPABILITY_ALTERNATIVE_VIEW_POINT))
return false;
XnUInt32 altX;
XnUInt32 altY;
if (XN_STATUS_OK != g_Depth.GetAlternativeViewPointCap().GetPixelCoordinatesInViewPoint(g_Image, x, y, altX, altY))
return false;
imageX = (int)altX;
imageY = (int)altY;
return true;
}
示例6: getImageMetaData
const ImageMetaData* getImageMetaData()
{
return g_Image.IsValid() ? &g_ImageMD : NULL;
}
示例7: getImageGenerator
ImageGenerator* getImageGenerator()
{
return g_Image.IsValid() ? &g_Image : NULL;
}