-
Notifications
You must be signed in to change notification settings - Fork 0
/
akaze-features.jl
executable file
·100 lines (81 loc) · 2.28 KB
/
akaze-features.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env julia
using ArgParse: ArgParseSettings, @add_arg_table, parse_args, parse_item
import ArgParse
using AkazeFeatures
# include("akaze-config.jl")
# include("akaze-descriptor.jl")
# include("akaze.jl")
# include("fed.jl")
# include("nonlinear-diffusion.jl")
# include("utils.jl")
function ArgParse.parse_item(::Type{DIFFUSIVITY_TYPE}, str::AbstractString)
return DIFFUSIVITY_TYPE(parse(Int, str))
end
s = ArgParseSettings()
@add_arg_table s begin
"--nsublevels"
help = "Number of sublevels per scale level"
arg_type = Int
default = 4
"--omax"
help = "Maximum octave evolution of the image 2^sigma (coarsest scale sigma units)"
arg_type = Int
default = 4
"--soffset"
help="Base scale offset (sigma units)"
arg_type = Float32
default = 1.6f0
"--derivative_factor"
help="Factor for the multiscale derivatives"
arg_type = Float32
default = 1.5f0
"--sderivatives"
help="Smoothing factor for the derivatives"
arg_type=Float32
default = 1f0
"--diffusivity"
# arg_type=Int
# default = Int(PM_G2)
arg_type=DIFFUSIVITY_TYPE
default = PM_G2
help="Diffusivity type"
"--dthreshold"
help="Detector response threshold to accept point"
arg_type=Float32
default = 1f-3
# default = 3f-5
"--min_dthreshold"
help="Minimum detector threshold to accept a point"
arg_type=Float32
default = 1f-5
"--output"
help="output filename"
arg_type=String
default = "keypoints.txt"
"imagename"
help = "Image file to be analyzed"
required = true
end
parsed_args = parse_args(ARGS, s)
img = load_image_as_grayscale(parsed_args["imagename"])
img_height, img_width = size(img)
opt = AKAZEOptions(
omin = 3,
omax = parsed_args["omax"],
nsublevels = parsed_args["nsublevels"],
img_width = img_width,
img_height = img_height,
diffusivity = parsed_args["diffusivity"],
dthreshold = parsed_args["dthreshold"],
)
akaze = AKAZE(opt)
Create_Nonlinear_Scale_Space(akaze, img)
kpts = Feature_Detection(akaze)
Compute_Main_Orientation.([akaze], kpts)
println("Extracted $(length(kpts)) points")
desc = Compute_Descriptors(akaze, kpts)
open(parsed_args["output"],"w") do io
for row in dump_keypoints_text(kpts, desc)
println(io, row)
end
end