Skip to content

Commit

Permalink
Allow input rectangle to be outside output bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed Aug 8, 2022
1 parent 7396595 commit a5da02a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Bonsai.Vision/ResizeCanvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,13 @@ public override IObservable<IplImage> Process(IObservable<IplImage> source)
}

var output = new IplImage(targetSize, input.Depth, input.Channels);
using (var inputHeader = input.GetSubRect(inputRect))
if (inputRect.Width < 0 || inputRect.Height < 0)
{
output.Set(FillValue);
}
else
{
using var inputHeader = input.GetSubRect(inputRect);
CV.CopyMakeBorder(inputHeader, output, offset, BorderType, FillValue);
}
return output;
Expand Down

0 comments on commit a5da02a

Please sign in to comment.