Class: PhotoscanOutputs::Camera

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(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

#calibrationObject (readonly)

Returns the value of attribute calibration.



147
148
149
# File 'lib/photoscan_outputs/camera.rb', line 147

def calibration
  @calibration
end

#nameObject (readonly)

Returns the value of attribute name.



147
148
149
# File 'lib/photoscan_outputs/camera.rb', line 147

def name
  @name
end

#resolutionObject (readonly)

Returns the value of attribute resolution.



147
148
149
# File 'lib/photoscan_outputs/camera.rb', line 147

def resolution
  @resolution
end

#transformObject (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_bodyObject



158
159
160
# File 'lib/photoscan_outputs/camera.rb', line 158

def world_to_body
  transform.inv
end