Skip to content

Commit

Permalink
Merge pull request #6 from mdouchement/tp-updated_api
Browse files Browse the repository at this point in the history
[master] Updated instanciation API
  • Loading branch information
mdouchement authored Sep 2, 2018
2 parents 98d1187 + 6347acd commit bf2d071
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ Please cite above paper for research purpose.

```go
// Fast Bilateral
bilateral.NewFastBilateralAuto(m)
bilateral.Auto(m)

// Luminance Fast Bilateral
luminance.NewFastBilateralAuto(m)
luminance.Auto(m)
```

## Requirements
Expand All @@ -47,7 +47,7 @@ defer fi.Close()
m, _, _ := image.Decode(fi)

start := time.Now()
fbl := bilateral.NewFastBilateral(m, 16, 0.1)
fbl := bilateral.New(m, 16, 0.1)
fbl.Execute()
m2 := fbl.ResultImage() // Or use `At(x, y)` func or just use `fbl` as an image.Image for chained treatments.

Expand Down
4 changes: 2 additions & 2 deletions data/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ func main() {
var m2 image.Image
start := time.Now()
if entry["type"] == "lum" {
fbl := luminance.NewFastBilateralAuto(m)
fbl := luminance.Auto(m)
fbl.Execute()
m2 = fbl.ResultImage()
} else {
fbl := bilateral.NewFastBilateralAuto(m)
fbl := bilateral.Auto(m)
fbl.Execute()
m2 = fbl.ResultImage()
}
Expand Down
10 changes: 5 additions & 5 deletions fast_bilateral.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ type FastBilateral struct {
auto bool
}

// NewFastBilateralAuto instanciates a new FastBilateral with automatic sigma values.
func NewFastBilateralAuto(m image.Image) *FastBilateral {
f := NewFastBilateral(m, 16, 0.1)
// Auto instanciates a new FastBilateral with automatic sigma values.
func Auto(m image.Image) *FastBilateral {
f := New(m, 16, 0.1)
f.auto = true
return f
}

// NewFastBilateral instanciates a new FastBilateral.
func NewFastBilateral(img image.Image, sigmaSpace, sigmaRange float64) *FastBilateral {
// New instanciates a new FastBilateral.
func New(img image.Image, sigmaSpace, sigmaRange float64) *FastBilateral {
dimension := 5 // default: x, y, colors (z1, z2, z3)
fbl := &FastBilateral{
Image: img,
Expand Down
4 changes: 2 additions & 2 deletions fast_bilateral_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestFastBilateralColor(t *testing.T) {
mi := images["base"]
mo := images["filtered"]

filter := bilateral.NewFastBilateralAuto(mi)
filter := bilateral.Auto(mi)
filter.Execute()

if filter.ColorModel() != color.RGBAModel {
Expand Down Expand Up @@ -47,7 +47,7 @@ func TestFastBilateralGray(t *testing.T) {
mi := images["base-gray"]
mo := images["base-gray-filtered"]

filter := bilateral.NewFastBilateralAuto(mi)
filter := bilateral.Auto(mi)
filter.Execute()

if filter.ColorModel() != color.RGBAModel {
Expand Down
10 changes: 5 additions & 5 deletions luminance/fast_bilateral.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ type FastBilateral struct {
auto bool
}

// NewFastBilateralAuto instanciates a new FastBilateral with automatic sigma values.
func NewFastBilateralAuto(m image.Image) *FastBilateral {
f := NewFastBilateral(m, 16, 0.1)
// Auto instanciates a new FastBilateral with automatic sigma values.
func Auto(m image.Image) *FastBilateral {
f := New(m, 16, 0.1)
f.auto = true
return f
}

// NewFastBilateral instanciates a new FastBilateral.
func NewFastBilateral(m image.Image, sigmaSpace, sigmaRange float64) *FastBilateral {
// New instanciates a new FastBilateral.
func New(m image.Image, sigmaSpace, sigmaRange float64) *FastBilateral {
return &FastBilateral{
Image: m,
SigmaRange: sigmaRange,
Expand Down
4 changes: 2 additions & 2 deletions luminance/fast_bilateral_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestFastBilateralColor(t *testing.T) {
mi := images["base"]
mo := images["filtered"]

filter := luminance.NewFastBilateralAuto(mi)
filter := luminance.Auto(mi)
filter.Execute()

if filter.ColorModel() != color.RGBAModel {
Expand Down Expand Up @@ -47,7 +47,7 @@ func TestFastBilateralGray(t *testing.T) {
mi := images["base-gray"]
mo := images["base-gray-filtered"]

filter := luminance.NewFastBilateralAuto(mi)
filter := luminance.Auto(mi)
filter.Execute()

if filter.ColorModel() != color.RGBAModel {
Expand Down

0 comments on commit bf2d071

Please sign in to comment.