Skip to content

Commit

Permalink
make the script more ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliu committed Oct 29, 2010
1 parent ef3105d commit 1ebc10b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions bin/siftdraw.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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
12 changes: 6 additions & 6 deletions bin/validator.rb
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion doc/bbf.md
Expand Up @@ -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:

Expand Down

0 comments on commit 1ebc10b

Please sign in to comment.