public IObservable <TArray> Process <TArray>(IObservable <Tuple <TArray, TArray> > source) where TArray : Arr { var outputFactory = ArrFactory <TArray> .TemplateFactory; return(source.Select(input => { var output = outputFactory(input.Item1); CV.CartToPolar(input.Item1, input.Item2, output); return output; })); }
public IObservable <Tuple <TArray, TArray> > Process <TArray>(IObservable <Tuple <TArray, TArray> > source) where TArray : Arr { var outputFactory = ArrFactory <TArray> .TemplateFactory; return(source.Select(input => { var magnitude = outputFactory(input.Item1); var angle = outputFactory(input.Item1); CV.CartToPolar(input.Item1, input.Item2, magnitude, angle, AngleInDegrees); return Tuple.Create(magnitude, angle); })); }
public override IObservable <TArray> Process <TArray>(IObservable <TArray> source) { var channelFactory = ArrFactory <TArray> .TemplateSizeDepthFactory; var outputFactory = ArrFactory <TArray> .TemplateFactory; return(source.Select(input => { var x = channelFactory(input, 1); var y = channelFactory(input, 1); var magnitude = channelFactory(input, 1); var angle = channelFactory(input, 1); var output = outputFactory(input); CV.Split(input, x, y, null, null); CV.CartToPolar(x, y, magnitude, angle, AngleInDegrees); CV.Merge(magnitude, angle, null, null, output); return output; })); }
public override IObservable <TArray> Process <TArray>(IObservable <TArray> source) { var outputFactory = ArrFactory <TArray> .TemplateSizeDepthFactory; return(Observable.Defer(() => { TArray x = null; TArray y = null; return source.Select(input => { if (x == null) { x = outputFactory(input, 1); y = outputFactory(input, 1); } var output = outputFactory(input, 1); CV.Split(input, x, y, null, null); CV.CartToPolar(x, y, output); return output; }); })); }