panomosity 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Gemfile.lock +1 -1
- data/lib/panomosity/runner.rb +8 -29
- data/lib/panomosity/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 43fd51dc7dedb7340d1d49debb7988ba41c222a6
|
4
|
+
data.tar.gz: ac8eda0d88511b85458b34bb98828a145dac89de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b653e9c508061364866c37876161d45aee8aa376ebcdbaa4f909342fc6b21e73f8966759eb3b687e8f69be8d4370f0c0c129f0667a93e6dbbe42d28d68499b4e
|
7
|
+
data.tar.gz: 32c89ec697236944332d1928c2793b7b062ddfc52b04b1bb80e0517448808c84bed473709fa4256cde17cdcd3c4433b6a7f61da5b3a1c95b511bd49ba18ad084
|
data/Gemfile.lock
CHANGED
data/lib/panomosity/runner.rb
CHANGED
@@ -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 "
|
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
|
-
|
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
|
-
|
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
|
|
data/lib/panomosity/version.rb
CHANGED
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.
|
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-
|
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.
|
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.
|