Class: PhotoscanOutputs::Calibration
- Inherits:
-
Object
- Object
- PhotoscanOutputs::Calibration
- Defined in:
- lib/photoscan_outputs/camera.rb
Instance Attribute Summary collapse
-
#cx ⇒ Object
Returns the value of attribute cx.
-
#cy ⇒ Object
Returns the value of attribute cy.
-
#fx ⇒ Object
Returns the value of attribute fx.
-
#fy ⇒ Object
Returns the value of attribute fy.
-
#skew ⇒ Object
Returns the value of attribute skew.
Class Method Summary collapse
Instance Method Summary collapse
- #dump(io) ⇒ Object
-
#initialize(fx, fy, cx, cy, skew) ⇒ Calibration
constructor
A new instance of Calibration.
- #k ⇒ Object
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
#cx ⇒ Object
Returns the value of attribute cx.
10 11 12 |
# File 'lib/photoscan_outputs/camera.rb', line 10 def cx @cx end |
#cy ⇒ Object
Returns the value of attribute cy.
10 11 12 |
# File 'lib/photoscan_outputs/camera.rb', line 10 def cy @cy end |
#fx ⇒ Object
Returns the value of attribute fx.
10 11 12 |
# File 'lib/photoscan_outputs/camera.rb', line 10 def fx @fx end |
#fy ⇒ Object
Returns the value of attribute fy.
10 11 12 |
# File 'lib/photoscan_outputs/camera.rb', line 10 def fy @fy end |
#skew ⇒ Object
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 |
#k ⇒ Object
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 |