public IObservable <Seq> Process(IObservable <IplImage> source) { return(source.Select(input => { var storage = new MemStorage(); var output = new Seq(ArrHelper.FromIplDepth(input.Depth), input.Channels, SequenceKind.Curve, Flags, storage); output.Insert(0, (Arr)input); return output; })); }
static Func <TArray, Depth, int, TArray> InitializeTemplateSizeFactory() { LambdaExpression allocator; if (typeof(TArray) == typeof(Mat)) { Expression <Func <Mat, Depth, int, Mat> > matAllocator = (mat, depth, channels) => new Mat(mat.Size, depth, channels); allocator = matAllocator; } else if (typeof(TArray) == typeof(IplImage)) { Expression <Func <IplImage, Depth, int, IplImage> > imageAllocator = (image, depth, channels) => new IplImage(image.Size, ArrHelper.FromDepth(depth), channels); allocator = imageAllocator; } else { throw new InvalidOperationException("Invalid array type."); } return(Expression.Lambda <Func <TArray, Depth, int, TArray> >(allocator.Body, allocator.Parameters).Compile()); }
public IObservable <Mat> Process(IObservable <Mat> source) { return(Process(source, input => new ArraySegment <byte>(ArrHelper.ToArray(input, Layout)))); }
public IObservable <Mat> Process(IObservable <Mat> source) { return(Process(source, input => ArrHelper.ToArray(input, Layout))); }
static byte[] Process <TArray>(TArray input) where TArray : Arr { var inputHeader = input.GetMat(); return(ArrHelper.ToArray(inputHeader)); }