1
0
Fork 0
mirror of https://github.com/ruby-opencv/ruby-opencv synced 2023-03-27 23:22:12 -04:00
ruby-opencv/examples/houghcircle.rb
ser1zw 7add8ec805 removed some unnecessary CvMat methods
Removed methods are:
  CvMat#rb_morphology_*
  CvMat#rb_copy_make_border_*
  CvMat#rb_hough_lines_*
  CvMat#rb_hough_circles_*
  CvMat#rb_inpaint_*
  CvMat#rb_match_shapes_*
  CvMat#rb_threshold_*
  CvMat#rb_find_fundamental_mat_*
  CvMat#rb_smooth_*
  CvMat#rb_slice_width
  CvMat#rb_slice_height
  CvMat#rb_mix_channels
2011-07-08 20:48:24 +09:00

22 lines
585 B
Ruby
Executable file

#!/usr/bin/env ruby
# houghcircle.rb
require "rubygems"
require "opencv"
include OpenCV
original_window = GUI::Window.new "original"
hough_window = GUI::Window.new "hough circles"
image = IplImage::load "stuff.jpg"
gray = image.BGR2GRAY
result = image.clone
original_window.show image
detect = gray.hough_circles(CV_HOUGH_GRADIENT, 2.0, 10, 200, 50)
puts detect.size
detect.each{|circle|
puts "#{circle.center.x},#{circle.center.y} - #{circle.radius}"
result.circle! circle.center, circle.radius, :color => CvColor::Red, :thickness => 3
}
hough_window.show result
GUI::wait_key