Sha256: 905392e9bdf2b4e2ce959d89dbe4331af323a26a66490e4e40d5b25409c1bdb4

Contents?: true

Size: 535 Bytes

Versions: 3

Compression:

Stored size: 535 Bytes

Contents

require 'dlib'

image_file = ARGV[0] || 'ext/dlib-18.13/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

3 entries across 3 versions & 1 rubygems

Version Path
dlib-1.0.3 examples/find_candidate_object_locations.rb
dlib-1.0.2 examples/find_candidate_object_locations.rb
dlib-1.0.1 examples/find_candidate_object_locations.rb