panomosity 0.1.35 → 0.1.36
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/panomosity/runner.rb +49 -0
- data/lib/panomosity/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed12e60dac2b5b41da899dadf401e2c51eaa498508fd78a6d0280d3bb262208f
|
4
|
+
data.tar.gz: 511594cc4b28962db894a9ad399a5e8b81f90808ff1a1ba32de4fab6938a4760
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab3adea770a98b961b048e456dc8a1b88f69cdd11503f4fa4bef201c436d357b1021d0a7b8e16bd48202669f0b0785955be780312b08dcceb224d2bd9f4847b2
|
7
|
+
data.tar.gz: 29ed19c8aabeb5d6c2d9ca784dc7dea1c7f3f7540537735a72bf5e21af55fde8a296ad48cec08b0c0aa36b6d28c74ff0f653ac42d8456d5e9d35b6d379c50972
|
data/Gemfile.lock
CHANGED
data/lib/panomosity/runner.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'logger'
|
2
2
|
require 'json'
|
3
|
+
require 'csv'
|
3
4
|
|
4
5
|
module Panomosity
|
5
6
|
class Runner
|
@@ -18,12 +19,14 @@ module Panomosity
|
|
18
19
|
create_calibration_report
|
19
20
|
crop_centers
|
20
21
|
diagnose
|
22
|
+
export_control_point_csv
|
21
23
|
fix_conversion_errors
|
22
24
|
fix_unconnected_image_pairs
|
23
25
|
generate_border_line_control_points
|
24
26
|
get_columns_and_rows
|
25
27
|
get_control_point_info
|
26
28
|
get_neighborhood_info
|
29
|
+
import_control_point_csv
|
27
30
|
merge_image_parameters
|
28
31
|
nona_grid
|
29
32
|
optimize
|
@@ -289,6 +292,25 @@ module Panomosity
|
|
289
292
|
panorama.diagnose
|
290
293
|
end
|
291
294
|
|
295
|
+
def export_control_point_csv
|
296
|
+
logger.info 'exporting control point csv'
|
297
|
+
panorama = Panorama.new(@input_file, @options)
|
298
|
+
Pair.calculate_neighborhoods(panorama, distance: 30)
|
299
|
+
|
300
|
+
filename = 'control_points.csv'
|
301
|
+
headers = %w(image_1_name image_2_name image_1_id image_2_id type width height d1 e1 d2 e2 x1 y1 x2 y2 rx ry r)
|
302
|
+
CSV.open(filename, 'w+') do |csv|
|
303
|
+
csv << headers
|
304
|
+
panorama.control_points.each do |cp|
|
305
|
+
pair = Pair.all.find { |p| p.control_points.include?(cp) }
|
306
|
+
csv << [cp.i1.name, cp.i2.name, cp.i1.id, cp.i2.id, pair.type, cp.i1.w, cp.i1.h, cp.i1.d, cp.i1.e,
|
307
|
+
cp.i2.d, cp.i2.e, cp.x1, cp.y1, cp.x2, cp.y2, cp.px, cp.py, cp.pdist]
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
logger.info 'Done. Check for control_points.csv'
|
312
|
+
end
|
313
|
+
|
292
314
|
def fix_conversion_errors
|
293
315
|
logger.info 'fixing conversion errors'
|
294
316
|
@lines = @input_file.each_line.map do |line|
|
@@ -459,6 +481,33 @@ module Panomosity
|
|
459
481
|
panorama.get_neighborhood_info
|
460
482
|
end
|
461
483
|
|
484
|
+
def import_control_point_csv
|
485
|
+
logger.info 'importing control point csv'
|
486
|
+
panorama = Panorama.new(@input_file, @options)
|
487
|
+
|
488
|
+
filename = @csv || 'control_points.csv'
|
489
|
+
csv = CSV.read(filename)
|
490
|
+
headers = csv.first
|
491
|
+
csv = csv[1..(csv.length - 1)]
|
492
|
+
data = csv.map { |s| Hash[headers.zip(s)] }
|
493
|
+
|
494
|
+
@lines = @input_file.each_line.map do |line|
|
495
|
+
cp = panorama.control_points.find { |c| c.raw == line }
|
496
|
+
if cp
|
497
|
+
kept_cp = data.find do |d|
|
498
|
+
cp.i1.id == d['image_1_id'].to_i && cp.i2.id == d['image_2_id'].to_i &&
|
499
|
+
cp.x1.round(4) == d['x1'].to_f.round(4) && cp.x2.round(4) == d['x2'].to_f.round(4) &&
|
500
|
+
cp.y1.round(4) == d['y1'].to_f.round(4) && cp.y2.round(4) == d['y2'].to_f.round(4)
|
501
|
+
end
|
502
|
+
cp.to_s if kept_cp
|
503
|
+
else
|
504
|
+
next line
|
505
|
+
end
|
506
|
+
end.compact
|
507
|
+
|
508
|
+
save_file
|
509
|
+
end
|
510
|
+
|
462
511
|
def merge_image_parameters
|
463
512
|
logger.info 'merging image parameters'
|
464
513
|
control_points = ControlPoint.parse(@compare_file)
|
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.36
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|