Class: PhotoscanOutputs::Calibration

Inherits:
Object
  • Object
show all
Defined in:
lib/photoscan_outputs/camera.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fx, fy, cx, cy, skew) ⇒ Calibration

Returns a new instance of Calibration.



12
13
14
15
16
17
18
# File 'lib/photoscan_outputs/camera.rb', line 12

def initialize( fx, fy, cx, cy, skew )
  @fx = fx
  @fy = fy
  @cx = cx
  @cy = cy
  @skew = skew
end

Instance Attribute Details

#cxObject

Returns the value of attribute cx.



10
11
12
# File 'lib/photoscan_outputs/camera.rb', line 10

def cx
  @cx
end

#cyObject

Returns the value of attribute cy.



10
11
12
# File 'lib/photoscan_outputs/camera.rb', line 10

def cy
  @cy
end

#fxObject

Returns the value of attribute fx.



10
11
12
# File 'lib/photoscan_outputs/camera.rb', line 10

def fx
  @fx
end

#fyObject

Returns the value of attribute fy.



10
11
12
# File 'lib/photoscan_outputs/camera.rb', line 10

def fy
  @fy
end

#skewObject

Returns the value of attribute skew.



10
11
12
# File 'lib/photoscan_outputs/camera.rb', line 10

def skew
  @skew
end

Class Method Details

.from_xml(xml) ⇒ Object



33
34
35
36
37
# File 'lib/photoscan_outputs/camera.rb', line 33

def self.from_xml( xml )
  Calibration.new( xml.fx.text.to_f, xml.fy.text.to_f, 
                  xml.cx.text.to_f, xml.cy.text.to_f,
                  xml.skew.text.to_f )
end

Instance Method Details

#dump(io) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/photoscan_outputs/camera.rb', line 24

def dump( io )
  [ :fx, :fy, :cx, :cy, :skew ].each { |key|
    io.puts "  %10s:  %10f" % [key.to_s, send(key)]
  }
  io.puts "Camera projection matrix:"
  print_mat( k, io )
end

#kObject



20
21
22
# File 'lib/photoscan_outputs/camera.rb', line 20

def k
  Matrix.rows [ [ @fx, @skew, @cx ], [ 0, @fy, @cy ], [0,0,1] ]
end