Class ARCoreVideoCaptureActivity
- java.lang.Object
-
- AppCompatActivity
-
- com.sfu_3dlg_hcvc.multiscan.a3dscannerapp.ARCoreVideoCaptureActivity
-
public class ARCoreVideoCaptureActivity extends AppCompatActivityARCore activity that let user record the rgb frames, depth frames and depth confidence maps using Google's ARCore
-
-
Field Summary
Fields Modifier and Type Field Description private BackgroundRendererbackgroundRenderer(package private) CameraFrameInfocameraFrameInfoprivate CameraInfocameraInfoprivate java.io.FilecameraInfoFileprivate java.lang.StringcurrentFolderPathprivate CustomFileWritercustomFileWriterprivate CustomStreamWriterManagercustomStreamWriterManagerprivate java.io.FiledepthConfidenceFileprivate java.lang.BooleandepthDataWrittenprivate java.io.FiledepthInfoFile(package private) java.nio.ByteBufferdepthRangeByteBufferprivate DepthTextureHandlerdepthTextureprivate DisplayRotationHelperdisplayRotationHelperprivate java.lang.StringfileName(package private) intframeCountprivate GLSurfaceViewglSurfaceViewprivate booleanisARCoreInstalledprivate java.lang.BooleanisDebugModeprivate booleanisDepthSupportedprivate booleanisRecordingprivate java.io.FilemAppFilesFolderprivate SnackbarHelpermessageSnackbarHelperprivate java.io.FilemetaDataFileprivate RecordingConfigrecordingConfigprivate Sessionsessionprivate booleanshowDepthMapprivate java.lang.StringTAGprivate TrackingStateHelpertrackingStateHelperprivate java.lang.StringvideoFileFullPath(package private) java.nio.ByteBufferwrapConfidenceData
-
Constructor Summary
Constructors Constructor Description ARCoreVideoCaptureActivity()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidARSessionStartRecord()private voidcheckIfARCoreInstalled()private voidcheckIsDebug()Check if the App is running in debug modeprivate voidcompressTempFiles()Compress depth and confidence filesprivate voidcreateAppFolder()Create the folder that will store all the data about the current scanprivate voidcreateARSession()private voidcreateFiles(java.lang.String fileName)Create all the files to store data such as depth data and confidence mapprivate java.lang.StringcreateVideoAndFileFolder()Create the video file for recordingprivate double[]getLastBestLocation()Get location datastatic IntentmakeIntentForMultiCameraCaptureActivity(Context context)private voidmatchFrames(int rgbFrame)protected voidonCreate(Bundle savedInstanceState)voidonDrawFrame(GL10 gl)Each time the frame gets updated, call certain methods (EX: record the scene data if the user press record)protected voidonPause()voidonRequestPermissionsResult(int requestCode, java.lang.String[] permissions, int[] results)protected voidonResume()voidonSurfaceChanged(GL10 gl, int width, int height)voidonSurfaceCreated(GL10 gl, EGLConfig config)voidonWindowFocusChanged(boolean hasFocus)private voidprePopulateSpinner(View view)Populate the spinner based the current phone's configprivate voidresumeARSession()private voidsetupARRecordingConfig()Setting up rgb video and set the recording resolutionprivate voidsetUpDepthMapSwitch()Setting up the switch button so the user can switch between rgb view and depth viewprivate voidsetUpRecordButton()private voidsetUpRenderer()private voidshowContentDescriptionDialog()Show a dialog and ask user to enter scene type and description of the sceneprivate voidshowRecordingConfigDialog()Display a config dialog to user and let user select rgb frame resolutionprivate voidupdateCameraInfo(Frame frame, Camera camera)Retrieve basic camera info such as image size and write them into the metadata fileprivate intupdateFrameCount()Retrieve number of frames for the videoprivate voidwriteDepthAndConfidenceInfo(Frame frame, Camera camera)Write depth and confidence map to localprivate voidwriteMetadataFile()Write metadata file to local storage
-
-
-
Field Detail
-
isRecording
private boolean isRecording
-
isDepthSupported
private boolean isDepthSupported
-
showDepthMap
private boolean showDepthMap
-
isARCoreInstalled
private boolean isARCoreInstalled
-
session
private Session session
-
cameraInfo
private CameraInfo cameraInfo
-
customFileWriter
private CustomFileWriter customFileWriter
-
customStreamWriterManager
private CustomStreamWriterManager customStreamWriterManager
-
glSurfaceView
private GLSurfaceView glSurfaceView
-
displayRotationHelper
private DisplayRotationHelper displayRotationHelper
-
recordingConfig
private RecordingConfig recordingConfig
-
messageSnackbarHelper
private final SnackbarHelper messageSnackbarHelper
-
trackingStateHelper
private final TrackingStateHelper trackingStateHelper
-
depthTexture
private final DepthTextureHandler depthTexture
-
backgroundRenderer
private final BackgroundRenderer backgroundRenderer
-
TAG
private final java.lang.String TAG
- See Also:
- Constant Field Values
-
mAppFilesFolder
private java.io.File mAppFilesFolder
-
videoFileFullPath
private java.lang.String videoFileFullPath
-
fileName
private java.lang.String fileName
-
currentFolderPath
private java.lang.String currentFolderPath
-
metaDataFile
private java.io.File metaDataFile
-
cameraInfoFile
private java.io.File cameraInfoFile
-
depthInfoFile
private java.io.File depthInfoFile
-
depthConfidenceFile
private java.io.File depthConfidenceFile
-
depthDataWritten
private java.lang.Boolean depthDataWritten
-
isDebugMode
private java.lang.Boolean isDebugMode
-
depthRangeByteBuffer
java.nio.ByteBuffer depthRangeByteBuffer
-
wrapConfidenceData
java.nio.ByteBuffer wrapConfidenceData
-
cameraFrameInfo
CameraFrameInfo cameraFrameInfo
-
frameCount
int frameCount
-
-
Method Detail
-
onCreate
protected void onCreate(Bundle savedInstanceState)
-
showRecordingConfigDialog
private void showRecordingConfigDialog()
Display a config dialog to user and let user select rgb frame resolution
-
prePopulateSpinner
private void prePopulateSpinner(View view)
Populate the spinner based the current phone's config- Parameters:
view- the spinner view
-
checkIfARCoreInstalled
private void checkIfARCoreInstalled()
-
createAppFolder
private void createAppFolder()
Create the folder that will store all the data about the current scan
-
setUpDepthMapSwitch
private void setUpDepthMapSwitch()
Setting up the switch button so the user can switch between rgb view and depth view
-
onResume
protected void onResume()
-
resumeARSession
private void resumeARSession()
-
createARSession
private void createARSession()
-
onPause
protected void onPause()
-
onWindowFocusChanged
public void onWindowFocusChanged(boolean hasFocus)
-
onRequestPermissionsResult
public void onRequestPermissionsResult(int requestCode, java.lang.String[] permissions, int[] results)
-
onSurfaceCreated
public void onSurfaceCreated(GL10 gl, EGLConfig config)
-
onSurfaceChanged
public void onSurfaceChanged(GL10 gl, int width, int height)
-
onDrawFrame
public void onDrawFrame(GL10 gl)
Each time the frame gets updated, call certain methods (EX: record the scene data if the user press record)- Parameters:
gl- openGLSurface
-
writeDepthAndConfidenceInfo
private void writeDepthAndConfidenceInfo(Frame frame, Camera camera)Write depth and confidence map to local- Parameters:
frame- the current framecamera- the current camera, used to retrieve camera intrinsics
-
updateCameraInfo
private void updateCameraInfo(Frame frame, Camera camera)Retrieve basic camera info such as image size and write them into the metadata file- Parameters:
frame- initial frame after user click the record buttoncamera- initial camera after user click the record button
-
getLastBestLocation
private double[] getLastBestLocation()
Get location data- Returns:
- GPS coords [Latitude, Longitude]
-
makeIntentForMultiCameraCaptureActivity
public static Intent makeIntentForMultiCameraCaptureActivity(Context context)
-
setUpRenderer
private void setUpRenderer()
-
setUpRecordButton
private void setUpRecordButton()
-
matchFrames
private void matchFrames(int rgbFrame)
-
compressTempFiles
private void compressTempFiles()
Compress depth and confidence files
-
updateFrameCount
private int updateFrameCount()
Retrieve number of frames for the video- Returns:
- number of frames
-
writeMetadataFile
private void writeMetadataFile()
Write metadata file to local storage
-
showContentDescriptionDialog
private void showContentDescriptionDialog()
Show a dialog and ask user to enter scene type and description of the scene
-
ARSessionStartRecord
private void ARSessionStartRecord()
-
checkIsDebug
private void checkIsDebug()
Check if the App is running in debug mode
-
setupARRecordingConfig
private void setupARRecordingConfig()
Setting up rgb video and set the recording resolution
-
createVideoAndFileFolder
private java.lang.String createVideoAndFileFolder()
Create the video file for recording- Returns:
- absolute path of the video file
-
createFiles
private void createFiles(java.lang.String fileName)
Create all the files to store data such as depth data and confidence map- Parameters:
fileName- filename prefix
-
-