FOVE SUPPORT CENTER

How to use the class IFVRHeadsetResearch

Featured

Comments

6 comments

  • Official comment
    Avatar
    Jeff

    Hi Shaw0fr.

    You can `static_cast` the IFVRHeadset pointer returned by GetFVRHeadset() to the IFVRHeadsetResearch type, then invoke the functions at will.

    The struct returned contains a pointer to BGR data in bitmap format (including a 54 byte header). Note that the size in the header can (but may not be) be negative to distinguish a top-down vs bottom-up bitmap image.

    That said, you're using the 0.13.0 version of these headers which have some problems. We recently released 0.14.0 Runtime/SDK, but the research headers are not included by default. I will post those headers and an example as soon as possible and update this thread when they're up.

  • Avatar
    Jeff

    The 0.14.0 research headers are available at https://github.com/FoveHMD/FoveCppSample/tree/master/FOVE%20SDK%200.14.0/include

    Research headers should always be run against the same version of the runtime (backcompat is not provided). So run it against 0.14.X from our website.

    Per my above response, you can static_cast, and use the IFVRHeadsetResearch object. Make sure to register for the given research capability (eg. eye image) before using the image functions.

  • Avatar
    Shaw0fr

    Hi Jeff.

    Thank you. Your comments did help me a lot. But I still have no idea how to use the SFVR_BitmapImage. Could I just write it in a binary file directly and save it as BMP file? Hope you can post an example.

  • Avatar
    Sidney Leal

    Hi,

    Today I managed to save my eyes bitmaps with the 0.15 sdk. I'm still learning C++, and pained a little bit to have a working code (I used the DataExample.cpp as base and followed the tips above from Jeff):

    ...

    const unique_ptr<Fove::IFVRHeadsetResearch> research{ static_cast<Fove::IFVRHeadsetResearch*>(Fove::GetFVRHeadset()) };

    CheckError(research->RegisterResearchCapabilities(Fove::EFVR_ResearchCapabilities::EyeImage), "Init");

    Fove::SFVR_BitmapImage eyeImg;
    const Fove::EFVR_ErrorCode error = research->GetEyeImageData(&eyeImg);
    std::ofstream imgfile;

    switch (error) {

    case Fove::EFVR_ErrorCode::None:
    imgfile.open("e:/fove/temp/" + std::to_string(eyeImg.timestamp) + ".bmp", std::ios_base::app | ios::binary | ios::out);
    imgfile.write((char*)eyeImg.image.data, eyeImg.image.length);
    imgfile.close();
    break;

    default:
    cerr << "Error #" << EnumToUnderlyingValue(error) << endl;
    break;
    }

    ....

     

  • Avatar
    Jeff

    Yep, the image data returned in SFVR_BitmapData, since it contains the standard bitmap header, is totally valid to just write to a .BMP file.

    Thanks Sidney for posting your code!

    I do hope to get more bindings out eventually for other languages, so learning C++ isn't a requirement, but in the meantime it helps when people share code bits :)

     

  • Avatar
    Shaw0fr

    Thank you, Sidney.

    Actually, I used screenshot instead. But I tried your code and it perfectly solved the problem. It's great.

Please sign in to leave a comment.