fix: seams dispersion issue on image enlargment #74

This commit is contained in:
esimov
2022-01-31 16:16:27 +02:00
parent f7c7d286cf
commit daf0b26e2f
4 changed files with 53 additions and 73 deletions

View File

@@ -17,7 +17,7 @@ func TestResize_ShrinkImageWidth(t *testing.T) {
width, height := img.Bounds().Max.X, img.Bounds().Max.Y
c = NewCarver(width, height)
c.ComputeSeams(p, img)
seams := c.FindLowestEnergySeams()
seams := c.FindLowestEnergySeams(p)
img = c.RemoveSeam(img, seams, p.Debug)
}
imgWidth := img.Bounds().Max.X
@@ -40,7 +40,7 @@ func TestResize_ShrinkImageHeight(t *testing.T) {
width, height := img.Bounds().Max.X, img.Bounds().Max.Y
c = NewCarver(width, height)
c.ComputeSeams(p, img)
seams := c.FindLowestEnergySeams()
seams := c.FindLowestEnergySeams(p)
img = c.RemoveSeam(img, seams, p.Debug)
}
img = c.RotateImage270(img)
@@ -64,7 +64,7 @@ func TestResize_EnlargeImageWidth(t *testing.T) {
width, height := img.Bounds().Max.X, img.Bounds().Max.Y
c = NewCarver(width, height)
c.ComputeSeams(p, img)
seams := c.FindLowestEnergySeams()
seams := c.FindLowestEnergySeams(p)
img = c.AddSeam(img, seams, p.Debug)
}
imgWidth := img.Bounds().Max.X - origImgWidth
@@ -88,7 +88,7 @@ func TestResize_EnlargeImageHeight(t *testing.T) {
width, height := img.Bounds().Max.X, img.Bounds().Max.Y
c = NewCarver(width, height)
c.ComputeSeams(p, img)
seams := c.FindLowestEnergySeams()
seams := c.FindLowestEnergySeams(p)
img = c.AddSeam(img, seams, p.Debug)
}
img = c.RotateImage270(img)