1

Displaying metadata per frame

Hello:

  I looked at the metadata info sample script but have a little bit different need.  I'd like to be able to pull information from the meta data stored in the image itself and overlay that in RV.  From either an EXR or our proprietary format.  I'm looking to store our reticle information in the metadata itself rather than burn it into the image, that way we can turn it on/off as well.  Is this possible?  Thanks!

 

jake




BSS_newOverlay-1.0.rvpkg

11 条评论

  • 0
    Avatar
    Alan Trombla

     

    Hi Jake,

    RV displays all the EXR metadata (standard and user-defined) in the ImageInfoe HUD widget (from the Tools menu).  And that display can of course be turned on and off.  Does that meet your needs ?  If not, maybe you can explain a little more exactly what you're after.

    Cheers,

    Alan

  • 0
    Avatar
    Jake Richards

    Ah, so, I've gotten a little closer to what I was looking for.  Here is the code so far, but my problem now is that the text drawn on screen seems to flicker during playback.  It seems like it's drawing the text whenever other widgets are on screen (it disappears when the Stopped msg appears and the comes back when the Stopped msg fades away)  I'm sure I'm overlooking something...

    module: BSS_newOverlay {
    use gl;
    use glu;
    use rvtypes;
    use io;
    use commands;
    use extra_commands;
    use glyph;
    use system;

     


    class: BSS_newOverlayMode : MinorMode
    {
    method: render (void; Event event)
    {
    State state = data();

    let pinfo = state.pixelInfo;
    string iname = if (pinfo neq nil && !pinfo.empty())
    then pinfo.front().name
    else nil;
    if (iname eq nil) return;

    let attrs = sourceAttributes(iname);
    if (attrs eq nil) return;

    let drawText = "";

    for_each (a; attrs)
    {
    let (name, value) = a;
    if (name == "EXIF/Model") {

    drawText += name +":"+value;
    break;
    }

    }


    setupProjection(event.domain().x,event.domain().y);
    for_each (ri;sourcesRendered())
    {

    let geom = sourceGeometry(ri.name);

    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
    gltext.color(Color(0, 1, 0, 1));


    gltext.writeAt(100,100,drawText);
    glDisable(GL_BLEND);
    }
    }

    method: BSS_newOverlayMode (BSS_newOverlayMode;)
    {
    init("BSS_newOverlay-mode",nil, nil , nil);
    }



    }

    \: createMode (Mode;)
    {
    print("Creating overlay Mode\n");
    return BSS_newOverlayMode();
    }

    }

    Package attached above in original post.

  • 0
    Avatar
    Jake Richards

    Alan, I'm sorry for taking so long to reply, I must have missed the email.  But yes, the info tools is very similar to what I'm looking for.  Is there mu code for it I can look at?  What I'm hoping to do is extract a string from some EXIF data and then use RV to overlay it on top of the image.  That way we can turn on/off the reticle information at will (have a clean image but also be able to see shot information if we want to)  So, specifically, if I hit F9, RV will read the "EXIF/model" information from a jpeg and display it in the bottom left hand side of the image.  Thanks!

     

    Jake

  • 0
    Avatar
    Alan Trombla
    Hi Jake, sounds like you're almost there.  It sounds like you are using the latest release (3.12.16) in which case you just need to add this line:

        updatePixelInfo(nil);

    At the beginning of your render() method.

    Note that this will only work with 3.12.16 (and above), so if you're using some other version, please let me know and I'll dig deeper.

    Cheers,

    Alan

  • 0
    Avatar
    Jake Richards

    Aha!  That made the text stick around but for some strange reason, it gets resized when the "Play all frames" and "Stop" show up in the top left hand corner of RV.  Is that because of some openGL projection setup or scaling?  It feels like when those widgets are on screen, the scaling is different.  Thanks again!

  • 0
    Avatar
    Alan Trombla

    Hi Jake,

    I suspect that's just because you're not calling "gltext.size(20)" or whatever before you call "gltext.writeAt()", so you're just inheriting whatever text size was used last.

    Cheers,

    Alan

  • 0
    Avatar
    nik yotis

    Jake, there is no hotkey assigned in your script, so how can i test your package? it loads fine 

  • 0
    Avatar
  • 0
    Avatar
    Jake Richards

    Nik:

      For that package there isn't really a hotkey, it's on all the time.  If the imagery you are looking at has that field in it, it should be drawn on the screen.  But, if you do want to put a hotkey on it, the link you provided is the way to do it.

     

  • 0
    Avatar
    nik yotis

    thanks Jake: I am testing this with EXR files so i substitute
    if (name == "EXIF/Model") {
    ...
    }
    with 
    if (name == "EXR") {
    ...
    }

    not only info doesn't show up, but F2-F4 functionality is deactivated 

  • 0
    Avatar
    Jake Richards

    I'm not sure why it would disable F2 or F4, did you add a hotkey and over-ride them?  Are there any errors or warnings in the console?  You may need to test for a key in the EXR as I'm not sure if there is just an EXR attribute, something like:

     

    name == 'EXR/type'

    ..

    Did you also add the lines that Alan suggested above to the package? updatePixelInfo(nil);

     

请先登录再写评论。