Class ARCoreVideoCaptureActivity


  • public class ARCoreVideoCaptureActivity
    extends AppCompatActivity
    ARCore activity that let user record the rgb frames, depth frames and depth confidence maps using Google's ARCore
    • Field Detail

      • isRecording

        private boolean isRecording
      • isDepthSupported

        private boolean isDepthSupported
      • showDepthMap

        private boolean showDepthMap
      • isARCoreInstalled

        private boolean isARCoreInstalled
      • session

        private Session session
      • glSurfaceView

        private GLSurfaceView glSurfaceView
      • recordingConfig

        private RecordingConfig recordingConfig
      • messageSnackbarHelper

        private final SnackbarHelper messageSnackbarHelper
      • 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
      • frameCount

        int frameCount
    • Constructor Detail

      • ARCoreVideoCaptureActivity

        public ARCoreVideoCaptureActivity()
    • 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 frame
        camera - 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 button
        camera - 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