Pergunta

I'm working with NITE/OPENNI and opencv in xcode 4 to work with the kinect. I'm able to get the coordinates of the head for example this is done by :

In the main, outside the wile(true):

 IplImage *rgbimg = cvCreateImageHeader(cvSize(640,480), 8, 3);

Then in the wile(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).

Now my question is how can i set some kind of marker (e.g.: *,cross-hair, X ) at the position of the coordinates of the hand in the video stream ?

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 :

enter image description here

as you can see the circle stays in the top left corner for some reason. Any ideas how to change this ?

Foi útil?

Solução

Try the display functions in OpenCV:

line(), circle(), drawPoly() and apply them to every frame in your video

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top