Search code examples
flashwebcamaugmented-reality

Augmented reality to detect hand heart with webcam


Is it possible?

I'm studying and I'd like tips and links to tutorials that can help me.

Augmented Reality

Thanks!


Solution

  • I just made a similar program using haarcascades with opencv. I'm sure it could easily tied into ARToolKit. Check out my tutorial. http://danielscvtutorials.blogspot.com/p/impress-that-special-someone-with.html

    I was able to tie ARToolKit to OpenCv with this code. For some reason ARToolKit wanted to use ARGB instead of BGR or RGBA.

    ARUint8 rgbTmp[3];
    for(int y=0; y < image_opencv->height; y++) {
        for(int x=0; x < image_opencv->width; x++) {
            rgbTmp[0] = image_opencv->imageData[image_opencv->widthStep * y + x*3]; // B
            rgbTmp[1] = image_opencv->imageData[image_opencv->widthStep * y + x*3 + 1]; // G
            rgbTmp[2] = image_opencv->imageData[image_opencv->widthStep * y + x*3 + 2]; // R
            frame->imageData[frame->widthStep * y + x*4] = 255; // A
            frame->imageData[frame->widthStep * y + x*4 + 1] = rgbTmp[2]; // R
            frame->imageData[frame->widthStep * y + x*4 + 2] = rgbTmp[1]; // G
            frame->imageData[frame->widthStep * y + x*4 + 3] = rgbTmp[0]; // B
        }
    }
    ARUint8 *arImage = (ARUint8 *)frame->imageData; // This is very fast conversion