panomosity 0.1.23 → 0.1.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/exe/diagnosity +5 -0
- data/lib/panomosity/neighborhood_group.rb +16 -2
- data/lib/panomosity/pair.rb +2 -0
- data/lib/panomosity/panorama.rb +43 -1
- data/lib/panomosity/runner.rb +9 -1
- data/lib/panomosity/version.rb +1 -1
- data/lib/panomosity.rb +4 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f704a392239564cf8f6044105a0194af7188c2fa38c3ba1f0d50dfd5fd2c4fe
|
4
|
+
data.tar.gz: 8c4791a5f3f410c0bb92b8fe0134ec4fc472aa057c1f1aa586ef4b9a1a990b1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9f0bacac4a47b8e20d161bffe87a8c2494339ffebe0df3b5851a687e21c098c98744b9227f230424e993445034e4d36c30e785a208a9c56360c590f927a4df7
|
7
|
+
data.tar.gz: e219691995299477b7cfc0fa747152d21ad160a48abbf7e214943405dc99fdbc14353f3f1de4dccf3b2c64d73bdd0e59b7275b724876cc63d48c0728f1bdcced
|
data/Gemfile.lock
CHANGED
data/exe/diagnosity
ADDED
@@ -99,11 +99,25 @@ module Panomosity
|
|
99
99
|
def calculate
|
100
100
|
@neighborhoods = total_neighborhoods.select { |n| (n.prdist_avg - center.prdist_avg).abs <= center.prdist_std }
|
101
101
|
@control_points = neighborhoods.map(&:control_points_within_std).flatten.uniq(&:raw)
|
102
|
-
@x_avg = calculate_average(values: control_points.map(&:
|
103
|
-
@y_avg = calculate_average(values: control_points.map(&:
|
102
|
+
@x_avg = calculate_average(values: control_points.map(&:prx))
|
103
|
+
@y_avg = calculate_average(values: control_points.map(&:pry))
|
104
104
|
@prdist_avg = center.prdist_avg
|
105
105
|
@prdist_std = center.prdist_std
|
106
106
|
self
|
107
107
|
end
|
108
|
+
|
109
|
+
def serialize
|
110
|
+
delta_cp_x = calculate_average(values: control_points.map { |cp| cp.x2 - cp.x1 })
|
111
|
+
delta_cp_y = calculate_average(values: control_points.map { |cp| cp.y2 - cp.y1 })
|
112
|
+
{
|
113
|
+
x_avg: x_avg,
|
114
|
+
y_avg: y_avg,
|
115
|
+
prdist_avg: prdist_avg,
|
116
|
+
prdist_std: prdist_std,
|
117
|
+
cp_count: control_points.count,
|
118
|
+
delta_cp_x: delta_cp_x,
|
119
|
+
delta_cp_y: delta_cp_y
|
120
|
+
}
|
121
|
+
end
|
108
122
|
end
|
109
123
|
end
|
data/lib/panomosity/pair.rb
CHANGED
@@ -50,6 +50,7 @@ module Panomosity
|
|
50
50
|
next if column == columns.last
|
51
51
|
image_1 = images.find { |i| i.row == row && i.column == column }
|
52
52
|
image_2 = images.find { |i| i.row == row && i.column == column.next }
|
53
|
+
next if @panorama.calibration? && (image_1.nil? || image_2.nil?)
|
53
54
|
control_points = @panorama.control_points.select { |cp| [cp.n1, cp.n2].sort == [image_1.id, image_2.id].sort }
|
54
55
|
@pairs << Pair.new([image_1, image_2].sort_by(&:id), control_points: control_points, type: :horizontal)
|
55
56
|
end
|
@@ -61,6 +62,7 @@ module Panomosity
|
|
61
62
|
next if row == rows.last
|
62
63
|
image_1 = images.find { |i| i.column == column && i.row == row }
|
63
64
|
image_2 = images.find { |i| i.column == column && i.row == row.next }
|
65
|
+
next if @panorama.calibration? && (image_1.nil? || image_2.nil?)
|
64
66
|
control_points = @panorama.control_points.select { |cp| [cp.n1, cp.n2].sort == [image_1.id, image_2.id].sort }
|
65
67
|
@pairs << Pair.new([image_1, image_2].sort_by(&:id), control_points: control_points, type: :vertical)
|
66
68
|
end
|
data/lib/panomosity/panorama.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module Panomosity
|
2
4
|
class Panorama
|
3
5
|
include Panomosity::Utils
|
@@ -147,13 +149,21 @@ module Panomosity
|
|
147
149
|
Pair.calculate_neighborhood_groups
|
148
150
|
|
149
151
|
recommendations = []
|
152
|
+
messages = []
|
150
153
|
|
151
154
|
logger.debug "total number of control points: #{control_points.count}"
|
152
155
|
logger.debug "total number of generated control points: #{control_points.select(&:generated?).count}"
|
153
156
|
logger.debug "total number of not generated control points: #{control_points.select(&:not_generated?).count}"
|
154
157
|
|
155
158
|
control_point_pair_ratio = Pair.without_enough_control_points(ignore_connected: true).count.to_f / Pair.all.count
|
156
|
-
|
159
|
+
if control_point_pair_ratio >= 0.5
|
160
|
+
message = <<~MESSAGE
|
161
|
+
More than 50% (#{(control_point_pair_ratio*100).round(4)}%) of pairs have fewer than 3 control points.
|
162
|
+
May potentially cause issues.
|
163
|
+
MESSAGE
|
164
|
+
logger.warn message
|
165
|
+
messages << message
|
166
|
+
end
|
157
167
|
|
158
168
|
control_point_generated_ratio = control_points.select(&:generated?).count.to_f / control_points.select(&:not_generated?).count
|
159
169
|
if control_point_generated_ratio >= 0.3
|
@@ -162,6 +172,7 @@ module Panomosity
|
|
162
172
|
This indicates a failure to find control points between images pairs due to poor lighting or insufficient complexity.
|
163
173
|
MESSAGE
|
164
174
|
logger.warn message
|
175
|
+
messages << message
|
165
176
|
end
|
166
177
|
|
167
178
|
# neighborhood group tests
|
@@ -172,6 +183,7 @@ module Panomosity
|
|
172
183
|
This can mean either low variation in control points distances or that not enough control points could be found.
|
173
184
|
MESSAGE
|
174
185
|
logger.warn message
|
186
|
+
messages << message
|
175
187
|
end
|
176
188
|
|
177
189
|
group_std_avg = calculate_average(values: NeighborhoodGroup.horizontal[0..4].map(&:prdist_std))
|
@@ -184,6 +196,7 @@ module Panomosity
|
|
184
196
|
This also means that the images may represent a 3D object that has perspective differences.
|
185
197
|
MESSAGE
|
186
198
|
logger.warn message
|
199
|
+
messages << message
|
187
200
|
end
|
188
201
|
|
189
202
|
group_control_points = NeighborhoodGroup.horizontal.first.control_points.count
|
@@ -197,6 +210,7 @@ module Panomosity
|
|
197
210
|
There will very likely be seams horizontally.
|
198
211
|
MESSAGE
|
199
212
|
logger.warn message
|
213
|
+
messages << message
|
200
214
|
recommendations << 'horizontal'
|
201
215
|
end
|
202
216
|
|
@@ -207,6 +221,7 @@ module Panomosity
|
|
207
221
|
This can mean either low variation in control points distances or that not enough control points could be found.
|
208
222
|
MESSAGE
|
209
223
|
logger.warn message
|
224
|
+
messages << message
|
210
225
|
end
|
211
226
|
|
212
227
|
group_std_avg = calculate_average(values: NeighborhoodGroup.vertical[0..4].map(&:prdist_std))
|
@@ -219,6 +234,7 @@ module Panomosity
|
|
219
234
|
This also means that the images may represent a 3D object that has perspective differences.
|
220
235
|
MESSAGE
|
221
236
|
logger.warn message
|
237
|
+
messages << message
|
222
238
|
end
|
223
239
|
|
224
240
|
group_control_points = NeighborhoodGroup.vertical.first.control_points.count
|
@@ -235,6 +251,28 @@ module Panomosity
|
|
235
251
|
recommendations << 'vertical'
|
236
252
|
end
|
237
253
|
|
254
|
+
logger.info 'creating diagnostic_report.json'
|
255
|
+
|
256
|
+
pair = Pair.horizontal.first
|
257
|
+
delta_d = pair.first_image.d - pair.last_image.d
|
258
|
+
roll = pair.first_image.r
|
259
|
+
pair = Pair.vertical.first
|
260
|
+
delta_e = pair.first_image.e - pair.last_image.e
|
261
|
+
|
262
|
+
diagnostic_report = {
|
263
|
+
messages: messages,
|
264
|
+
recommendations: recommendations,
|
265
|
+
data: {
|
266
|
+
delta_d: delta_d,
|
267
|
+
delta_e: delta_e,
|
268
|
+
roll: roll,
|
269
|
+
horizontal: NeighborhoodGroup.horizontal.first.serialize,
|
270
|
+
vertical: NeighborhoodGroup.vertical.first.serialize
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
File.open('diagnostic_report.json', 'w+') { |f| f.puts diagnostic_report.to_json }
|
275
|
+
|
238
276
|
if recommendations.empty?
|
239
277
|
logger.warn 'No recommendations'
|
240
278
|
puts 'none'
|
@@ -243,5 +281,9 @@ module Panomosity
|
|
243
281
|
puts recommendations.join(',')
|
244
282
|
end
|
245
283
|
end
|
284
|
+
|
285
|
+
def calibration?
|
286
|
+
!!@input.split(/\n/).find { |line| '#panomosity calibration true' }
|
287
|
+
end
|
246
288
|
end
|
247
289
|
end
|
data/lib/panomosity/runner.rb
CHANGED
@@ -7,6 +7,7 @@ module Panomosity
|
|
7
7
|
attr_reader :logger
|
8
8
|
|
9
9
|
AVAILABLE_COMMANDS = %w(
|
10
|
+
add_calibration_flag
|
10
11
|
check_position_changes
|
11
12
|
clean_control_points
|
12
13
|
convert_equaled_image_parameters
|
@@ -34,10 +35,11 @@ module Panomosity
|
|
34
35
|
@output = options[:output]
|
35
36
|
@csv = options[:csv]
|
36
37
|
@compare = options[:compare]
|
38
|
+
@report = options[:report]
|
37
39
|
@input_file = File.new(@input, 'r').read rescue puts('You must have at least one argument')
|
38
40
|
@output_file = File.new(@output, 'w') if @output
|
39
41
|
@csv_file = File.new(@csv, 'r').read if @csv
|
40
|
-
@
|
42
|
+
@report_file = File.new(@report, 'r').read if @report
|
41
43
|
@logger = Panomosity.logger
|
42
44
|
|
43
45
|
if options[:verbose] || options[:verbosity] > 0
|
@@ -55,6 +57,12 @@ module Panomosity
|
|
55
57
|
end
|
56
58
|
end
|
57
59
|
|
60
|
+
def add_calibration_flag
|
61
|
+
logger.info 'adding panomosity calibration flag'
|
62
|
+
@lines = @input_file.each_line.map { |line| line } + ["#panomosity calibration true\n"]
|
63
|
+
save_file
|
64
|
+
end
|
65
|
+
|
58
66
|
def check_position_changes
|
59
67
|
logger.info 'checking position changes'
|
60
68
|
original_images = Image.parse(@input_file)
|
data/lib/panomosity/version.rb
CHANGED
data/lib/panomosity.rb
CHANGED
@@ -38,6 +38,10 @@ module Panomosity
|
|
38
38
|
options[:compare] = pto
|
39
39
|
end
|
40
40
|
|
41
|
+
parser.on('-r', '--report [REPORT]', 'Include a report (when adding calibration control points)') do |report|
|
42
|
+
options[:report] = report
|
43
|
+
end
|
44
|
+
|
41
45
|
parser.on('--without-cropping', 'Do not crop when running "crop_centers" (usually when the original run failed)') do |wc|
|
42
46
|
options[:without_cropping] = wc
|
43
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Garcia
|
@@ -57,6 +57,7 @@ email:
|
|
57
57
|
- ogarci5@gmail.com
|
58
58
|
executables:
|
59
59
|
- control_point_info.pl
|
60
|
+
- diagnosity
|
60
61
|
- panomosity
|
61
62
|
extensions: []
|
62
63
|
extra_rdoc_files: []
|
@@ -72,6 +73,7 @@ files:
|
|
72
73
|
- bin/console
|
73
74
|
- bin/setup
|
74
75
|
- exe/control_point_info.pl
|
76
|
+
- exe/diagnosity
|
75
77
|
- exe/panomosity
|
76
78
|
- lib/panomosity.rb
|
77
79
|
- lib/panomosity/control_point.rb
|