Okay, figured something out
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using Leap;
using System;
using System.Drawing;
using System.Drawing.Imaging;
public class LeapVision : MonoBehaviour
{
Leap.Controller controller = new Leap.Controller();
// Start is called before the first frame update
void Start()
{
controller.SetPolicy(Leap.Controller.PolicyFlag.POLICY_IMAGES);
//controller.FrameReady += FrameEvent;
controller.ImageReady += ImageReady;
}
private void ImageReady(object sender, ImageEventArgs e)
{
if (File.Exists("RightBMP.bmp"))
{
return;
}
Leap.Image image = e.image;
Bitmap bitmap = new Bitmap(image.Width, image.Height, System.Drawing.Imaging.PixelFormat.Format8bppIndexed);
//set palette
ColorPalette grayscale = bitmap.Palette;
for (int i = 0; i < 256; i++)
{
grayscale.Entries[i] = System.Drawing.Color.FromArgb((int)255, i, i, i);
}
bitmap.Palette = grayscale;
Rectangle lockArea = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
BitmapData bitmapData = bitmap.LockBits(lockArea, ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);
byte[] rawImageData = image.Data(Leap.Image.CameraType.LEFT);
System.Runtime.InteropServices.Marshal.Copy(rawImageData, 0, bitmapData.Scan0, image.Width * image.Height);
bitmap.UnlockBits(bitmapData);
bitmap.Save("RightBMP.bmp");
}
}
Its still the left eye only, even if i change the camera type. How do I render the other camera?