panomosity 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/panomosity/runner.rb +50 -7
- 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: 7c4ae12aafbe71dafef734aa8d3cf7135e6b621f
|
4
|
+
data.tar.gz: 75f253b42482a6320150ef4021470892ffcef765
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70e0a23cd375a3448ddbf5ad079eb9d00c8919560151e2ac8e3b6109a28a9be1717bbc075c285c00fc2eff30e60bf7a4be5dd66dc99b354051868d843034d17a
|
7
|
+
data.tar.gz: 67e15c8220e398c9f1b556bac173bcbcc17b8f042b543d707e1c1169f038cc3000f2a95e29be60784b6739ff04e62491574c4ebbed6ad001bbd90ba8280a0ae1
|
data/lib/panomosity/runner.rb
CHANGED
@@ -100,7 +100,7 @@ module Panomosity
|
|
100
100
|
average_y, y_std = *calculate_average_and_std(name: :y, values: cps.map(&:py))
|
101
101
|
|
102
102
|
max_removal = ((@options[:max_removal] || 0.2) * cps.count).floor
|
103
|
-
min_cps =
|
103
|
+
min_cps = 8
|
104
104
|
max_iterations = 10
|
105
105
|
iterations = 0
|
106
106
|
bad_cps = cps.select { |cp| (cp.px - average_x).abs >= x_std || (cp.py - average_y).abs >= y_std }
|
@@ -322,7 +322,10 @@ module Panomosity
|
|
322
322
|
logger.info unconnected_image_pairs.map { |i| { type: i[:type], pair: i[:pair].map(&:id) } }
|
323
323
|
|
324
324
|
logger.info 'finding control points with unrealistic distances (<1)'
|
325
|
-
|
325
|
+
bad_control_points = control_points.select { |cp| cp.pdist <= 1.0 }
|
326
|
+
logger.info 'adding pairs that have do not have enough control points (<3)'
|
327
|
+
changing_control_points_pairs = control_points.group_by { |cp| [cp.n1, cp.n2] }.select { |_, cps| cps.count < 3 }
|
328
|
+
changed_pairs = []
|
326
329
|
|
327
330
|
logger.info 'writing new control points'
|
328
331
|
control_point_lines_started = false
|
@@ -374,9 +377,11 @@ module Panomosity
|
|
374
377
|
end
|
375
378
|
else
|
376
379
|
control_point_lines_started = true
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
+
bad_control_point = bad_control_points.find { |cp| cp.raw == line }
|
381
|
+
changing_control_point_pair = changing_control_points_pairs.find { |_, cps| cps.find { |cp| cp.raw == line } }
|
382
|
+
|
383
|
+
if bad_control_point
|
384
|
+
if bad_control_point.conn_type == :horizontal
|
380
385
|
control_point = horizontal_control_points_of_pair.first
|
381
386
|
else
|
382
387
|
control_point = vertical_control_points_of_pair.first
|
@@ -388,8 +393,8 @@ module Panomosity
|
|
388
393
|
x1 = x_diff <= 0 ? -x_diff + 15 : 0
|
389
394
|
y1 = y_diff <= 0 ? -y_diff + 15 : 0
|
390
395
|
|
391
|
-
control_point[:n] =
|
392
|
-
control_point[:N] =
|
396
|
+
control_point[:n] = bad_control_point[:n]
|
397
|
+
control_point[:N] = bad_control_point[:N]
|
393
398
|
control_point[:x] = x1
|
394
399
|
control_point[:X] = x1 + x_diff
|
395
400
|
control_point[:y] = y1
|
@@ -411,6 +416,44 @@ module Panomosity
|
|
411
416
|
end
|
412
417
|
control_point.to_s
|
413
418
|
end.join
|
419
|
+
elsif changing_control_point_pair && !changed_pairs.include?(changing_control_point_pair.first)
|
420
|
+
changed_pairs << changing_control_point_pair.first
|
421
|
+
bad_control_point = changing_control_point_pair.last.first
|
422
|
+
if bad_control_point.conn_type == :horizontal
|
423
|
+
control_point = horizontal_control_points_of_pair.first
|
424
|
+
else
|
425
|
+
control_point = vertical_control_points_of_pair.first
|
426
|
+
end
|
427
|
+
|
428
|
+
x_diff = control_point.x2 - control_point.x1
|
429
|
+
y_diff = control_point.y2 - control_point.y1
|
430
|
+
|
431
|
+
x1 = x_diff <= 0 ? -x_diff + 15 : 0
|
432
|
+
y1 = y_diff <= 0 ? -y_diff + 15 : 0
|
433
|
+
|
434
|
+
control_point[:n] = bad_control_point[:n]
|
435
|
+
control_point[:N] = bad_control_point[:N]
|
436
|
+
control_point[:x] = x1
|
437
|
+
control_point[:X] = x1 + x_diff
|
438
|
+
control_point[:y] = y1
|
439
|
+
control_point[:Y] = y1 + y_diff
|
440
|
+
|
441
|
+
logger.debug "adding control points connecting #{control_point.n1} <> #{control_point.n2}"
|
442
|
+
i = images.first
|
443
|
+
3.times.map do
|
444
|
+
if control_point.conn_type == :horizontal
|
445
|
+
control_point[:x] += 5
|
446
|
+
control_point[:X] += 5
|
447
|
+
control_point[:y] += i.h * 0.25
|
448
|
+
control_point[:Y] += i.h * 0.25
|
449
|
+
else
|
450
|
+
control_point[:x] += i.w * 0.25
|
451
|
+
control_point[:X] += i.w * 0.25
|
452
|
+
control_point[:y] += 5
|
453
|
+
control_point[:Y] += 5
|
454
|
+
end
|
455
|
+
control_point.to_s
|
456
|
+
end.join
|
414
457
|
else
|
415
458
|
next line
|
416
459
|
end
|
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.6
|
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-23 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.
|