Permalink
Browse files

make the script more ruby

  • Loading branch information...
1 parent ef3105d commit 1ebc10bd66f398ee868a5780ca86c7b7f68a8150 @liuliu committed Oct 29, 2010
Showing with 10 additions and 10 deletions.
  1. +3 −3 bin/siftdraw.rb
  2. +6 −6 bin/validator.rb
  3. +1 −1 doc/bbf.md
View
@@ -18,8 +18,8 @@
image_size = {:width => image_size[0].to_i, :height => image_size[1].to_i}
else
if matches.nil?
- pairs.push({:object => {:x => args[0].to_f, :y => args[1].to_f},
- :image => {:x => args[3].to_f, :y => args[4].to_f}})
+ pairs << {:object => {:x => args[0].to_f, :y => args[1].to_f},
+ :image => {:x => args[3].to_f, :y => args[4].to_f}}
else
matches.puts args[0] + " " + args[1] + " " + args[3] + " " + args[4] + "\n"
end
@@ -54,7 +54,7 @@
x = h[0][0] * point[:x] + h[0][1] * point[:y] + h[0][2]
y = h[1][0] * point[:x] + h[1][1] * point[:y] + h[1][2]
z = h[2][0] * point[:x] + h[2][1] * point[:y] + h[2][2]
- frame.push({:x => x / z, :y => y / z})
+ frame << {:x => x / z, :y => y / z}
end
%x[#{sprintf("convert %s -stroke red -strokewidth 3 -draw \"line %d,%d,%d,%d\" -draw \"line %d,%d,%d,%d\" -draw \"line %d,%d,%d,%d\" -draw \"line %d,%d,%d,%d\" %s", ARGV[1], frame[0][:x], frame[0][:y], frame[1][:x], frame[1][:y], frame[1][:x], frame[1][:y], frame[2][:x], frame[2][:y], frame[2][:x], frame[2][:y], frame[3][:x], frame[3][:y], frame[3][:x], frame[3][:y], frame[0][:x], frame[0][:y], ARGV[2])}]
end
View
@@ -9,12 +9,12 @@
args = line.split(" ")
name = args[0].split(".")[0].downcase
truth[name] = Array.new if truth[name].nil?
- truth[name].push({:left_eye => {:x => args[1].to_f, :y => args[2].to_f},
- :right_eye => {:x => args[3].to_f, :y => args[4].to_f},
- :nose => {:x => args[5].to_f, :y => args[6].to_f},
- :left_mouth => {:x => args[7].to_f, :y => args[8].to_f},
- :center_mouth => {:x => args[9].to_f, :y => args[10].to_f},
- :right_mouth => {:x => args[11].to_f, :y => args[12].to_f}})
+ truth[name] << {:left_eye => {:x => args[1].to_f, :y => args[2].to_f},
+ :right_eye => {:x => args[3].to_f, :y => args[4].to_f},
+ :nose => {:x => args[5].to_f, :y => args[6].to_f},
+ :left_mouth => {:x => args[7].to_f, :y => args[8].to_f},
+ :center_mouth => {:x => args[9].to_f, :y => args[10].to_f},
+ :right_mouth => {:x => args[11].to_f, :y => args[12].to_f}}
total += 1
end
View
@@ -78,7 +78,7 @@ information, for me, it is:
Suppose you have copied the ground truth to truth.txt file, run the validator:
- ./validator.rb truth.txt result
+ ./validator.rb truth.txt result.txt
My result for bbfdetect is:

0 comments on commit 1ebc10b

Please sign in to comment.