FLIR One Developer / Blog / Topics / android, FLIR One, onFrameProcessed / When is onFrameProcessed called on Android?

When is onFrameProcessed called on Android?

Home Forums FLIR One developer community General discussion When is onFrameProcessed called on Android?

This topic contains 6 replies, has 4 voices, and was last updated by Profile photo of Redfern2 Redfern2 5 months, 1 week ago.

Viewing 7 posts - 1 through 7 (of 7 total)

  • Author

    Posts

  • #7541

    Profile photo of Charles
    Charles

    Participant

    I noticed that onFrameReceived was called about 10 times per second, predictably. But onFrameProcessed can be called many more times. Could I find out when it is called or what condition in my own code would trigger it to be called?

    #7542

    Profile photo of Allison
    Allison

    Moderator

    Hi Charles,

    onFrameProcessed is called whenever a frame is processed. Looking at the documentation for FrameProcessor may be helpful here.

    getProcessedFrames(Frame frame)
    processFrame(Frame frame)
    processFrame(Frame frame, FrameProcessor.QueuingOption queuingOption)

    Should all call onFrameProcessed.

    Queueing may affect the timing of when frames are processed and queueing options can result in a frame not being processed or being delayed. In which case, onFrameProcessed is not called or delayed. Queueing options are documented in the FrameProcessor.QueueingOption documentation.

    Hopefully, this clarifies the method. If you have more questions or I misunderstood the question please let me know and I will continue to assist you.

    Thank you,
    Allison Torchia

    #7544

    Profile photo of Charles
    Charles

    Participant

    Thanks, Allison. I was trying to estimate the frame rate based on onFrameProcessed. It seems the queuing option FrameProcessor.QueuingOption.CLEAR_QUEUED, called from onFrameReceived, doesn’t clear the queue immediately? When this flag is used, can we assume that the call would immediately empty the queue?

    #7547

    Profile photo of Allison
    Allison

    Moderator

    Hi Charles,

    It looks like the queue is cleared immediately if it’s size is greater than 1, however, if it only has 1 frame queued it will leave the frame in the queue and process it first.

    The thermal camera’s frame rate is a little under 9 Hz, if you’re processing thermal frames more often than that, I would suspect they are duplicate frames. If it’s significantly less often then there is probably code optimization that can be done for the app.

    Thank you,
    Allison Torchia

    #7674

    Profile photo of Amit
    Amit

    Participant

    Just to add to what Allison said.
    If your frameProcessor has multiple ImageTypes, then onFrameProcessed would be called for each frame and each ImageType. For example, if frameProcessor has 2 image types (visible and thermokelvin), then for each processFrame(frame, frameProcessor) call, onFrameProcessed (RenderedImage image) would be called twice. It will have thermokelvin image type in one call and visible image type in next one (order can differ though).

    #7679

    Profile photo of Charles
    Charles

    Participant

    Thanks, Amit. I knew that. My question is more related to the queued calls that do not get called evenly in time. I observed that sometimes we got multiple calls at once, causing the fps to shoot up higher.

    #8831

    Profile photo of Redfern2
    Redfern2

    Participant

    Your Blog is very nice.
    Wish to see much more like this. Thanks for sharing your information myprepaidcenter

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.