Skip to content

Commit 088648c

Browse files
committed
Adds Core functions, datatypes and Filters for CENSURE
1 parent 7f1b514 commit 088648c

File tree

2 files changed

+71
-3
lines changed

2 files changed

+71
-3
lines changed

src/ImageFeatures.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
module ImageFeatures
2-
32
# package code goes here
43
using Images, ColorTypes, FixedPointNumbers, Distributions
54

@@ -12,8 +11,9 @@ include("brief.jl")
1211
include("orb.jl")
1312
include("freak.jl")
1413
include("brisk.jl")
14+
include("censure.jl")
1515

16-
export Keypoint, Keypoints, Feature, Features, Params, BRIEF, ORB, FREAK, BRISK
16+
export Keypoint, Keypoints, BRIEF, DescriptorParams, ORB, CENSURE, OctagonFilter, BoxFilter, BiFilter, Detector
1717

1818
export
1919
#Core
@@ -56,5 +56,8 @@ export
5656
random_coarse,
5757
gaussian,
5858
gaussian_local,
59-
centered
59+
centered,
60+
61+
#CENSURE
62+
censure
6063
end

src/censure.jl

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
abstract BiFilter
2+
3+
type BoxFilter <: BiFilter
4+
5+
filter :: Array{Float64, 2}
6+
m_out :: UInt8
7+
m_in :: UInt8
8+
9+
BoxFilter(mo, mi) = new(ones(Float64, mo, mo), mo, mi)
10+
11+
end
12+
13+
type OctagonFilter <: BiFilter
14+
15+
filter :: Array{Float64, 2}
16+
m_out :: UInt8
17+
m_in :: UInt8
18+
n_out :: UInt8
19+
n_in :: UInt8
20+
21+
OctagonFilter(mo, mi, no, ni) = new(ones(Float64, mo + 2 * no, mo + 2 * no), mo, mi, no, ni)
22+
23+
end
24+
25+
type CENSURE <: Detector
26+
27+
smallest :: Integer
28+
largest :: Integer
29+
filter :: Type
30+
responseThreshold :: Number
31+
lineThreshold :: Number
32+
33+
end
34+
35+
function createFilter(OF::OctagonFilter)
36+
inner_start = Int(0.5 * ((OF.m_out + 2 * OF.n_out) - (OF.m_in + 2 * OF.n_in)))
37+
OF.filter[inner_start + 1 : end - inner_start, inner_start + 1 : end - inner_start] = -1
38+
39+
for i in 1:OF.n_in
40+
OF.filter[inner_start + i, inner_start + 1 : inner_start + OF.n_in - i + 1] = 0
41+
OF.filter[inner_start + i, inner_start + OF.n_in + OF.m_in + i : inner_start + OF.m_in + 2 * OF.n_in] = 0
42+
OF.filter[inner_start + OF.m_in + 2 * OF.n_in - i + 1, inner_start + 1 : inner_start + OF.n_in - i + 1] = 0
43+
OF.filter[inner_start + OF.m_in + 2 * OF.n_in - i + 1, inner_start + OF.n_in + OF.m_in + i : inner_start + OF.m_in + 2 * OF.n_in] = 0
44+
end
45+
46+
for i in 1:OF.n_out
47+
OF.filter[i, 1 : OF.n_out - i + 1] = 0
48+
OF.filter[i, OF.n_out + OF.m_out + i : OF.m_out + 2 * OF.n_out] = 0
49+
OF.filter[OF.m_out + 2 * OF.n_out - i + 1, 1 : OF.n_out - i + 1] = 0
50+
OF.filter[OF.m_out + 2 * OF.n_out - i + 1, OF.n_out + OF.m_out + i : OF.m_out + 2 * OF.n_out] = 0
51+
end
52+
53+
end
54+
55+
function createFilter(BF::BoxFilter)
56+
inner_start = Int(0.5 * (BF.m_out - BF.m_in))
57+
BF.filter[inner_start + 1 : end - inner_start, inner_start + 1 : end - inner_start] = -1
58+
end
59+
60+
CENSURE(; smallest::Integer = 1, largest::Integer = 7, filter::Type = BoxFilter, responseThreshold::Number = 0.15, lineThreshold::Number = 10) = CENSURE(scale, filter, responseThreshold, lineThreshold)
61+
62+
function censure{T}(img::AbstractArray{T, 2}, params::CENSURE)
63+
64+
65+
end

0 commit comments

Comments
 (0)