javaopenimaj

How to perform video analysis with OpenIMAJ without actually showing the video


I'm trying to analyse a couple of videos with OpenIMAJ, and it's working great. Showing the video for debugging and now I'm done with that. I just want to analyse the video and extract some metrics.I don't want people who run my program to see their videos either.

However the frame analysis algorithm deeply uses the current frame displayed and previous frame displayed. Is there a way I can just read the frames of the video without actually displaying them?


Solution

  • I guess you're using the VideoDisplay class to display the video at present? If so, you can just swap your call to the createVideoDisplay method with createOffscreenVideoDisplay to do what you want.

    An alternative method is to re-write your code slightly and just iterate through the frames in the video:

    MBFImage currentFrame, prevFrame = video.getNextFrame();
    for (currentFrame : video) {
        //do something with the frames
    
        //prepare for the next iteration
        prevFrame = currentFrame;
    }