Orge integration into IVT

2010-07-03
2013-05-09
  • Hola,

    Am wondering how easy/diffucult it is to "add" c/c++ animation from existing libraries/applications such as ORGE and other OS c++ frameworks into IVT.  What would the steps be to add a simple animation into 1 of the demo apps that ship with IVT.

    Thanks.

     
  • Pedram Azad
    Pedram Azad
    2010-07-05

    Hi,

    do you mean OGRE (www.ogre3d.org)?

    I am not familiar OGRE or other animation libraries. However, integrating the output from such a library should not be too difficult. If it is OpenGL based, the following call should work for you to get access to the rendered image:

    CByteImage destinationImage(width, height, CByteImage::eRGB24);
    glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, destinationImage.pixels);
    

    But probably OGRE offers its own functions for accessing the rendered image. Converting an image representation to an IVT CByteImage is simple. If it is encoded in RGB24, simply call the CByteImage constructur with bHeaderOnly = true and assign the image memory pointer to CByteImage::pixels.

    Pedram

     
  • Pedram,

    Thank you for the prompt reply.

    Actually I have another question which I am really more interesting in implementing.

    I have played with your camera examples where basically you are drawing graphics on top of
    the video output.  What I would like to do is to display an AVI video (via streaming I take it),
    in a dynamically configurable area within the regular video window, much like what people do
    with chromakey appliations like the weather person on TV.

    I see that you can read an AVI file with IVT.  Is it then possible to "play" this .avi file within
    a user definable area on the screen to overlay on the "nornal" camera output.

    Thanks!
    -Bruce

     
  • oops…meant to say "normal" camera output.

     
  • Pedram Azad
    Pedram Azad
    2010-07-07

    Hi,

    I'm not sure, if I fully understan what you mean.

    You want to read an AVI file, display it in an window, and then overlay the live images from a connected camera on this displayed AVI? With transparency?

    What do you mean by "user definable area"? So it should not be a window?

    Pedram

     
  • Pedram,

    Go here and check out the "Multiple Markers" demo.  I want to replace the red box with avi video (from disk) and I take it read frame by frame (with your api).  The camera part would be what you see in the demo.  I hope this explains it more.

    Here is the link:  http://vimeo.com/8214397

    Thanks again,
    Bruce

     
  • Pedram,

    Can you tell me what I am doing wrong here?  I have saved an .avi file as an uncompressed file using a windows tools called virtualDub, but cannot seem to read this file as follows…

    void readVideo() {

    CByteImage *byteImage;
    CVideoReader vReader;

    const char *pFileName = "C:\\temp\\test2.avi";
    if (!vReader.OpenUncompressedAVI(pFileName)) {
    printf("avi read is FALSE");
    }

    int height = vReader.GetHeight();
    printf("height = %d",height);

    byteImage = vReader.ReadNextFrame();

    }
    --eof--

    When executed I always get "avi read is FALSE"
    Please advise,

    Thanks,
    Bruce

     
  • Pedram Azad
    Pedram Azad
    2010-07-08

    Hi Bruce,

    since you have the four corner points of your marker, you can simple do a 2D mapping of your video frames to the marker area. For this, you can use the function LinearAlgebra::DetermineHomography with the four measured corner points in the image frame as target points and the points (0, 0), (width - 1, 0), (width - 1, height - 1), (0, height - 1) as source points (or the other way round, I am not sure).

    Once you have the homography, you can call ImageProcessor::ApplyHomography to perform the mapping. But it will map the whole image. So you either have to adapt that function to your needs or fuse the camera image with the result image…

    Pedram

     
  • Pedram Azad
    Pedram Azad
    2010-07-08

    Hi Bruce,

    you are doing nothing wrong. The class CVideoReader is not a fully complete implementation for uncompressed AVIs. I used it several years ago and haven't touched the code since then. If you want, you can upload your test AVI-file somewhere, so that I can download. Then I could take a look at the problem…

    You can also use the class COpenCVCapture (requires OpenCV including highgui to be installed). With that class you can also open video files, works fine with AVIs from my experience.

    Pedram

     
  • Pedram,

    I tried to attache the avi file I was using to this address I found but the email bounced:

    Pedram Azad <pedram.azad@kit.edu>

    What is your correct email address so I can send you this avi.

    Thanks,
    Bruce

     
  • Pedram Azad
    Pedram Azad
    2010-07-13

    Hi Bruce,

    that is my correct e-mail address. Maybe the file was too big? If you could upload the file somewhere, that would be best.

    Pedram