1
0
Fork 0
mirror of https://github.com/ruby-opencv/ruby-opencv synced 2023-03-27 23:22:12 -04:00

Initial commit, with some minor changes from orig (date, exec bit, line endings, /usr/bin/env)

This commit is contained in:
Ryan Baumann 2008-08-19 11:01:28 -04:00
commit 9196cb13aa
117 changed files with 16536 additions and 0 deletions

25
examples/face_detect.rb Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env ruby
# face_detect.rb
require "rubygems"
gem "opencv"
require "opencv"
include OpenCV
window = GUI::Window.new("face detect")
capture = CvCapture.open
detector = CvHaarClassifierCascade::load("C:/Program Files/OpenCV/data/haarcascades/haarcascade_frontalface_alt.xml")
while true
key = GUI::wait_key(1)
image = capture.query
detector.detect_objects(image){|i|
image.rectangle! i.top_left, i.bottom_right, :color => CvColor::Red
}
window.show image
next unless key
case key.chr
when "\e"
exit
end
end