Skip to content

Commit

Permalink
now bbfdetect can draw out the image with draw.rb script
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliu committed Oct 23, 2010
1 parent 874ac24 commit e2d05df
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/bbfdetect.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ int main(int argc, char** argv)
{
unsigned int elapsed_time = get_current_time();
ccv_array_t* seq = ccv_bbf_detect_objects(image, &cascade, 1, 5, 2, 0, ccv_size(24, 24));
printf("elpased time : %d\n", get_current_time() - elapsed_time);
elapsed_time = get_current_time() - elapsed_time;
for (i = 0; i < seq->rnum; i++)
{
ccv_bbf_comp_t* comp = (ccv_bbf_comp_t*)ccv_array_get(seq, i);
printf("%d %d %d %d %f\n", comp->rect.x, comp->rect.y, comp->rect.width, comp->rect.height, comp->confidence);
}
printf("total : %d\n", seq->rnum);
printf("total : %d in time %dms\n", seq->rnum, elapsed_time);
ccv_array_free(seq);
ccv_matrix_free(image);
ccv_garbage_collect();
Expand Down
17 changes: 17 additions & 0 deletions bin/draw.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env ruby

exit unless ARGV.length == 2

rect = ""
STDIN.each_line do |line|
print line
args = line.split(" ")
break if args[0] == 'total'
x = args[0].to_f
y = args[1].to_f
width = args[2].to_f
height = args[3].to_f
rect += sprintf("-draw \"rectangle %d,%d,%d,%d\" ", x, y, x + width, y + height)
end

system(sprintf("convert %s -fill none -stroke red -strokewidth 3 %s%s", ARGV[0], rect, ARGV[1]))

0 comments on commit e2d05df

Please sign in to comment.