This repository has been archived by the owner on Dec 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit, with some minor changes from orig (date, exec bit, li…
…ne endings, /usr/bin/env)
- Loading branch information
0 parents
commit 9196cb1
Showing
117 changed files
with
16,536 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
=== 0.0.6 / 2008-06-27 | ||
|
||
* First gem release. | ||
|
||
* Some OpenCV function wrapped. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
The BSD Liscense | ||
|
||
Copyright (c) 2008, Masakazu Yonekura | ||
All rights reserved. | ||
|
||
Redistribution and use of this software in source and binary forms, with or without modification, are | ||
permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above | ||
copyright notice, this list of conditions and the | ||
following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the | ||
following disclaimer in the documentation and/or other | ||
materials provided with the distribution. | ||
|
||
* Neither the name of Masakazu Yonekura. nor the names of its | ||
contributors may be used to endorse or promote products | ||
derived from this software without specific prior | ||
written permission of Masakazu Yonekura. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED | ||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
History.txt | ||
Manifest.txt | ||
README.txt | ||
License.txt | ||
Rakefile | ||
examples/convexhull.rb | ||
examples/face_detect.rb | ||
examples/houghcircle.rb | ||
examples/inpaint.png | ||
examples/inpaint.rb | ||
examples/paint.rb | ||
examples/snake.rb | ||
examples/stuff.jpg | ||
ext/curve.cpp | ||
ext/curve.h | ||
ext/cvavgcomp.cpp | ||
ext/cvavgcomp.h | ||
ext/cvbox2d.cpp | ||
ext/cvbox2d.h | ||
ext/cvcapture.cpp | ||
ext/cvcapture.h | ||
ext/cvchain.cpp | ||
ext/cvchain.h | ||
ext/cvchaincode.cpp | ||
ext/cvchaincode.h | ||
ext/cvcircle32f.cpp | ||
ext/cvcircle32f.h | ||
ext/cvcondensation.cpp | ||
ext/cvcondensation.h | ||
ext/cvconnectedcomp.cpp | ||
ext/cvconnectedcomp.h | ||
ext/cvcontour.cpp | ||
ext/cvcontour.h | ||
ext/cvcontourtree.cpp | ||
ext/cvcontourtree.h | ||
ext/cvconvexitydefect.cpp | ||
ext/cvconvexitydefect.h | ||
ext/cverror.cpp | ||
ext/cverror.h | ||
ext/cvfont.cpp | ||
ext/cvfont.h | ||
ext/cvhaarclassifiercascade.cpp | ||
ext/cvhaarclassifiercascade.h | ||
ext/cvhistogram.cpp | ||
ext/cvhistogram.h | ||
ext/cvindex.cpp | ||
ext/cvindex.h | ||
ext/cvline.cpp | ||
ext/cvline.h | ||
ext/cvmat.cpp | ||
ext/cvmat.h | ||
ext/cvmatnd.cpp | ||
ext/cvmatnd.h | ||
ext/cvmemstorage.cpp | ||
ext/cvmemstorage.h | ||
ext/cvmoments.cpp | ||
ext/cvmoments.h | ||
ext/cvpoint.cpp | ||
ext/cvpoint.h | ||
ext/cvpoint2d32f.cpp | ||
ext/cvpoint2d32f.h | ||
ext/cvpoint3d32f.cpp | ||
ext/cvpoint3d32f.h | ||
ext/cvrect.cpp | ||
ext/cvrect.h | ||
ext/cvscalar.cpp | ||
ext/cvscalar.h | ||
ext/cvseq.cpp | ||
ext/cvseq.h | ||
ext/cvset.cpp | ||
ext/cvset.h | ||
ext/cvsize.cpp | ||
ext/cvsize.h | ||
ext/cvsize2d32f.cpp | ||
ext/cvsize2d32f.h | ||
ext/cvslice.cpp | ||
ext/cvslice.h | ||
ext/cvsparsemat.cpp | ||
ext/cvsparsemat.h | ||
ext/cvtermcriteria.cpp | ||
ext/cvtermcriteria.h | ||
ext/cvtwopoints.cpp | ||
ext/cvtwopoints.h | ||
ext/cvvector.cpp | ||
ext/cvvector.h | ||
ext/cvvideowriter.cpp | ||
ext/cvvideowriter.h | ||
ext/extconf.rb | ||
ext/gui.cpp | ||
ext/gui.h | ||
ext/iplconvkernel.cpp | ||
ext/iplconvkernel.h | ||
ext/iplimage.cpp | ||
ext/iplimage.h | ||
ext/mouseevent.cpp | ||
ext/mouseevent.h | ||
ext/opencv.cpp | ||
ext/opencv.h | ||
ext/point3dset.cpp | ||
ext/point3dset.h | ||
ext/pointset.cpp | ||
ext/pointset.h | ||
ext/trackbar.cpp | ||
ext/trackbar.h | ||
ext/window.cpp | ||
ext/window.h | ||
images/CvMat_sobel.png | ||
images/CvMat_sub_rect.png | ||
images/CvSeq_relationmap.png | ||
images/face_detect_from_lena.jpg | ||
lib/opencv.rb | ||
lib/version.rb | ||
setup/setup.cygwin.rb | ||
setup/setup.mingw.rb | ||
setup/setup.mswin32.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
= opencv | ||
|
||
OpenCV Sourceforge Project | ||
http://sourceforge.net/projects/opencvlibrary/ | ||
|
||
Ruby/OpenCV Author's Web Page | ||
http://blueruby.mydns.jp/opencv | ||
|
||
== DESCRIPTION: | ||
|
||
OpenCV Ruby Wrapper | ||
|
||
== FEATURES/PROBLEMS: | ||
|
||
* First release rubygems, Some OpenCV function wrapped. | ||
|
||
== SYNOPSIS: | ||
|
||
# Show image via GUI Window. | ||
|
||
require "rubygems" | ||
gem "opencv" | ||
require "opencv" | ||
|
||
image = OpenCV::IplImage.load("sample.jpg") | ||
window = OpenCV::GUI::Window.new("preview") | ||
window.show(image) | ||
OpenCV::GUI::wait_key | ||
|
||
# other sample code, see examples/*.rb | ||
|
||
== REQUIREMENTS: | ||
|
||
* OpenCV 1.0 or later. | ||
http://sourceforge.net/projects/opencvlibrary/ | ||
* ffcall (optional) | ||
http://www.haible.de/bruno/packages-ffcall.html | ||
|
||
== INSTALL: | ||
|
||
gem install opencv | ||
|
||
== LICENSE: | ||
|
||
The BSD Liscense | ||
|
||
see LICENSE.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- ruby -*- | ||
|
||
require 'rubygems' | ||
require 'hoe' | ||
require './lib/version' | ||
|
||
Hoe.new('opencv', OpenCV::VERSION) do |p| | ||
p.author = ['Masakazu Yonekura'] | ||
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n") | ||
p.description = <<EOF | ||
OpenCV wrapper for Ruby | ||
EOF | ||
p.rubyforge_name = 'opencv' | ||
p.developer('lsxi', '[email protected]') | ||
p.email = ['[email protected]'] | ||
|
||
p.need_tar = false | ||
p.need_zip = false | ||
# p.rdoc_pattern = | ||
# p.remote_rdoc_dir = | ||
# p.rsync = | ||
p.spec_extras = { | ||
:extensions => %w{ext/extconf.rb} | ||
} | ||
p.summary = 'OpenCV wrapper for Ruby.' | ||
# p.test_globs = 'spec/**/*_spec.rb' | ||
p.clean_globs |= ['*.o'] | ||
|
||
p.url = 'http://blueruby.mydns.jp/opencv' | ||
|
||
p.extra_deps << ['hoe'] | ||
end | ||
|
||
# vim: syntax=Ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env ruby | ||
# convexhull.rb | ||
gem "opencv" | ||
require "opencv" | ||
require "pp" | ||
include OpenCV | ||
|
||
window = GUI::Window.new("convexhull") | ||
pp CvCapture::INTERFACE | ||
capture = CvCapture::open | ||
|
||
accuracy = 0.1 | ||
t = window.set_trackbar("accuracy", 100, 1){|v| | ||
accuracy = 0.1 * v | ||
} | ||
|
||
while true | ||
key = GUI::wait_key(1) | ||
image = capture.query | ||
gray = image.BGR2GRAY | ||
bin = gray.threshold_binary(0x44, 0xFF) | ||
contours = bin.find_contours | ||
while contours | ||
image.poly_line! contours.approx(:accuracy => accuracy), :color => CvScalar::Red | ||
contours.convexity_defects.each{|cd| | ||
image.circle! cd.start, 1, :color => CvScalar::Blue | ||
image.circle! cd.end, 1, :color => CvScalar::Blue | ||
image.circle! cd.depth_point, 1, :color => CvScalar::Blue | ||
} | ||
|
||
contours = contours.h_next | ||
end | ||
#pts = gray.good_features_to_track(0.01, 10) | ||
#puts pts.length | ||
window.show image | ||
next unless key | ||
case key.chr | ||
when "\e" | ||
exit | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env ruby | ||
# houghcircle.rb | ||
require "rubygems" | ||
gem "opencv" | ||
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_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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env ruby | ||
# inpaint.rb | ||
require "rubygems" | ||
gem "opencv" | ||
require "opencv" | ||
|
||
include OpenCV | ||
|
||
owindow = GUI::Window.new "original" | ||
mwindow = GUI::Window.new "mask" | ||
iwindow = GUI::Window.new "inpaint" | ||
|
||
image = IplImage::load "inpaint.png" | ||
b, g, r = image.split | ||
original_mask = r.threshold_binary_inverse(0x00, 0xFF) & b.threshold_binary_inverse(0x00, 0xFF) | ||
mask = original_mask.copy | ||
|
||
num_dilate = 3 | ||
radius = 5 | ||
dilate_bar = mwindow.set_trackbar("dilate", 10, num_dilate){|v| | ||
num_dilate = v | ||
mask = original_mask.dilate(nil, num_dilate) | ||
mwindow.show mask | ||
} | ||
|
||
radius_bar = mwindow.set_trackbar("radius", 30, radius){|v| | ||
radius = v | ||
} | ||
|
||
owindow.show image | ||
mwindow.show mask | ||
|
||
while key = GUI::wait_key | ||
case key.chr | ||
when "\e" # esc | ||
exit | ||
when "n" | ||
iwindow.show image.inpaint_ns(mask, radius) | ||
when "t" | ||
iwindow.show image.inpaint_telea(mask, radius) | ||
end | ||
end | ||
|
Oops, something went wrong.