make depth camera mode selectable

This commit is contained in:
Chikashi Miyama 2019-12-12 15:38:57 +01:00
parent ab2be34eef
commit 5eca901d6e
6 changed files with 20 additions and 5 deletions

View file

@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: daa4216d09a83dc479a7ee221b2a5bf9, type: 3} m_Script: {fileID: 11500000, guid: daa4216d09a83dc479a7ee221b2a5bf9, type: 3}
m_Name: DeviceSetting m_Name: AzureSettings
m_EditorClassIdentifier: m_EditorClassIdentifier:
_autoExposure: 1 _autoExposure: 1
_exposure: 0.5 _exposure: 0.5
@ -24,3 +24,4 @@ MonoBehaviour:
_enableBlc: 0 _enableBlc: 0
_powerIs60Hz: 1 _powerIs60Hz: 1
_maxDepth: 1 _maxDepth: 1
_depthMode: 2

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f8122729f4736dd4ab99617ee19feec3 guid: c681badc1a8be8243af1e0c53d337b50
NativeFormatImporter: NativeFormatImporter:
externalObjects: {} externalObjects: {}
mainObjectFileID: 11400000 mainObjectFileID: 11400000

View file

@ -1,7 +1,9 @@
using UnityEngine; using UnityEngine;
using Microsoft.Azure.Kinect.Sensor;
namespace Akvfx namespace Akvfx
{ {
public sealed class DeviceSettings : ScriptableObject public sealed class DeviceSettings : ScriptableObject
{ {
#region Editable fields #region Editable fields
@ -22,6 +24,7 @@ namespace Akvfx
[SerializeField] bool _powerIs60Hz = true; [SerializeField] bool _powerIs60Hz = true;
[SerializeField, Range(0, 6.6f)] float _maxDepth = 1; [SerializeField, Range(0, 6.6f)] float _maxDepth = 1;
[SerializeField] DepthMode _depthMode = DepthMode.NFOV_Unbinned;
#endregion #endregion
@ -87,6 +90,11 @@ namespace Akvfx
set { _maxDepth = value; } set { _maxDepth = value; }
} }
public DepthMode depthMode{
get { return _depthMode; }
set { _depthMode = value; }
}
#endregion #endregion
#region Internal properties #region Internal properties

View file

@ -23,6 +23,7 @@ namespace Akvfx
SerializedProperty _powerIs60Hz; SerializedProperty _powerIs60Hz;
SerializedProperty _maxDepth; SerializedProperty _maxDepth;
SerializedProperty _depthMode;
static readonly ( static readonly (
GUIContent enableBlc, GUIContent enableBlc,
@ -50,6 +51,7 @@ namespace Akvfx
_powerIs60Hz = serializedObject.FindProperty("_powerIs60Hz"); _powerIs60Hz = serializedObject.FindProperty("_powerIs60Hz");
_maxDepth = serializedObject.FindProperty("_maxDepth"); _maxDepth = serializedObject.FindProperty("_maxDepth");
_depthMode = serializedObject.FindProperty("_depthMode");
} }
public override void OnInspectorGUI() public override void OnInspectorGUI()
@ -84,16 +86,17 @@ namespace Akvfx
EditorGUILayout.PropertyField(_powerIs60Hz, _labels.powerIs60Hz); EditorGUILayout.PropertyField(_powerIs60Hz, _labels.powerIs60Hz);
EditorGUILayout.PropertyField(_maxDepth); EditorGUILayout.PropertyField(_maxDepth);
EditorGUILayout.PropertyField(_depthMode);
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
} }
[MenuItem("Assets/Create/Akvfx/Device Settings")] [MenuItem("Assets/Create/SoundVision/Device Settings")]
public static void CreateDeviceSettings() public static void CreateDeviceSettings()
{ {
var asset = ScriptableObject.CreateInstance<DeviceSettings>(); var asset = ScriptableObject.CreateInstance<DeviceSettings>();
AssetDatabase.CreateAsset(asset, "Assets/Akvfx Settings.asset"); AssetDatabase.CreateAsset(asset, "Assets/AzureSettings.asset");
AssetDatabase.SaveAssets(); AssetDatabase.SaveAssets();
EditorUtility.FocusProjectWindow(); EditorUtility.FocusProjectWindow();

View file

@ -103,6 +103,7 @@ namespace Akvfx
device, ColorControlCommand.PowerlineFrequency, device, ColorControlCommand.PowerlineFrequency,
settings.PowerFreqDeviceValue, _powerFreq, forceApply settings.PowerFreqDeviceValue, _powerFreq, forceApply
); );
} }
#endregion #endregion

View file

@ -101,12 +101,14 @@ namespace Akvfx
// Open the default device. // Open the default device.
var device = Device.Open(); var device = Device.Open();
// Depth Mode
// Start capturing with custom settings. // Start capturing with custom settings.
device.StartCameras( device.StartCameras(
new DeviceConfiguration { new DeviceConfiguration {
ColorFormat = ImageFormat.ColorBGRA32, ColorFormat = ImageFormat.ColorBGRA32,
ColorResolution = ColorResolution.R1536p, // 2048 x 1536 (4:3) ColorResolution = ColorResolution.R1536p, // 2048 x 1536 (4:3)
DepthMode = DepthMode.NFOV_Unbinned, // 640x576 DepthMode = _settings.depthMode, // defautlt NFOV unbinned 640x576
SynchronizedImagesOnly = true SynchronizedImagesOnly = true
} }
); );