panomosity 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: c2657589cca00e16a0f43c63b2ccd7ed15df423e57c69cceaadcffdb43106266
4
- data.tar.gz: 8f5aa07ea96cbf4e0c2eac15ca1b30b2809c513a93e15348686a316f80e3db6e
2
+ SHA1:
3
+ metadata.gz: 43fd51dc7dedb7340d1d49debb7988ba41c222a6
4
+ data.tar.gz: ac8eda0d88511b85458b34bb98828a145dac89de
5
5
  SHA512:
6
- metadata.gz: 1c44106456133f47c3241dfce6cbd0e70ce1e96f597067d49c4dc19c7a298143c830d271dcbf6ef65540afaaba8930bc85ae3a0164fa071093c153882776e7af
7
- data.tar.gz: dc0156621e3a822f0cd1f8372ee5e5ad4ad8e869ec82bc89d0e66721d09b95fdae825544f7ac6b8c6c04b32381110e18f2eabdc4bdacb27a7585d6eedf0afa77
6
+ metadata.gz: b653e9c508061364866c37876161d45aee8aa376ebcdbaa4f909342fc6b21e73f8966759eb3b687e8f69be8d4370f0c0c129f0667a93e6dbbe42d28d68499b4e
7
+ data.tar.gz: 32c89ec697236944332d1928c2793b7b062ddfc52b04b1bb80e0517448808c84bed473709fa4256cde17cdcd3c4433b6a7f61da5b3a1c95b511bd49ba18ad084
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- panomosity (0.1.5)
4
+ panomosity (0.1.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -192,13 +192,17 @@ module Panomosity
192
192
  # Uses image magick to crop centers
193
193
  def crop_centers
194
194
  logger.info 'cropping centers'
195
+ scale_factor = @csv.each_line.first.split(',').last.to_f
195
196
  unless @options[:without_cropping]
196
197
  images = Image.parse(@input_file)
197
198
  images.each do |image|
198
199
  geometry = `identify -verbose #{image.name} | grep Geometry`.strip
199
200
  _, width, height = *geometry.match(/(\d{2,5})x(\d{2,5})(\+|\-)\d{1,5}(\+|\-)\d{1,5}/)
201
+ percent = (scale_factor*100).round
202
+ width_offset = (width.to_f * (1 - scale_factor) / 2).round
203
+ height_offset = (height.to_f * (1 - scale_factor) / 2).round
200
204
  logger.debug "cropping #{image.name}"
201
- `convert #{image.name} -crop "50%x50%+#{(width.to_f/4).round}+#{(height.to_f/4).round}" #{image.name}`
205
+ `convert #{image.name} -crop "#{percent}%x#{percent}%+#{width_offset}+#{height_offset}" #{image.name}`
202
206
  end
203
207
  end
204
208
 
@@ -589,38 +593,13 @@ module Panomosity
589
593
 
590
594
  def get_detailed_control_point_info
591
595
  logger.info 'getting detailed control point info'
592
-
593
596
  images = Image.parse(@input_file)
594
597
  panorama_variable = PanoramaVariable.parse(@input_file).first
595
- first_set_control_points = ControlPoint.parse(@input_file)
596
-
597
- @new_input = 'project_remove_equal_signs.pto'
598
- runner = Runner.new(@options.merge(input: @input, output: @new_input, remove_equal_signs: true))
599
- runner.run('convert_equaled_image_parameters')
600
- @input_file = File.new(@new_input, 'r').read
598
+ ControlPoint.parse(@input_file)
599
+ control_points = ControlPoint.calculate_distances(images, panorama_variable)
601
600
 
602
- second_set_control_points = ControlPoint.get_detailed_info(@new_input)
603
- control_points = ControlPoint.merge(first_set_control_points, second_set_control_points)
604
601
  control_points.each do |cp|
605
- image1 = images.find { |i| cp.n1 == i.id }
606
- image2 = images.find { |i| cp.n2 == i.id }
607
- point1 = image1.to_cartesian(cp.x1, cp.y1)
608
- point2 = image2.to_cartesian(cp.x2, cp.y2)
609
-
610
- angle = Math.acos(point1[0] * point2[0] + point1[1] * point2[1] + point1[2] * point2[2])
611
- radius = (panorama_variable.w / 2.0) / Math.tan((panorama_variable.v * Math::PI / 180) / 2)
612
-
613
- x1 = (image1.w / 2.0) - cp.x1 + image1.d
614
- y1 = (image1.h / 2.0) - cp.y1 + image1.e
615
- x2 = (image2.w / 2.0) - cp.x2 + image2.d
616
- y2 = (image2.h / 2.0) - cp.y2 + image2.e
617
-
618
- dist = Math.sqrt((x1 - x2)**2 + (y1 - y2)**2)
619
-
620
- dr = angle * radius
621
-
622
- type = image1.d == image2.d ? :vertical : :horizontal
623
- logger.debug "#{cp.to_s.sub(/\n/, '')} dist #{dr} pixel_dist #{x1-x2},#{y1-y2},#{dist} type #{type}"
602
+ logger.debug "#{cp.to_s.sub(/\n/, '')} dist #{cp.dist} pixel_dist #{cp.px},#{cp.py},#{cp.pdist} conn_type #{cp.conn_type}"
624
603
  end
625
604
  end
626
605
 
@@ -1,3 +1,3 @@
1
1
  module Panomosity
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panomosity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Garcia
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-23 00:00:00.000000000 Z
11
+ date: 2018-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  requirements: []
104
104
  rubyforge_project:
105
- rubygems_version: 2.7.3
105
+ rubygems_version: 2.4.6
106
106
  signing_key:
107
107
  specification_version: 4
108
108
  summary: Wrapper for the PTO file parsing needed for PanoTools.