Sha256: a688937601125df33a5ac7957317dd975628b6002846079cf54ba067540d2f52

Contents?: true

Size: 534 Bytes

Versions: 9

Compression:

Stored size: 534 Bytes

Contents

require 'dlib'

image_file = ARGV[0] || 'ext/dlib-19.4/examples/faces/2009_004587.jpg'
img = Dlib::Image.load(image_file)

rects = Dlib.find_candidate_object_locations(img, min_size: 500)

puts "number of rectangles found #{rects.length}"
rects.each.with_index do |rect, index|
  puts "Detection #{index}: Left: #{rect.left} Top: #{rect.top} Right: #{rect.right} Bottom: #{rect.bottom} Area: #{rect.area}"
  img.draw_rectangle!(rect, [0, 0, 255]) if rect.area > 0
end

output_file = ARGV[1] || 'marked.jpg'
img.save_jpeg(output_file)

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dlib-1.2.2 examples/find_candidate_object_locations.rb
dlib-1.2.1 examples/find_candidate_object_locations.rb
dlib-1.2.0 examples/find_candidate_object_locations.rb
dlib-1.1.5 examples/find_candidate_object_locations.rb
dlib-1.1.4 examples/find_candidate_object_locations.rb
dlib-1.1.3 examples/find_candidate_object_locations.rb
dlib-1.1.2 examples/find_candidate_object_locations.rb
dlib-1.1.1 examples/find_candidate_object_locations.rb
dlib-1.1.0 examples/find_candidate_object_locations.rb