Class: PhotoscanOutputs::Camera
- Inherits:
-
Object
- Object
- PhotoscanOutputs::Camera
- Defined in:
- lib/photoscan_outputs/camera.rb
Instance Attribute Summary collapse
-
#calibration ⇒ Object
readonly
Returns the value of attribute calibration.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#resolution ⇒ Object
readonly
Returns the value of attribute resolution.
-
#transform ⇒ Object
(also: #body_to_world)
readonly
Returns the value of attribute transform.
Class Method Summary collapse
Instance Method Summary collapse
- #dump(io = STDOUT) ⇒ Object
-
#initialize(label, resolution, calibration, transform) ⇒ Camera
constructor
A new instance of Camera.
- #world_to_body ⇒ Object
Constructor Details
#initialize(label, resolution, calibration, transform) ⇒ Camera
Returns a new instance of Camera.
149 150 151 152 153 154 |
# File 'lib/photoscan_outputs/camera.rb', line 149 def initialize( label, resolution, calibration, transform ) @name = label @resolution = resolution @calibration = calibration @transform = transform end |
Instance Attribute Details
#calibration ⇒ Object (readonly)
Returns the value of attribute calibration.
147 148 149 |
# File 'lib/photoscan_outputs/camera.rb', line 147 def calibration @calibration end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
147 148 149 |
# File 'lib/photoscan_outputs/camera.rb', line 147 def name @name end |
#resolution ⇒ Object (readonly)
Returns the value of attribute resolution.
147 148 149 |
# File 'lib/photoscan_outputs/camera.rb', line 147 def resolution @resolution end |
#transform ⇒ Object (readonly) Also known as: body_to_world
Returns the value of attribute transform.
147 148 149 |
# File 'lib/photoscan_outputs/camera.rb', line 147 def transform @transform end |
Class Method Details
.from_xml(xml, global) ⇒ Object
174 175 176 177 178 179 180 181 |
# File 'lib/photoscan_outputs/camera.rb', line 174 def self.from_xml( xml, global ) # Leverage Ox::Element's method_missing support res = Resolution.from_xml xml.resolution trans = Transform.from_xml xml.transform, global calib = Calibration.from_xml xml.calibration Camera.new( xml.label, res, calib, trans ) end |
Instance Method Details
#dump(io = STDOUT) ⇒ Object
162 163 164 165 166 167 168 169 170 |
# File 'lib/photoscan_outputs/camera.rb', line 162 def dump( io = STDOUT ) io.puts "Camera \"#{name}\"" io.puts "Resolution: %d x %d" % [resolution.width, resolution.height] io.puts "Calibration:" calibration.dump io io.puts "Body-to-world transform" body_to_world.dump( io ) end |
#world_to_body ⇒ Object
158 159 160 |
# File 'lib/photoscan_outputs/camera.rb', line 158 def world_to_body transform.inv end |