Esempio n. 1
0
 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;
     }));
 }
Esempio n. 2
0
        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());
        }
Esempio n. 3
0
 public IObservable <Mat> Process(IObservable <Mat> source)
 {
     return(Process(source, input => new ArraySegment <byte>(ArrHelper.ToArray(input, Layout))));
 }
Esempio n. 4
0
 public IObservable <Mat> Process(IObservable <Mat> source)
 {
     return(Process(source, input => ArrHelper.ToArray(input, Layout)));
 }
Esempio n. 5
0
        static byte[] Process <TArray>(TArray input) where TArray : Arr
        {
            var inputHeader = input.GetMat();

            return(ArrHelper.ToArray(inputHeader));
        }