// Use this for initialization void Start() { /* Create SenseManager Instance */ sm = SenseManager.CreateInstance(); sm.CaptureManager.Realtime = false; // Selecting a higher resolution profile StreamProfileSet profiles = new StreamProfileSet(); profiles.color.imageInfo.width = 1280; profiles.color.imageInfo.height = 720; RangeF32 f_rate = new RangeF32(30, 30); profiles.color.frameRate = f_rate; profiles.depth.imageInfo.width = 640; profiles.depth.imageInfo.height = 480; RangeF32 f_drate = new RangeF32(30, 30); profiles.depth.frameRate = f_drate; // Setting the resolution profile sm.CaptureManager.FilterByStreamProfiles(profiles); sampleReader = SampleReader.Activate(sm); sampleReader2 = SampleReader.Activate(sm); sampleReader2.EnableStream(StreamType.STREAM_TYPE_DEPTH, depthWidth, depthHeight, colorFPS); // Enable and Get a segmentation instance here for configuration seg = Seg3D.Activate(sm); // Initialize seg.FrameProcessed += OnFrameProcessed; seg.OnAlert += Seg_OnAlert; sampleReader2.SampleArrived += SampleArrived; /* Initialize pipeline */ sm.Init(); // Flip the image horizontally sm.CaptureManager.Device.IVCAMAccuracy = IVCAMAccuracy.IVCAM_ACCURACY_FINEST; sm.CaptureManager.Device.MirrorMode = MirrorMode.MIRROR_MODE_HORIZONTAL; /* Create NativeTexturePlugin to render Texture2D natively */ texPlugin = NativeTexturePlugin.Activate(); // Configuring the material and its texture RGBMaterial.mainTexture = new Texture2D(colorWidth, colorHeight, TextureFormat.BGRA32, false); // Update material's Texture2D with enabled image size. RGBMaterial.mainTextureScale = new Vector2(-1, -1); // Flip the image colorTex2DPtr = RGBMaterial.mainTexture.GetNativeTexturePtr(); // Retrieve native Texture2D Pointer /* Start Streaming */ sm.StreamFrames(false); }
// Use this for initialization void Start() { /* Create SenseManager Instance */ sm = SenseManager.CreateInstance(); /* Selecting a higher resolution profile*/ StreamProfileSet profiles = new StreamProfileSet(); profiles.color.imageInfo.width = 1280; profiles.color.imageInfo.height = 720; RangeF32 f_rate = new RangeF32(30, 30); profiles.color.frameRate = f_rate; profiles.depth.imageInfo.width = 640; profiles.depth.imageInfo.height = 480; RangeF32 f_drate = new RangeF32(30, 30); profiles.depth.frameRate = f_drate; /* Setting the resolution profile */ sm.CaptureManager.FilterByStreamProfiles(profiles); /* Enable and Get a segmentation instance here for configuration */ seg = Seg3D.Activate(sm); /* Subscribe to seg arrived event */ seg.FrameProcessed += OnFrameProcessed; /* Initialize pipeline */ sm.Init(); /* Create NativeTexturePlugin to render Texture2D natively */ texPlugin = NativeTexturePlugin.Activate(); SegMaterial.mainTexture = new Texture2D(segWidth, segHeight, TextureFormat.BGRA32, false); // Update material's Texture2D with enabled image size. SegMaterial.mainTextureScale = new Vector2(-1, -1); // Flip the image segTex2DPtr = SegMaterial.mainTexture.GetNativeTexturePtr(); // Retrieve native Texture2D Pointer /* Start Streaming */ sm.StreamFrames(false); }