panomosity 0.1.8 → 0.1.9
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/control_point.rb +12 -4
- data/lib/panomosity/runner.rb +6 -5
- 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
|
+
SHA256:
|
3
|
+
metadata.gz: f9429ab38b6928e5b0e731cdedbeeab3e95afba20549ee2acb01c3ee0afda0bf
|
4
|
+
data.tar.gz: 2aa31fef07b269239cfd09bd4e877f5d897caf7f09eef1c13079564b293e4fa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c594323f23c9e778737b6a309cce0b006f9e64c500f978075ab9da6e7fec5448df780a90fd4332b0562ccffb597261397e31fdaaa2bae7315009c15a60e6a1f
|
7
|
+
data.tar.gz: 0a1e815356032d427326cecce3ee4668dbbad3b806499854088bf27c061919f075015d5ebf08c379294f3c63a723b765180461720453c62fee31c05d16b70510
|
data/Gemfile.lock
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
module Panomosity
|
5
5
|
class ControlPoint
|
6
6
|
@@attributes = %i(n N x y X Y t)
|
7
|
-
@@calculated_attributes = %i(dist px py pdist conn_type)
|
7
|
+
@@calculated_attributes = %i(dist px py pdist prx pry prdist conn_type i1 i2)
|
8
8
|
|
9
9
|
def self.parse(pto_file, cp_type: nil, compact: false)
|
10
10
|
@control_points = pto_file.each_line.map do |line|
|
@@ -55,7 +55,7 @@ module Panomosity
|
|
55
55
|
distance = angle * radius
|
56
56
|
cp.dist = distance
|
57
57
|
|
58
|
-
#
|
58
|
+
# pixel distance
|
59
59
|
x1 = (image1.w / 2.0) - cp.x1 + image1.d
|
60
60
|
y1 = (image1.h / 2.0) - cp.y1 + image1.e
|
61
61
|
x2 = (image2.w / 2.0) - cp.x2 + image2.d
|
@@ -63,9 +63,17 @@ module Panomosity
|
|
63
63
|
|
64
64
|
cp.px = x1 - x2
|
65
65
|
cp.py = y1 - y2
|
66
|
-
|
67
|
-
|
66
|
+
cp.pdist = Math.sqrt(cp.px ** 2 + cp.py ** 2)
|
67
|
+
|
68
|
+
# pixel distance including roll
|
69
|
+
r = image1.r * Math::PI / 180
|
70
|
+
cp.prx = image1.d - image2.d + Math.cos(r) * (cp.x2 - cp.x1) - Math.sin(r) * (cp.y2 - cp.y1)
|
71
|
+
cp.pry = image1.e - image2.e + Math.cos(r) * (cp.y2 - cp.y1) - Math.sin(r) * (cp.x2 - cp.x1)
|
72
|
+
cp.prdist = Math.sqrt(cp.prx ** 2 + cp.pry ** 2)
|
73
|
+
|
68
74
|
cp.conn_type = image1.d == image2.d ? :vertical : :horizontal
|
75
|
+
cp.i1 = image1
|
76
|
+
cp.i2 = image2
|
69
77
|
end
|
70
78
|
end
|
71
79
|
|
data/lib/panomosity/runner.rb
CHANGED
@@ -192,13 +192,14 @@ module Panomosity
|
|
192
192
|
# Uses image magick to crop centers
|
193
193
|
def crop_centers
|
194
194
|
logger.info 'cropping centers'
|
195
|
-
scale_factor = @
|
195
|
+
scale_factor = @csv_file.split(/\n/).first.split(',').last.to_f
|
196
|
+
percent = (scale_factor*100).round
|
197
|
+
logger.debug "cropping to #{percent}%"
|
196
198
|
unless @options[:without_cropping]
|
197
199
|
images = Image.parse(@input_file)
|
198
200
|
images.each do |image|
|
199
201
|
geometry = `identify -verbose #{image.name} | grep Geometry`.strip
|
200
202
|
_, width, height = *geometry.match(/(\d{2,5})x(\d{2,5})(\+|\-)\d{1,5}(\+|\-)\d{1,5}/)
|
201
|
-
percent = (scale_factor*100).round
|
202
203
|
width_offset = (width.to_f * (1 - scale_factor) / 2).round
|
203
204
|
height_offset = (height.to_f * (1 - scale_factor) / 2).round
|
204
205
|
logger.debug "cropping #{image.name}"
|
@@ -226,13 +227,13 @@ module Panomosity
|
|
226
227
|
d_diffs = []
|
227
228
|
ds.each_with_index do |_, i|
|
228
229
|
next if i == 0
|
229
|
-
d_diffs.push((ds[i] - ds[i-1]).abs
|
230
|
+
d_diffs.push((ds[i] - ds[i-1]).abs * (1-scale_factor))
|
230
231
|
end
|
231
232
|
|
232
233
|
e_diffs = []
|
233
234
|
es.each_with_index do |_, i|
|
234
235
|
next if i == 0
|
235
|
-
e_diffs.push((es[i] - es[i-1]).abs
|
236
|
+
e_diffs.push((es[i] - es[i-1]).abs * (1-scale_factor))
|
236
237
|
end
|
237
238
|
|
238
239
|
d_map = Hash[ds.map.with_index { |d, i| i == 0 ? [d, d] : [d, d - d_diffs[0..(i-1)].reduce(:+)] }]
|
@@ -599,7 +600,7 @@ module Panomosity
|
|
599
600
|
control_points = ControlPoint.calculate_distances(images, panorama_variable)
|
600
601
|
|
601
602
|
control_points.each do |cp|
|
602
|
-
logger.debug "#{cp.to_s.sub(/\n/, '')} dist #{cp.dist} pixel_dist #{cp.px},#{cp.py},#{cp.pdist} conn_type #{cp.conn_type}"
|
603
|
+
logger.debug "#{cp.to_s.sub(/\n/, '')} dist #{cp.dist.round(4)} pixel_dist #{cp.px.round(4)},#{cp.py.round(4)},#{cp.pdist.round(4)} pixel_r_dist #{cp.prx.round(4)},#{cp.pry.round(4)},#{cp.prdist.round(4)} conn_type #{cp.conn_type}"
|
603
604
|
end
|
604
605
|
end
|
605
606
|
|
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.9
|
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-25 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.7.3
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Wrapper for the PTO file parsing needed for PanoTools.
|