本文整理汇总了C#中Picture.Errorize方法的典型用法代码示例。如果您正苦于以下问题:C# Picture.Errorize方法的具体用法?C# Picture.Errorize怎么用?C# Picture.Errorize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Picture
的用法示例。
在下文中一共展示了Picture.Errorize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BufferCB
public int BufferCB(double sampleTime, IntPtr buffer, int len)
{
using (var rgba = new Picture<Rgba, byte>(Width, Height))
using (var gray = new Picture<Gray, byte>(Width, Height))
{
if ((len / 3) == (Width * Height))
{
using (var bgr = new Image<Bgr, byte>(Width, Height, Width * 3, buffer))
{
bgr._Flip(FLIP.VERTICAL);
CvInvoke.cvCvtColor(bgr.Ptr, rgba.Emgu.Ptr, COLOR_CONVERSION.CV_BGR2RGBA);
CvInvoke.cvCvtColor(bgr.Ptr, gray.Emgu.Ptr, COLOR_CONVERSION.CV_BGR2GRAY);
}
}
else
{
gray.Errorize();
rgba.Errorize();
}
OnNext(gray.AddRef(), rgba.AddRef());
}
return 0;
}
示例2: Runner
private void Runner()
{
Exposure = TimeSpan.FromSeconds(0.9 / FPS);
WhiteBalance = Color.White;
Gain = 0;
CLEyeSetCameraParameter(Handle, Param.CLEYE_AUTO_EXPOSURE_0_1, 0);
CLEyeSetCameraParameter(Handle, Param.CLEYE_AUTO_GAIN_0_1, 0);
CLEyeSetCameraParameter(Handle, Param.CLEYE_AUTO_WHITEBALANCE_0_1, 0);
if (Global.No)
{
CLEyeSetCameraParameter(Handle, Param.CLEYE_AUTO_WHITEBALANCE_0_1, 1);
CLEyeSetCameraParameter(Handle, Param.CLEYE_AUTO_GAIN_0_1, 1);
CLEyeSetCameraParameter(Handle, Param.CLEYE_AUTO_EXPOSURE_0_1, 1);
}
CLEyeCameraStart(Handle);
while (Running)
{
using (var rgba = new Picture<Rgba, byte>(this.Width, this.Height))
using (var gray = new Picture<Gray, byte>(this.Width, this.Height))
using (var bayer = new Picture<Gray, byte>(this.Width, this.Height))
using (var bgr = new Picture<Bgr, byte>(this.Width, this.Height))
{
var waitTimeOutMs = 2000;
var ok = NumChannels == 1
? CLEyeCameraGetFrame(Handle, bayer.Ptr, waitTimeOutMs)
: false;
if (!ok)
bayer.Errorize();
CvInvoke.cvCvtColor(bayer.Emgu.Ptr, bgr.Emgu.Ptr, COLOR_CONVERSION.CV_BayerGB2BGR_VNG);
CvInvoke.cvCvtColor(bgr.Emgu.Ptr, rgba.Emgu.Ptr, COLOR_CONVERSION.CV_BGR2RGBA);
CvInvoke.cvCvtColor(bgr.Emgu.Ptr, gray.Emgu.Ptr, COLOR_CONVERSION.CV_BGR2GRAY);
OnNext(gray.AddRef(), rgba.AddRef());
}
}
if (Handle != IntPtr.Zero)
{
CLEyeCameraStop(Handle);
CLEyeDestroyCamera(Handle);
Handle = IntPtr.Zero;
}
}