pano 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/bin/pntool CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'pano'
3
+ require "bundler/setup"
4
4
  require 'fileutils'
5
5
 
6
6
  set = Pano::ImageFileSet.new FileUtils.pwd
@@ -1,5 +1,5 @@
1
1
  require 'JSON'
2
- require 'active_support'
2
+ require 'active_support/core_ext/object'
3
3
 
4
4
  TOOL_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
5
5
 
@@ -1,4 +1,5 @@
1
1
  require 'fileutils'
2
+ require 'active_support'
2
3
 
3
4
  module Pano
4
5
  module Image
@@ -7,10 +7,10 @@ module Pano
7
7
  def initialize path
8
8
  if path =~ /\.jpg$/i
9
9
  @jpg_path = path
10
- @raw_path = path.sub(/\.jpg$/i, ".CR2")
10
+ @raw_path = path.sub(/\.jpg$/i, ".NEF")
11
11
  else
12
12
  @raw_path = path
13
- @jpg_path = path.sub(/\.cr2$/i, ".JPG")
13
+ @jpg_path = path.sub(/\.nef$/i, ".JPG")
14
14
  end
15
15
 
16
16
  if File.exist?(@jpg_path)
@@ -23,16 +23,11 @@ module Pano
23
23
  end
24
24
 
25
25
  def for_pano?
26
- @for_pano ||= @info[:fov] > 95 && @info["SelfTimer"] == "2 s" && @info["Orientation"] == "Rotate 270 CW"
26
+ @for_pano ||= @info[:fov] > 95 && bracketed?
27
27
  end
28
28
 
29
29
  def bracketed?
30
- @bracketed ||= @info["BracketMode"] == "AEB" && @info["BracketShotNumber"] == 0
31
- end
32
-
33
- def bracketing_number
34
- b = @info["BracketValue"]
35
- b == 0 ? 0 : b < 0 ? 1 : 2
30
+ @bracketed ||= @info["ShootingMode"] =~ /Bracketing/i
36
31
  end
37
32
 
38
33
  def list_info
@@ -46,7 +41,7 @@ module Pano
46
41
  end
47
42
 
48
43
  def copy_to dest_dir
49
- FileUtils.mkpath dest_dir;
44
+ FileUtils.mkpath dest_dir
50
45
  FileUtils.cp(@raw_path, dest_dir) if File.exist?(@raw_path)
51
46
  FileUtils.cp(@jpg_path, dest_dir) if File.exist?(@jpg_path)
52
47
  end
@@ -2,6 +2,7 @@ module Pano
2
2
 
3
3
  class ImageFileSet
4
4
 
5
+ BRACKETS = 5
5
6
  attr_reader :base_path, :files
6
7
 
7
8
  def initialize dir_path
@@ -19,7 +20,7 @@ module Pano
19
20
  while i < @files.length
20
21
  file = @files[i]
21
22
  if file.for_pano?
22
- if pano.length < 13 * 3
23
+ if pano.length < 13 * BRACKETS
23
24
  pano << file
24
25
  else
25
26
  last = pano.last
@@ -54,7 +55,7 @@ module Pano
54
55
  file.copy_to pano_dir
55
56
  end
56
57
  i = 0
57
- pano.each_slice(3) do |files|
58
+ pano.each_slice(BRACKETS) do |files|
58
59
  i+=1
59
60
  fused = enfuse(File.join(pano_dir, "fused"), "%02d" % i, files)
60
61
  if apply_mask
@@ -84,13 +85,14 @@ module Pano
84
85
  def enfuse dir, name, files = []
85
86
  return if files.blank?
86
87
  FileUtils.mkpath dir
87
- contrast_weight = 0.6
88
- entropy_weight = 0.4
89
- exposure_weight = 0.5
90
- saturation_weight = 0.2
88
+ # contrast_weight = 0.6
89
+ # entropy_weight = 0.4
90
+ # exposure_weight = 0.5
91
+ # saturation_weight = 0.2
91
92
  target = File.join(dir, name + ".tif")
92
93
  input = files.map {|file| file.jpg_path }.join(" ")
93
- options = "--contrast-weight=#{contrast_weight} --entropy-weight=#{entropy_weight} --exposure-weight=#{exposure_weight} --saturation-weight=#{saturation_weight} --compression=LZW"
94
+ #options = "--contrast-weight=#{contrast_weight} --entropy-weight=#{entropy_weight} --exposure-weight=#{exposure_weight} --saturation-weight=#{saturation_weight} --compression=LZW"
95
+ options = "--compression=LZW"
94
96
  system "enfuse #{options} -o #{target} #{input}"
95
97
 
96
98
  target
@@ -0,0 +1,3 @@
1
+ module Pano
2
+ VERSION = "0.0.7"
3
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 6
9
- version: 0.0.6
8
+ - 7
9
+ version: 0.0.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Yury Korolev
@@ -16,21 +16,8 @@ cert_chain: []
16
16
 
17
17
  date: 2009-12-28 00:00:00 +03:00
18
18
  default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: activesupport
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 2
29
- - 3
30
- - 5
31
- version: 2.3.5
32
- type: :runtime
33
- version_requirements: *id001
19
+ dependencies: []
20
+
34
21
  description: Split and fuse images for pano
35
22
  email:
36
23
  - yury.korolev@gmail.com
@@ -44,12 +31,13 @@ files:
44
31
  - lib/pano/image.rb
45
32
  - lib/pano/image_file.rb
46
33
  - lib/pano/image_file_set.rb
34
+ - lib/pano/version.rb
47
35
  - lib/pano.rb
48
36
  - bin/pntool
49
37
  - lib/mask.png
50
38
  - lib/mask_last.png
51
39
  has_rdoc: true
52
- homepage: http://anjlab.com
40
+ homepage: http://github.com/yury/pano
53
41
  licenses: []
54
42
 
55
43
  post_install_message:
@@ -58,6 +46,7 @@ rdoc_options: []
58
46
  require_paths:
59
47
  - lib
60
48
  required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
61
50
  requirements:
62
51
  - - ">="
63
52
  - !ruby/object:Gem::Version
@@ -65,20 +54,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
65
54
  - 0
66
55
  version: "0"
67
56
  required_rubygems_version: !ruby/object:Gem::Requirement
57
+ none: false
68
58
  requirements:
69
59
  - - ">="
70
60
  - !ruby/object:Gem::Version
71
61
  segments:
72
62
  - 1
73
63
  - 3
74
- - 5
75
- version: 1.3.5
64
+ - 6
65
+ version: 1.3.6
76
66
  requirements: []
77
67
 
78
- rubyforge_project:
79
- rubygems_version: 1.3.6
68
+ rubyforge_project: rubyfish
69
+ rubygems_version: 1.3.7
80
70
  signing_key:
81
71
  specification_version: 3
82
- summary: "\"Just prepare photos for pano\""
72
+ summary: Just prepare photos for pano
83
73
  test_files: []
84
74