1.0.7
This commit is contained in:
@@ -41,6 +41,7 @@ namespace Inspectron.Camera.UEye
|
||||
{
|
||||
uEye.Defines.ColorMode mode;
|
||||
_camera.PixelFormat.Get(out mode);
|
||||
|
||||
int channels = 0;
|
||||
|
||||
if (mode == uEye.Defines.ColorMode.Mono8)
|
||||
@@ -53,7 +54,7 @@ namespace Inspectron.Camera.UEye
|
||||
}
|
||||
else if (mode == uEye.Defines.ColorMode.BGRA8Packed)
|
||||
{
|
||||
channels = 3;
|
||||
channels = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -67,9 +68,18 @@ namespace Inspectron.Camera.UEye
|
||||
|
||||
Byte[] u8img;
|
||||
_camera.Memory.CopyToArray(idx, out u8img);
|
||||
|
||||
|
||||
// Warning! This will work only if pitch == width * channels
|
||||
if (pitch != size.Width * channels)
|
||||
{
|
||||
throw new Exception("pitch must be equal to width * channels");
|
||||
}
|
||||
Mat mat = new Mat(size.Height, size.Width,MatType.CV_8UC3);
|
||||
// copy data to mat
|
||||
System.Runtime.InteropServices.Marshal.Copy(u8img, 0, mat.Data, u8img.Length);
|
||||
|
||||
|
||||
Mat mat = new Mat(size.Height,pitch, MatType.CV_8UC(channels));
|
||||
mat.SetArray(u8img);
|
||||
return mat;
|
||||
}
|
||||
|
||||
@@ -88,14 +98,13 @@ namespace Inspectron.Camera.UEye
|
||||
}
|
||||
uEye.Types.SensorInfo info = new uEye.Types.SensorInfo();
|
||||
_camera.Information.GetSensorInfo(out info);
|
||||
Console.WriteLine($"Camera {cameraIdx} opened: {info.SensorName} ({info.SensorID})");
|
||||
Log.Information($"Camera {cameraIdx} opened: {info.SensorName} ({info.SensorID})");
|
||||
_camera.Parameter.Load();
|
||||
Console.WriteLine($"Camera {cameraIdx} parameters loaded");
|
||||
Log.Information($"Camera {cameraIdx} parameters loaded");
|
||||
|
||||
_camera.Trigger.Set(uEye.Defines.TriggerMode.Continuous);
|
||||
|
||||
statusRet = _camera.Memory.Allocate();
|
||||
Console.WriteLine("Memory allocated");
|
||||
if (statusRet != uEye.Defines.Status.Success)
|
||||
{
|
||||
throw new Exception("Allocate Memory failed");
|
||||
|
||||
Reference in New Issue
Block a user