Class ARCoreVideoCaptureActivity
- java.lang.Object
-
- AppCompatActivity
-
- com.sfu_3dlg_hcvc.multiscan.a3dscannerapp.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 Summary
Fields Modifier and Type Field Description private BackgroundRenderer
backgroundRenderer
(package private) CameraFrameInfo
cameraFrameInfo
private CameraInfo
cameraInfo
private java.io.File
cameraInfoFile
private java.lang.String
currentFolderPath
private CustomFileWriter
customFileWriter
private CustomStreamWriterManager
customStreamWriterManager
private java.io.File
depthConfidenceFile
private java.lang.Boolean
depthDataWritten
private java.io.File
depthInfoFile
(package private) java.nio.ByteBuffer
depthRangeByteBuffer
private DepthTextureHandler
depthTexture
private DisplayRotationHelper
displayRotationHelper
private java.lang.String
fileName
(package private) int
frameCount
private GLSurfaceView
glSurfaceView
private boolean
isARCoreInstalled
private java.lang.Boolean
isDebugMode
private boolean
isDepthSupported
private boolean
isRecording
private java.io.File
mAppFilesFolder
private SnackbarHelper
messageSnackbarHelper
private java.io.File
metaDataFile
private RecordingConfig
recordingConfig
private Session
session
private boolean
showDepthMap
private java.lang.String
TAG
private TrackingStateHelper
trackingStateHelper
private java.lang.String
videoFileFullPath
(package private) java.nio.ByteBuffer
wrapConfidenceData
-
Constructor Summary
Constructors Constructor Description ARCoreVideoCaptureActivity()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
ARSessionStartRecord()
private void
checkIfARCoreInstalled()
private void
checkIsDebug()
Check if the App is running in debug modeprivate void
compressTempFiles()
Compress depth and confidence filesprivate void
createAppFolder()
Create the folder that will store all the data about the current scanprivate void
createARSession()
private void
createFiles(java.lang.String fileName)
Create all the files to store data such as depth data and confidence mapprivate java.lang.String
createVideoAndFileFolder()
Create the video file for recordingprivate double[]
getLastBestLocation()
Get location datastatic Intent
makeIntentForMultiCameraCaptureActivity(Context context)
private void
matchFrames(int rgbFrame)
protected void
onCreate(Bundle savedInstanceState)
void
onDrawFrame(GL10 gl)
Each time the frame gets updated, call certain methods (EX: record the scene data if the user press record)protected void
onPause()
void
onRequestPermissionsResult(int requestCode, java.lang.String[] permissions, int[] results)
protected void
onResume()
void
onSurfaceChanged(GL10 gl, int width, int height)
void
onSurfaceCreated(GL10 gl, EGLConfig config)
void
onWindowFocusChanged(boolean hasFocus)
private void
prePopulateSpinner(View view)
Populate the spinner based the current phone's configprivate void
resumeARSession()
private void
setupARRecordingConfig()
Setting up rgb video and set the recording resolutionprivate void
setUpDepthMapSwitch()
Setting up the switch button so the user can switch between rgb view and depth viewprivate void
setUpRecordButton()
private void
setUpRenderer()
private void
showContentDescriptionDialog()
Show a dialog and ask user to enter scene type and description of the sceneprivate void
showRecordingConfigDialog()
Display a config dialog to user and let user select rgb frame resolutionprivate void
updateCameraInfo(Frame frame, Camera camera)
Retrieve basic camera info such as image size and write them into the metadata fileprivate int
updateFrameCount()
Retrieve number of frames for the videoprivate void
writeDepthAndConfidenceInfo(Frame frame, Camera camera)
Write depth and confidence map to localprivate void
writeMetadataFile()
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
-
-