Skip to content

Commit 890ec8c

Browse files
committed
towards consolidation
1 parent 1048d64 commit 890ec8c

File tree

4 files changed

+30
-27
lines changed

4 files changed

+30
-27
lines changed

src/CameraModels.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ include("ExportAPI.jl")
1111

1212
# data types
1313
include("entities/GeneralTypes.jl")
14-
include("entities/IntrinsicExtrinsic.jl")
15-
include("entities/Pinhole.jl")
14+
include("entities/CameraTypes.jl")
1615
include("entities/RadialDistortion.jl")
1716
include("entities/CameraSkewDistortion.jl")
1817

1918
# function logic
2019
include("services/Prototypes.jl")
21-
include("services/Pinhole.jl")
20+
include("services/CameraServices.jl")
2221
include("services/RadialDistortion.jl")
2322
include("services/Utils.jl")
2423

src/entities/Pinhole.jl renamed to src/entities/CameraTypes.jl

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33

44
## From yakir12/CameraModels.jl
55
struct Pinhole <: CameraModel
6-
7-
Pinhole(pixelwidth::Int, pixelheight::Int, prinicipalpoint::PixelCoordinate, focallength::Vector2) = new(prinicipalpoint, focallength, pixelwidth, pixelheight)
8-
9-
prinicipalpoint::PixelCoordinate # in pixels
10-
focallength::Vector2 # in pixels
6+
# note order of elements has been changed from original source so that inner constructor can be removed.
117
columns::Int
128
rows::Int
9+
prinicipalpoint::PixelCoordinate # in pixels
10+
focallength::Vector2 # in pixels
1311
end
1412

1513

@@ -33,4 +31,23 @@ DevNotes
3331
"""
3432
struct PinholeCamera{R <: Real} <: AbstractCameraModel
3533
K::SMatrix{3,3,R}
36-
end
34+
end
35+
36+
37+
Base.@kwdef struct CameraIntrinsic
38+
K::Array{Float64,2}
39+
end
40+
CameraIntrinsic(;x0=320.0,y0=240.0,fx=510.0,fy=510.0,s=0.0) = CameraIntrinsic([[fx;s;x0]';[0.0;fy;y0]';[0.0;0;1]'])
41+
42+
43+
# Camera extrinsic must be world in camera frame (cRw)
44+
Base.@kwdef struct CameraExtrinsic{T <: Real}
45+
R::Rot_.RotMatrix{T} = id = one(Rot_.RotMatrix{3, Float64})
46+
t::Vector{T} = zeros(3)
47+
end
48+
49+
Base.@kwdef struct CameraModelFull
50+
ci::CameraIntrinsic = CameraIntrinsic()
51+
ce::CameraExtrinsic = CameraExtrinsic()
52+
end
53+

src/entities/IntrinsicExtrinsic.jl

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
11

22

3-
Base.@kwdef struct CameraIntrinsic
4-
K::Array{Float64,2}
5-
end
6-
CameraIntrinsic(;x0=320.0,y0=240.0,fx=510.0,fy=510.0,s=0.0) = CameraIntrinsic([[fx;s;x0]';[0.0;fy;y0]';[0.0;0;1]'])
73

8-
# Camera extrinsic must be world in camera frame (cRw)
9-
Base.@kwdef struct CameraExtrinsic{T <: Real}
10-
R::Rot_.RotMatrix{T} = id = one(Rot_.RotMatrix{3, Float64})
11-
t::Vector{T} = zeros(3)
12-
end
13-
14-
Base.@kwdef struct CameraModelFull
15-
ci::CameraIntrinsic = CameraIntrinsic()
16-
ce::CameraExtrinsic = CameraExtrinsic()
17-
# cd::CameraDistortion
18-
end

src/services/Pinhole.jl renamed to src/services/CameraServices.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,12 @@ PinholeCamera(; f_w::Real=300,
5858
c_w::R=320.0,
5959
c_h::Real=240,
6060
shear::Real=0) where {R <: Real} = SMatrix{3,3,R}([f_w shear c_w;
61-
0 f_h c_h;
62-
0 0 1])
61+
0 f_h c_h;
62+
0 0 1])
63+
#
64+
6365
"""
64-
$TYPEDSIGNATURES
66+
$SIGNATURES
6567
6668
Constructor helper assuming you just have a camera image and need to start somewhere for a basic camera model.
6769

0 commit comments

Comments
 (0)