panomosity 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a24ffd1b51c93f06e28be5531393d9ef4fa2390dfabc1a3a0cebd92e0fe8ea2
4
- data.tar.gz: 6f01ff9088ce77b29b1d0b75c7ecc419962fa81b988d3b8c41b4f13a4ff29d61
3
+ metadata.gz: 55acfc2af5503c105113d6f4b22464b2052915ebc265f64369f28a37733cd811
4
+ data.tar.gz: 7edea562a3ecd287ee4ec60bc209636d7494b52be234d2edb106b016b5d749fc
5
5
  SHA512:
6
- metadata.gz: d8ce529cfbcfc347df7ff571a585d4f081ed35cc0c7ac7890f613a0d7e83a0da58d2c6cf5656571690eef8d793f65eb50277fd886763fbad34bc74f4e50c7ec9
7
- data.tar.gz: 43f8377b355628dc3b896deec813be6c56ca6969d1c9f7731e774ca08abe01bd5694d66ac87e4a63ceefde84e787e262e50624fea73574312e92336492a9a38b
6
+ metadata.gz: 227237855e4a0c4e38282837fed553b7add73ffd92d439bbf8a3678196589b0bd91b36c013e415a27e4699fc94f97fbe56fc946b3d5c94486eae1e9edf920ec5
7
+ data.tar.gz: 40b14486b54d7efaf753943c1886bb147a2646b6f10e6ea5e75907c575367db27ce3ad22e0a36a06178ee27160a126f4f16b0d623e2cb47a68ae465748438825
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- panomosity (0.1.0)
4
+ panomosity (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env perl
2
+
3
+ use strict;
4
+ use warnings;
5
+ use Panotools::Script;
6
+ use Getopt::Long qw(GetOptions);
7
+ use Data::Dumper;
8
+
9
+ my $pto_file;
10
+ my $control_point;
11
+ GetOptions(
12
+ 'input=s' => \$pto_file,
13
+ 'control_point=s' => \$control_point
14
+ ) or die "Usage: $0 --input PTO_FILE --control_point CONTROL_POINT\n";
15
+
16
+ my $pano = new Panotools::Script;
17
+ $pano->Read ($pto_file);
18
+
19
+ for my $point (@{$pano->Control}) {
20
+ print "@{[$point->Packed]} @{[$point->Distance($pano)]}\n";
21
+ }
@@ -31,7 +31,7 @@ module Panomosity
31
31
  end
32
32
 
33
33
  def self.get_detailed_info(pto_file_path, cp_type: nil)
34
- result = `perl control_point_info.pl --input #{pto_file_path}`
34
+ result = `control_point_info.pl --input #{pto_file_path}`
35
35
  parse(result, cp_type: cp_type, compact: true)
36
36
  end
37
37
 
@@ -11,10 +11,11 @@ module Panomosity
11
11
  convert_translation_parameters
12
12
  crop_centers
13
13
  fix_conversion_errors
14
+ fix_unconnected_image_pairs
14
15
  generate_border_line_control_points
16
+ get_detailed_control_point_info
15
17
  merge_image_parameters
16
18
  prepare_for_pr0ntools
17
- remove_long_lines
18
19
  remove_anchor_variables
19
20
  standardize_roll
20
21
  )
@@ -216,6 +217,12 @@ module Panomosity
216
217
  save_file
217
218
  end
218
219
 
220
+ def fix_unconnected_image_pairs
221
+ logger.info 'fixing unconnected image pairs'
222
+ images = Image.parse(@input_file)
223
+
224
+ end
225
+
219
226
  def generate_border_line_control_points
220
227
  logger.info 'generating border line control points'
221
228
  images = Image.parse(@input_file)
@@ -340,6 +347,22 @@ module Panomosity
340
347
  save_file
341
348
  end
342
349
 
350
+ def get_detailed_control_point_info
351
+ logger.info 'removing long lines'
352
+
353
+ images = Image.parse(@input_file)
354
+ control_points = ControlPoint.get_detailed_info(@input, cp_type: :normal)
355
+ control_points.each do |cp|
356
+ image1 = images.find { |i| cp.n1 == i.id }
357
+ image2 = images.find { |i| cp.n2 == i.id }
358
+ # dist = ((image1.normal_x + cp.x1) - (image2.normal_x + cp.x2)) ** 2 + ((image1.normal_y + cp.y1) - (image2.normal_y + cp.y2)) ** 2
359
+ dx = (image1.d - cp.x1) - (image2.d - cp.x2)
360
+ dy = (image1.e - cp.y1) - (image2.e - cp.y2)
361
+ logger.debug "#{cp.to_s} distrt #{Math.sqrt(dx**2+dy**2)} iy1 #{image1.normal_y} iy2 #{image2.normal_y}"
362
+ end
363
+ logger.debug "avg #{control_points.map(&:dist).reduce(:+)/control_points.count.to_f}"
364
+ end
365
+
343
366
  def merge_image_parameters
344
367
  logger.info 'merging image parameters'
345
368
  control_points = ControlPoint.parse(@compare_file)
@@ -414,22 +437,6 @@ module Panomosity
414
437
  save_file
415
438
  end
416
439
 
417
- def remove_long_lines
418
- logger.info 'removing long lines'
419
-
420
- images = Image.parse(@input_file)
421
- control_points = ControlPoint.get_detailed_info(@input, cp_type: :normal)
422
- control_points.each do |cp|
423
- image1 = images.find { |i| cp.n1 == i.id }
424
- image2 = images.find { |i| cp.n2 == i.id }
425
- # dist = ((image1.normal_x + cp.x1) - (image2.normal_x + cp.x2)) ** 2 + ((image1.normal_y + cp.y1) - (image2.normal_y + cp.y2)) ** 2
426
- dx = (image1.d - cp.x1) - (image2.d - cp.x2)
427
- dy = (image1.e - cp.y1) - (image2.e - cp.y2)
428
- logger.debug "#{cp.to_s} distrt #{Math.sqrt(dx**2+dy**2)} iy1 #{image1.normal_y} iy2 #{image2.normal_y}"
429
- end
430
- logger.debug "avg #{control_points.map(&:dist).reduce(:+)/control_points.count.to_f}"
431
- end
432
-
433
440
  def standardize_roll
434
441
  logger.info 'standardizing roll'
435
442
  images = Image.parse(@input_file)
@@ -1,3 +1,3 @@
1
1
  module Panomosity
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  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.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Garcia
@@ -56,6 +56,7 @@ description: Custom scripts to help with PTO parsing and different strategies.
56
56
  email:
57
57
  - ogarci5@gmail.com
58
58
  executables:
59
+ - control_point_info.pl
59
60
  - panomosity
60
61
  extensions: []
61
62
  extra_rdoc_files: []
@@ -71,6 +72,7 @@ files:
71
72
  - Rakefile
72
73
  - bin/console
73
74
  - bin/setup
75
+ - exe/control_point_info.pl
74
76
  - exe/panomosity
75
77
  - lib/panomosity.rb
76
78
  - lib/panomosity/control_point.rb