Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
octu0 committed Apr 6, 2021
1 parent 7933b1e commit 62b3748
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion canny.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func MorphologyCannyWithDilate(
img *image.RGBA,
thresholdMax, thresholdMin int,
mode CannyMorphologyMode,
morphSize int,
morphSize int,
dilateSize int,
) (*image.RGBA, error) {
width, height := wh(img)
Expand Down
6 changes: 3 additions & 3 deletions cli/bridge/canny.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ func cannyAction(c *cli.Context) error {
return err
}

mode := blurry.CannyMorphologyMode(c.Int("mode"))
size := c.Int("size")
dilate := c.Int("dilate")
mode := blurry.CannyMorphologyMode(c.Int("mode"))
size := c.Int("size")
dilate := c.Int("dilate")
out, err := blurry.MorphologyCannyWithDilate(in, c.Int("max"), c.Int("min"), mode, size, dilate)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cli/bridge/rotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func rotateAction(c *cli.Context) error {
return err
}

mode := blurry.RotationMode(c.Int("rotate"))
mode := blurry.RotationMode(c.Int("rotate"))

out, err := blurry.Rotate(in, mode)
if err != nil {
Expand Down
32 changes: 16 additions & 16 deletions cli/genrun/canny.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ func cannyAction(c *cli.Context) error {
args := []string{
c.String("max"),
c.String("min"),
}
}

var cmd string = "canny"
var cmd string = "canny"

if c.String("dilate") != "0" {
switch c.String("mode") {
case "0":
cmd = "canny_dilate"
args = append(args, c.String("dilate"))
case "1":
cmd = "canny_morphology_open"
args = append(args, c.String("size"))
args = append(args, c.String("dilate"))
case "2":
cmd = "canny_morphology_close"
args = append(args, c.String("size"))
args = append(args, c.String("dilate"))
}
if c.String("dilate") != "0" {
switch c.String("mode") {
case "0":
cmd = "canny_dilate"
args = append(args, c.String("dilate"))
case "1":
cmd = "canny_morphology_open"
args = append(args, c.String("size"))
args = append(args, c.String("dilate"))
case "2":
cmd = "canny_morphology_close"
args = append(args, c.String("size"))
args = append(args, c.String("dilate"))
}
}
if err := runLocal(runtimePath, generateOutFilePath, c.String("input"), cmd, args); err != nil {
return err
Expand Down
12 changes: 6 additions & 6 deletions cli/genrun/genrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ func generate(runtimePath, blurryPath string) (string, error) {
}
runtimePath = realRuntimePath

blurryFileName := filepath.Base(blurryPath)
blurryDirName := filepath.Dir(blurryPath)
blurryExt := filepath.Ext(blurryFileName)
blurryGenName := strings.Replace(blurryFileName, blurryExt, "_gen" + blurryExt, strings.LastIndex(blurryFileName, blurryExt))
blurryGenPath := filepath.Join(blurryDirName, blurryGenName)
blurryFileName := filepath.Base(blurryPath)
blurryDirName := filepath.Dir(blurryPath)
blurryExt := filepath.Ext(blurryFileName)
blurryGenName := strings.Replace(blurryFileName, blurryExt, "_gen"+blurryExt, strings.LastIndex(blurryFileName, blurryExt))
blurryGenPath := filepath.Join(blurryDirName, blurryGenName)

mktemp, err := exec.Command("mktemp", "/tmp/outXXXX").Output()
if err != nil {
Expand Down Expand Up @@ -63,7 +63,7 @@ func generate(runtimePath, blurryPath string) (string, error) {
"-std=c++11",
"-o", generateOutFilePath,
blurryPath,
blurryGenPath,
blurryGenPath,
}
log.Printf("info: generate %v", genArgs)

Expand Down

0 comments on commit 62b3748

Please sign in to comment.