[英]OpenCv: How to set a marker at a certain coordinate in a video stream open cv
I'm working with NITE/OPENNI and opencv in xcode 4 to work with the kinect. 我正在xcode 4中使用NITE / OPENNI和opencv与kinect一起使用。 I'm able to get the coordinates of the head for example this is done by :
我可以得到头部的坐标,例如,这是通过以下方式完成的:
In the main, outside the wile(true): 在主目录中,在wile(true)外部:
IplImage *rgbimg = cvCreateImageHeader(cvSize(640,480), 8, 3);
Then in the wile(true) 然后在鬼里(true)
XnSkeletonJointPosition Head;
g_UserGenerator.GetSkeletonCap().GetSkeletonJointPosition( aUsers[i], XN_SKEL_HEAD, Head);
printf("%d: (%f,%f,%f) [%f]\n", aUsers[i], Head.position.X, Head.position.Y, Head.position.Z, Head.fConfidence); }
I also have a video stream : 我也有一个视频流:
// Take current image
const XnRGB24Pixel* pImage = Xn_image.GetRGB24ImageMap();
//process image data
XnRGB24Pixel* ucpImage = const_cast<XnRGB24Pixel*> (pImage);
cvSetData(rgbimg,ucpImage, 640*3);
cvCvtColor(rgbimg,rgbimg,CV_RGB2BGR);
cvShowImage("RGB",rgbimg);
This is all done in the main in a while(true). 所有这一切都在一段时间内完成(true)。
Now my question is how can i set some kind of marker (eg: *,cross-hair, X ) at the position of the coordinates of the hand in the video stream ? 现在我的问题是我如何在视频流中手的坐标位置设置某种标记(例如:*,cross-hair,X)?
EDIT 编辑
i tried: 我试过了:
XnRGB24Pixel* ucpImage = const_cast<XnRGB24Pixel*> (pImage);
cvSetData(rgbimg,ucpImage, 640*3);
cvCvtColor(rgbimg,rgbimg,CV_RGB2BGR);
cvCircle(rgbimg, cvPoint(Head.position.X,Head.position.Y), 20, cvScalar(0,255,0), 1);
cvShowImage("RGB",rgbimg);
and i get : 我得到:
as you can see the circle stays in the top left corner for some reason. 如您所见,由于某种原因,圆圈停留在左上角。 Any ideas how to change this ?
任何想法如何改变这一点?
Try the display functions in OpenCV: 尝试使用OpenCV中的显示功能:
line(), circle(), drawPoly() and apply them to every frame in your video line(),circle(),drawPoly()并将它们应用于视频中的每一帧
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.