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

experimental implementation for OpenCV 3

This commit is contained in:
ser1zw 2016-04-03 05:19:48 +09:00
parent 2c6f30ab25
commit 11c4154b7c
264 changed files with 53296 additions and 51592 deletions

15
examples/facedetect.rb Normal file
View file

@ -0,0 +1,15 @@
require 'opencv'
m = Cv::imread('images/lenna.jpg', -1)
classifier = Cv::CascadeClassifier.new('haarcascade_frontalface_alt.xml')
rects = classifier.detect_multi_scale(m)
color = Cv::Scalar.new(0, 255, 255)
rects.each do |r|
pt1 = Cv::Point.new(r.x, r.y)
pt2 = Cv::Point.new(r.x + r.width, r.y + r.height)
m.rectangle!(pt1, pt2, color, thickness: 3, line_type: Cv::CV_AA)
end
w = Cv::Window.new('Face detect')
w.show(m)
Cv::wait_key