mirror of
https://github.com/ruby-opencv/ruby-opencv
synced 2023-03-27 23:22:12 -04:00
moved tests of IplImage#smoothness to test_iplimage.rb
This commit is contained in:
parent
08a9655dc1
commit
b1c217884e
3 changed files with 24 additions and 0 deletions
Binary file not shown.
Before Width: | Height: | Size: 219 KiB After Width: | Height: | Size: 23 KiB |
Binary file not shown.
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 158 KiB |
|
@ -8,6 +8,10 @@ include OpenCV
|
|||
|
||||
# Tests for OpenCV::IplImage
|
||||
class TestIplImage < OpenCVTestCase
|
||||
def should_classify_images_as(filename, classification)
|
||||
assert_equal(OpenCV::IplImage::load(filename, OpenCV::CV_LOAD_IMAGE_GRAYSCALE).smoothness[0], classification)
|
||||
end
|
||||
|
||||
def test_initialize
|
||||
img = IplImage.new(10, 20)
|
||||
assert_equal(10, img.width)
|
||||
|
@ -127,6 +131,26 @@ class TestIplImage < OpenCVTestCase
|
|||
img.coi = 1
|
||||
assert_equal(1, img.coi)
|
||||
end
|
||||
|
||||
def test_smoothness
|
||||
asset_path = File.join(File.dirname(__FILE__), 'samples')
|
||||
|
||||
for image in Array.new(7) { |e| e = File.join(asset_path, "smooth%d.jpg") % e } do
|
||||
should_classify_images_as image, :smooth
|
||||
end
|
||||
|
||||
for image in Array.new(2) { |e| e = File.join(asset_path, "messy%d.jpg") % e } do
|
||||
should_classify_images_as image, :messy
|
||||
end
|
||||
|
||||
for image in Array.new(10) { |e| e = File.join(asset_path, "blank%d.jpg") % e } do
|
||||
should_classify_images_as image, :blank
|
||||
end
|
||||
|
||||
for image in Array.new(2) { |e| e = File.join(asset_path, "partially_blank%d.jpg") % e } do
|
||||
should_classify_images_as image, :blank
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue