Class PreviewFrameStore
- java.lang.Object
-
- com.yoti.mobile.android.documentscan.core.data.PreviewFrameStore
-
public class PreviewFrameStore extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description PreviewFrameStore(int wantedNbOfFrames)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearExistingFrames()com.yoti.mobile.android.commons.image.DirectBuffergetLastValidFrame()Returns the last frame passed tosetValidFrame(com.yoti.mobile.android.commons.image.ImageBuffer)orsetLastFrameAsValid(), or null if no valid picture is available.com.yoti.mobile.android.commons.image.DirectBuffer[]getSampledFrameImages()Returns frame data previously captured with with #prepareForPreviewSampling.booleanisFrameBufferFull()booleanisLastFrameCaptured()booleanonSampleFrame(com.yoti.mobile.android.commons.image.ImageBuffer frame)Call every time a preview frame is generated while sampling.voidprepareForPreviewSampling(long interval)Call to enable sampling mode; will clear any data from previous sampling and start collecting frames immediately.voidremoveLastValidFrame()voidreset(int wantedNbOfFrames)voidsetLastFrameAsValid()Alternative tosetValidFrame(com.yoti.mobile.android.commons.image.ImageBuffer)to update the valid frame from data previously set as the last frame.voidsetValidFrame(com.yoti.mobile.android.commons.image.ImageBuffer frame)Used when a frame has passed all checks and should be returned from #getLastValidFrame.voidupdateLastFrame(com.yoti.mobile.android.commons.image.ImageBuffer frame)Should be called every frame to copy the data to local storage.
-
-
-
Method Detail
-
reset
public void reset(int wantedNbOfFrames)
-
clearExistingFrames
public void clearExistingFrames()
-
prepareForPreviewSampling
public void prepareForPreviewSampling(long interval)
Call to enable sampling mode; will clear any data from previous sampling and start collecting frames immediately. Caller is responsible for allocating camera buffers to support the requested number of samples- Parameters:
interval- time between samples
-
onSampleFrame
public boolean onSampleFrame(com.yoti.mobile.android.commons.image.ImageBuffer frame)
Call every time a preview frame is generated while sampling. Must callprepareForPreviewSampling(long)first.- Parameters:
frame- preview image from camera
-
getLastValidFrame
@Nullable public com.yoti.mobile.android.commons.image.DirectBuffer getLastValidFrame()
Returns the last frame passed tosetValidFrame(com.yoti.mobile.android.commons.image.ImageBuffer)orsetLastFrameAsValid(), or null if no valid picture is available.- Returns:
- last image in NV21 format
-
removeLastValidFrame
public void removeLastValidFrame()
-
getSampledFrameImages
@NonNull public com.yoti.mobile.android.commons.image.DirectBuffer[] getSampledFrameImages()
Returns frame data previously captured with with #prepareForPreviewSampling. Should only be called when the buffer is full (#onPreviewFrame returns false) to avoid nulls in the output- Returns:
- Array of JPEG compressed frames,
-
setValidFrame
public void setValidFrame(com.yoti.mobile.android.commons.image.ImageBuffer frame)
Used when a frame has passed all checks and should be returned from #getLastValidFrame.- Parameters:
frame- New valid frame
-
updateLastFrame
public void updateLastFrame(com.yoti.mobile.android.commons.image.ImageBuffer frame)
Should be called every frame to copy the data to local storage. This data will only be used for later calls tosetLastFrameAsValid().
-
setLastFrameAsValid
public void setLastFrameAsValid()
Alternative tosetValidFrame(com.yoti.mobile.android.commons.image.ImageBuffer)to update the valid frame from data previously set as the last frame.- See Also:
updateLastFrame(ImageBuffer)
-
isLastFrameCaptured
public boolean isLastFrameCaptured()
-
isFrameBufferFull
public boolean isFrameBufferFull()
-
-