예제 #1
0
파일: Shift.cs 프로젝트: aalmada/bonsai
 public IObservable <IplImage> Process(IObservable <IplImage> source)
 {
     return(source.Select(input =>
     {
         var offset = Offset;
         var copyOffset = new Point(Math.Max(0, offset.X), Math.Max(0, offset.Y));
         var size = new Size(input.Width + Math.Abs(offset.X), input.Height + Math.Abs(offset.Y));
         Arr output = new IplImage(size, input.Depth, input.Channels);
         CV.CopyMakeBorder(input, output, copyOffset, BorderType, FillValue);
         output = output.GetSubRect(new Rect(
                                        Math.Max(0, -offset.X),
                                        Math.Max(0, -offset.Y),
                                        input.Width,
                                        input.Height));
         return output.GetImage();
     }));
 }