[packages/python-simplecv] new, version 1.3

glen glen at pld-linux.org
Sat Nov 18 17:31:56 CET 2017


commit 6c2bb509abaa866a069b7dd3c2289cc24507f383
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Sat Nov 18 16:53:32 2017 +0200

    new, version 1.3
    
    based on fedora python-SimpleCV package, e7f414c

 font.patch                  |  56 ++++++++
 python-simplecv.spec        | 107 +++++++++++++++
 sample_images_path.patch    |  45 +++++++
 shell_import_frontend.patch |  31 +++++
 test.patch                  | 307 ++++++++++++++++++++++++++++++++++++++++++++
 test_cameras.patch          |  23 ++++
 test_display.patch          | 256 ++++++++++++++++++++++++++++++++++++
 7 files changed, 825 insertions(+)
---
diff --git a/python-simplecv.spec b/python-simplecv.spec
new file mode 100644
index 0000000..494bc6b
--- /dev/null
+++ b/python-simplecv.spec
@@ -0,0 +1,107 @@
+#
+# Conditional build:
+%bcond_with	tests	# do not perform "make test"
+
+%define		module		SimpleCV
+%define		egg_name	SimpleCV
+%define		pypi_name	simplecv
+Summary:	Open source framework for building computer vision applications
+Name:		python-%{pypi_name}
+Version:	1.3
+Release:	1
+License:	BSD
+Group:		Libraries/Python
+Source0:	http://downloads.sourceforge.net/simplecv/SimpleCV-%{version}.tar.gz
+# Source0-md5:	3f9688af1ac8663ebfcd672c38268801
+Patch0:		test.patch
+Patch1:		sample_images_path.patch
+Patch2:		test_display.patch
+Patch3:		test_cameras.patch
+Patch4:		font.patch
+Patch5:		shell_import_frontend.patch
+URL:		http://simplecv.org/
+BuildRequires:	numpy
+BuildRequires:	opencv-python
+BuildRequires:	pygame
+BuildRequires:	python-devel
+BuildRequires:	python-flickrapi
+BuildRequires:	python-modules
+BuildRequires:	python-nose
+BuildRequires:	python-pillow
+BuildRequires:	python-setuptools
+BuildRequires:	python-setuptools
+BuildRequires:	python-svgwrite
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
+BuildRequires:	scipy
+Requires:	astloch-fonts
+Requires:	carterone-fonts
+Requires:	cyreal-wireone-fonts
+Requires:	kranky-fonts
+Requires:	labelleaurore-fonts
+Requires:	monofett-fonts
+Requires:	numpy
+Requires:	opencv-python
+Requires:	pygame
+Requires:	python-flickrapi
+Requires:	python-ipython
+Requires:	python-pillow
+Requires:	python-svgwrite
+Requires:	reeniebeanie-fonts
+Requires:	scipy
+Requires:	shadowsintolight-fonts
+Requires:	specialelite-fonts
+Requires:	unifrakturmaguntia-fonts
+Requires:	vt323-fonts
+Requires:	wallpoet-fonts
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+SimpleCV is a framework for Open Source Machine Vision, using OpenCV
+and the Python programming language.
+
+%prep
+%setup -qc
+mv SimpleCV .tmp; mv .tmp/* .
+
+# This directory contains: flickrapi (bunble library) and script that do
+# queries with a script copied from:
+# http://graphics.cs.cmu.edu/projects/im2gps/flickr_code.html
+rm -r SimpleCV/MachineLearning/query_imgs/
+
+# This directory contains the bundled fonts.
+rm -r SimpleCV/fonts
+
+%patch0
+%patch1
+%patch2
+%patch3
+%patch4
+%patch5
+
+%build
+%py_build
+
+%if %{with tests}
+cd SimpleCV/tests
+nosetests-%{py_ver}
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%py_install
+%py_postclean
+
+# Remove test files that relies on cv2.SURF (unfree)
+rm SimpleCV/tests/test_stereovision.py
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc CHANGELOG.txt LICENSE README.markdown requirements.txt doc/*
+%attr(755,root,root) %{_bindir}/simplecv
+%{py_sitescriptdir}/%{module}
+%{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
diff --git a/font.patch b/font.patch
new file mode 100644
index 0000000..e87a74f
--- /dev/null
+++ b/font.patch
@@ -0,0 +1,56 @@
+# Make sure that we use the packaged fonts and remove reference to unpackaged
+# fonts: ubuntu
+--- SimpleCV/Font.py	2014-10-03 11:43:11.086117096 +0200
++++ SimpleCV/Font.py	2014-10-03 15:24:38.348533743 +0200
+@@ -14,16 +14,15 @@
+     Font.printFonts()
+     """
+ 
+-    _fontpath = "SimpleCV/fonts/"
++    _fontpath = "/usr/share/fonts/"
+     _extension = ".ttf"
+-    _fontface = "ubuntu"
++    _fontface = "astloch"
+     _fontsize = 16
+     _font = None
+     
+     # These fonts were downloaded from Google at:
+     # http://www.http://www.google.com/webfonts
+     _fonts = [
+-					    "ubuntu",
+ 					    "astloch",
+ 					    "carter_one",
+ 					    "kranky",
+@@ -39,7 +38,7 @@
+ 					    ]
+     
+     
+-    def __init__(self, fontface = "ubuntu", fontsize = 16):
++    def __init__(self, fontface = "astloch", fontsize = 16):
+         """
+         This creates a new font object, it uses ubuntu as the default font
+         To give it a custom font you can just pass the absolute path
+@@ -57,20 +56,20 @@
+         """
+         return self._font
+     
+-    def setFont(self, new_font = 'ubuntu'):
++    def setFont(self, new_font = 'astloch'):
+         """
+         Set the name of the font listed in the font family
+         if the font isn't listed in the font family then pass it the absolute
+         path of the truetype font file.
+         Example: Font.setFont("/home/simplecv/my_font.ttf")
+         """
+-        if isinstance(new_font, basestring):
++        if not isinstance(new_font, basestring):
+             print "Please pass a string"
+             return None
+ 	        
+         if find(new_font, self._fonts):
+             self._fontface = new_font
+-            font_to_use = self._fontpath + self._fontface + "/" + self._fontface + self._extension
++            font_to_use = self._fontpath + self._fontface + "/" + self._fontface.capitalize() + self._extension
+         else:
+             self._fontface = new_font
+             font_to_use = new_font
diff --git a/sample_images_path.patch b/sample_images_path.patch
new file mode 100644
index 0000000..27552ea
--- /dev/null
+++ b/sample_images_path.patch
@@ -0,0 +1,45 @@
+# Correct the path of some sample images.
+--- SimpleCV/tests/test_haar_cascade.py	2014-10-02 23:39:54.590606677 +0200
++++ SimpleCV/tests/test_haar_cascade.py	2014-10-02 23:40:30.914980602 +0200
+@@ -4,11 +4,11 @@
+ 
+ FACECASCADE = 'face.xml'
+ 
+-testimage = "sampleimages/orson_welles.jpg"
+-testoutput = "sampleimages/orson_welles_face.jpg"
++testimage = "../sampleimages/orson_welles.jpg"
++testoutput = "../sampleimages/orson_welles_face.jpg"
+ 
+-testneighbor_in = "sampleimages/04000.jpg"
+-testneighbor_out = "sampleimages/04000_face.jpg"
++testneighbor_in = "../sampleimages/04000.jpg"
++testneighbor_out = "../sampleimages/04000_face.jpg"
+ 
+ def test_haarcascade():
+   img = Image(testimage)
+--- SimpleCV/tests/vcamera_tests.py	2014-10-03 00:18:42.618103954 +0200
++++ SimpleCV/tests/vcamera_tests.py	2014-10-03 00:17:59.706674796 +0200
+@@ -5,9 +5,9 @@
+ from nose.tools import with_setup
+ 
+ 
+-testimage = "sampleimages/9dots4lines.png"
+-testvideo = "sampleimages/fasteners.mpg"
+-testoutput = "sampleimages/cam.jpg"
++testimage = "../sampleimages/9dots4lines.png"
++testvideo = "../sampleimages/fasteners.mpg"
++testoutput = "../sampleimages/cam.jpg"
+ 
+ 
+ def test_camera_constructor():
+@@ -25,10 +25,4 @@
+ 
+   img = mycam.getImage()
+   img.save(testoutput)
+-
+-def test_camera_video():
+-  mycam = VirtualCamera(testvideo, "video")
+-
+-  img = mycam.getImage()
+-  img.save(testoutput)
+ 
diff --git a/shell_import_frontend.patch b/shell_import_frontend.patch
new file mode 100644
index 0000000..975763f
--- /dev/null
+++ b/shell_import_frontend.patch
@@ -0,0 +1,31 @@
+# Fix the import from non existant package in ipython >= 2
+#See: https://github.com/sightmachine/SimpleCV/pull/582
+--- SimpleCV/Shell/Shell.py	2012-08-08 21:58:38.000000000 +0200
++++ SimpleCV/Shell/Shell.py	2014-12-07 17:35:06.494507973 +0100
+@@ -48,7 +48,10 @@
+   try:
+     import IPython
+     from IPython.config.loader import Config
+-    from IPython.frontend.terminal.embed import InteractiveShellEmbed
++    if IPython.version_info[0] >= 1:
++      from IPython.terminal.embed import InteractiveShellEmbed
++    else:
++      from IPython.frontend.terminal.embed import InteractiveShellEmbed
+     IPVER = 11
+   except Exception as e:
+     raise(e)
+@@ -163,8 +166,12 @@
+ 
+ def run_notebook():
+     'Run the ipython notebook server'
+-    from IPython.frontend.html.notebook import notebookapp
+-    from IPython.frontend.html.notebook import kernelmanager
++    if IPython.version_info[0] >= 2:
++        from IPython.html import notebookapp
++        from IPython.html.services.kernels import kernelmanager
++    else:
++        from IPython.frontend.html.notebook import notebookapp
++        from IPython.frontend.html.notebook import kernelmanager
+ 
+     code = ""
+     code += "from SimpleCV import *;"
diff --git a/test.patch b/test.patch
new file mode 100644
index 0000000..eed73a1
--- /dev/null
+++ b/test.patch
@@ -0,0 +1,307 @@
+# Remove the tests of test.py tha depen on cv2.SURF (unfree).
+--- SimpleCV/tests/tests.py	2014-10-02 23:25:33.350791855 +0200
++++ SimpleCV/tests/tests.py	2014-10-02 23:47:26.591259593 +0200
+@@ -1649,39 +1649,6 @@
+   else:
+     assert False
+ 
+-def test_findKeypoints():
+-  try:
+-    import cv2
+-  except:
+-    pass
+-    return 
+-  img = Image(testimage2)
+-  kp = img.findKeypoints()
+-  for k in kp:
+-    k.getObject()
+-    k.descriptor()
+-    k.quality()
+-    k.octave()
+-    k.flavor()
+-    k.angle()
+-    k.coordinates()
+-    k.draw()
+-    k.distanceFrom()
+-    k.meanColor()
+-    k.area()
+-    k.perimeter()
+-    k.width()
+-    k.height()
+-    k.radius()
+-    k.crop()
+-
+-  kp.draw()
+-  results = [img]
+-  name_stem = "test_findKeypoints"
+-  #~ perform_diff(results,name_stem)    
+-  
+-  pass
+-
+ def test_movement_feature():
+   current1 = Image("../sampleimages/flow_simple1.png")
+   prev = Image("../sampleimages/flow_simple2.png")
+@@ -1731,96 +1698,6 @@
+ 
+   pass 
+ 
+-def test_keypoint_extraction():
+-  try:
+-    import cv2
+-  except:
+-    pass
+-    return 
+-
+-  img1 = Image("../sampleimages/KeypointTemplate2.png")
+-  img2 = Image("../sampleimages/KeypointTemplate2.png")
+-  img3 = Image("../sampleimages/KeypointTemplate2.png")
+-
+-  kp1 = img1.findKeypoints()
+-  kp2 = img2.findKeypoints(highQuality=True)
+-  kp3 = img3.findKeypoints(flavor="STAR")
+-  kp1.draw()
+-  kp2.draw()
+-  kp3.draw()
+-  #TODO: Fix FAST binding
+-  #~ kp4 = img.findKeypoints(flavor="FAST",min_quality=10)
+-  if( len(kp1)==190 and 
+-      len(kp2)==190 and
+-      len(kp3)==37
+-      #~ and len(kp4)==521
+-    ):
+-    pass
+-  else:
+-    assert False
+-  results = [img1,img2,img3]
+-  name_stem = "test_keypoint_extraction"
+-  perform_diff(results,name_stem,tolerance=3.0)    
+-
+-
+-def test_keypoint_match():
+-  try:
+-    import cv2
+-  except:
+-    pass
+-    return 
+-
+-  template = Image("../sampleimages/KeypointTemplate2.png")
+-  match0 = Image("../sampleimages/kptest0.png")
+-  match1 = Image("../sampleimages/kptest1.png")
+-  match3 = Image("../sampleimages/kptest2.png")
+-  match2 = Image("../sampleimages/aerospace.jpg")# should be none 
+-
+-  fs0 = match0.findKeypointMatch(template)#test zero
+-  fs1 = match1.findKeypointMatch(template,quality=300.00,minDist=0.5,minMatch=0.2)
+-  fs3 = match3.findKeypointMatch(template,quality=300.00,minDist=0.5,minMatch=0.2)
+-  print "This should fail"
+-  fs2 = match2.findKeypointMatch(template,quality=500.00,minDist=0.2,minMatch=0.1)
+-  if( fs0 is not None and fs1 is not None and fs2 is None and  fs3 is not None):
+-    fs0.draw()
+-    fs1.draw()
+-    fs3.draw()
+-    f = fs0[0] 
+-    f.drawRect()
+-    f.draw()
+-    f.getHomography()
+-    f.getMinRect()
+-    f.meanColor()
+-    f.crop()
+-    f.x
+-    f.y
+-    f.coordinates()
+-  else:
+-    assert False
+-
+-  results = [match0,match1,match2,match3]
+-  name_stem = "test_find_keypoint_match"
+-  perform_diff(results,name_stem)    
+- 
+-
+-def test_draw_keypoint_matches():
+-  try:
+-    import cv2
+-  except:
+-    pass
+-    return
+-  template = Image("../sampleimages/KeypointTemplate2.png")
+-  match0 = Image("../sampleimages/kptest0.png")
+-  result = match0.drawKeypointMatches(template,thresh=500.00,minDist=0.15,width=1)
+-
+-  results = [result]
+-  name_stem = "test_draw_keypoint_matches"
+-  perform_diff(results,name_stem,tolerance=4.0)    
+-
+-
+-  pass
+-
+-
+ def test_basic_palette():
+   img = Image(testimageclr)
+   img._generatePalette(10,False)
+@@ -1919,23 +1796,6 @@
+     img.threshold(t)
+   pass
+ 
+-def test_smartThreshold():
+-  img = Image("../sampleimages/RatTop.png")
+-  mask = Image((img.width,img.height))
+-  mask.dl().circle((100,100),80,color=Color.MAYBE_BACKGROUND,filled=True)
+-  mask.dl().circle((100,100),60,color=Color.MAYBE_FOREGROUND,filled=True)
+-  mask.dl().circle((100,100),40,color=Color.FOREGROUND,filled=True)
+-  mask = mask.applyLayers()
+-  new_mask1 = img.smartThreshold(mask=mask)  
+-  new_mask2 = img.smartThreshold(rect=(30,30,150,185))
+- 
+-
+-  results = [new_mask1,new_mask2]
+-  name_stem = "test_smartThreshold"
+-  perform_diff(results,name_stem)    
+-
+-  pass
+-
+ def test_smartFindBlobs():
+   img = Image("../sampleimages/RatTop.png")
+   mask = Image((img.width,img.height))
+@@ -2303,29 +2163,6 @@
+   if( not center.contains(inside) ):
+     assert False
+ 
+-def test_get_aspectratio():
+-  img = Image("../sampleimages/EdgeTest1.png")
+-  img2 = Image("../sampleimages/EdgeTest2.png")
+-  b = img.findBlobs()
+-  l = img2.findLines()
+-  c = img2.findCircle(thresh=200)
+-  c2 = img2.findCorners()
+-  kp = img2.findKeypoints()
+-  bb = b.aspectRatios()
+-  ll = l.aspectRatios()
+-  cc = c.aspectRatios()
+-  c22 = c2.aspectRatios()
+-  kp2 = kp.aspectRatios()
+-
+-  if( len(bb) > 0 and
+-      len(ll) > 0 and
+-      len(cc) > 0 and
+-      len(c22) > 0 and
+-      len(kp2) > 0 ):
+-    pass
+-  else:
+-    assert False
+-
+ def test_line_crop():
+   img = Image("../sampleimages/EdgeTest2.png")
+   l = img.findLines().sortArea()
+@@ -2390,74 +2227,6 @@
+   s90 = os.remove(l90)
+   s80 = os.remove(l80)
+   s70 = os.remove(l70)
+-  
+-def test_on_edge():
+-  img1 = "./../sampleimages/EdgeTest1.png"
+-  img2 = "./../sampleimages/EdgeTest2.png"
+-  imgA = Image(img1)
+-  imgB = Image(img2)
+-  imgC = Image(img2)
+-  imgD = Image(img2)
+-  imgE = Image(img2)
+-  
+-  blobs = imgA.findBlobs()
+-  circs = imgB.findCircle(thresh=200)
+-  corners = imgC.findCorners()
+-  kp = imgD.findKeypoints()
+-  lines = imgE.findLines()
+-  
+-  rim =  blobs.onImageEdge()
+-  inside = blobs.notOnImageEdge()
+-  rim.draw(color=Color.RED)
+-  inside.draw(color=Color.BLUE)
+-
+-  rim =  circs.onImageEdge()
+-  inside = circs.notOnImageEdge()
+-  rim.draw(color=Color.RED)
+-  inside.draw(color=Color.BLUE)
+-
+-  #rim =  corners.onImageEdge()
+-  inside = corners.notOnImageEdge()
+-  #rim.draw(color=Color.RED)
+-  inside.draw(color=Color.BLUE)
+-
+-  #rim =  kp.onImageEdge()
+-  inside = kp.notOnImageEdge()
+-  #rim.draw(color=Color.RED)
+-  inside.draw(color=Color.BLUE)
+-
+-  rim =  lines.onImageEdge()
+-  inside = lines.notOnImageEdge()
+-  rim.draw(color=Color.RED)
+-  inside.draw(color=Color.BLUE)
+-  
+-  results = [imgA,imgB,imgC,imgD,imgE]
+-  name_stem = "test_onEdge_Features"
+-  #~ perform_diff(results,name_stem,tolerance=8.0)        
+-
+-def test_feature_angles():
+-  img = Image("../sampleimages/rotation2.png")
+-  img2 = Image("../sampleimages/rotation.jpg")
+-  img3 = Image("../sampleimages/rotation.jpg")
+-  b = img.findBlobs()
+-  l = img2.findLines()
+-  k = img3.findKeypoints()
+-
+-  for bs in b:
+-    tl = bs.topLeftCorner()
+-    img.drawText(str(bs.angle()),tl[0],tl[1],color=Color.RED)
+-  
+-  for ls in l:
+-    tl = ls.topLeftCorner()
+-    img2.drawText(str(ls.angle()),tl[0],tl[1],color=Color.GREEN)
+-
+-  for ks in k:
+-    tl = ks.topLeftCorner()
+-    img3.drawText(str(ks.angle()),tl[0],tl[1],color=Color.BLUE)
+-
+-  results = [img,img2,img3]
+-  name_stem = "test_feature_angles"
+-  perform_diff(results,name_stem,tolerance=9.0)        
+ 
+ def test_feature_angles_rotate():
+   img = Image("../sampleimages/rotation2.png")
+@@ -2747,7 +2516,7 @@
+     pass
+     return 
+   img = Image(testimage2)
+-  methods = ["ORB", "SIFT", "SURF","FAST", "STAR", "MSER", "Dense"]
++  methods = ["ORB","FAST", "STAR", "MSER", "Dense"]
+   for i in methods :
+      print i
+      kp = img.findKeypoints(flavor = i)
+@@ -2775,27 +2544,7 @@
+      #~ perform_diff(results,name_stem,tolerance=8)    
+   pass
+ 
+-    
+-def test_upload_flickr():
+-    try:
+-       import flickrapi
+-    except:
+-       if( SHOW_WARNING_TESTS ):
+-          logger.warning("Couldn't run the upload test as optional pycurl library required")
+-       pass
+-    else:
+-       img = Image('simplecv')
+-       api_key = ''
+-       api_secret = ''
+-       if api_key==None or api_secret==None :
+-           pass
+-       else :
+-           ret=img.upload('flickr',api_key,api_secret)
+-           if ret == True :
+-               pass
+-           else :
+-               assert False
+-               
++
+ def test_image_new_crop():
+   img = Image(logo)
+   x = 5
diff --git a/test_cameras.patch b/test_cameras.patch
new file mode 100644
index 0000000..1270b38
--- /dev/null
+++ b/test_cameras.patch
@@ -0,0 +1,23 @@
+# Remove tests that rely on a true camera (cannont build in mock) and correct a path.
+--- SimpleCV/tests/test_cameras.py	2014-10-02 23:43:15.625676142 +0200
++++ SimpleCV/tests/test_cameras.py	2014-10-03 10:45:21.239674143 +0200
+@@ -5,7 +5,7 @@
+ from nose.tools import with_setup
+ 
+ 
+-testoutput = "sampleimages/cam.jpg"
++testoutput = "../sampleimages/cam.jpg"
+ 
+ 
+ def test_virtual_camera_constructor():
+@@ -19,10 +19,3 @@
+   
+   pass
+ 
+-def test_camera_image():
+-  mycam = Camera(0)
+-
+-  img = mycam.getImage()
+-  img.save(testoutput)
+-  pass
+-
diff --git a/test_display.patch b/test_display.patch
new file mode 100644
index 0000000..99dfa83
--- /dev/null
+++ b/test_display.patch
@@ -0,0 +1,256 @@
+# Remove the tests of test_display.py that depen on cv2.SURF (unfree).
+--- SimpleCV/tests/test_display.py	2014-10-03 00:53:08.970024985 +0200
++++ SimpleCV/tests/test_display.py	2014-10-03 00:55:03.237200121 +0200
+@@ -1153,39 +1153,6 @@
+   else:
+     assert False
+ 
+-def test_findKeypoints():
+-  try:
+-    import cv2
+-  except:
+-    pass
+-    return 
+-  img = Image(testimage2)
+-  kp = img.findKeypoints()
+-  for k in kp:
+-    k.getObject()
+-    k.descriptor()
+-    k.quality()
+-    k.octave()
+-    k.flavor()
+-    k.angle()
+-    k.coordinates()
+-    k.draw()
+-    k.distanceFrom()
+-    k.meanColor()
+-    k.area()
+-    k.perimeter()
+-    k.width()
+-    k.height()
+-    k.radius()
+-    k.crop()
+-
+-  kp.draw()
+-  results = [img]
+-  name_stem = "test_findKeypoints"
+-  perform_diff(results,name_stem)    
+-  
+-  pass
+-
+ def test_movement_feature():
+   current1 = Image("../sampleimages/flow_simple1.png")
+   prev = Image("../sampleimages/flow_simple2.png")
+@@ -1235,104 +1202,6 @@
+ 
+   pass 
+ 
+-def test_keypoint_extraction():
+-  try:
+-    import cv2
+-  except:
+-    pass
+-    return 
+-
+-  img1 = Image("../sampleimages/KeypointTemplate2.png")
+-  img2 = Image("../sampleimages/KeypointTemplate2.png")
+-  img3 = Image("../sampleimages/KeypointTemplate2.png")
+-
+-  kp1 = img1.findKeypoints()
+-  kp2 = img2.findKeypoints(highQuality=True)
+-  kp3 = img3.findKeypoints(flavor="STAR")
+-  kp1.draw()
+-  kp2.draw()
+-  kp3.draw()
+-  #TODO: Fix FAST binding
+-  #~ kp4 = img.findKeypoints(flavor="FAST",min_quality=10)
+-  if( len(kp1)==190 and 
+-      len(kp2)==190 and
+-      len(kp3)==37
+-      #~ and len(kp4)==521
+-    ):
+-    pass
+-  else:
+-    assert False
+-  results = [img1,img2,img3]
+-  name_stem = "test_keypoint_extraction"
+-  perform_diff(results,name_stem,tolerance=3.0)    
+-
+-
+-def test_keypoint_match():
+-  try:
+-    import cv2
+-  except:
+-    pass
+-    return 
+-
+-  template = Image("../sampleimages/KeypointTemplate2.png")
+-  match0 = Image("../sampleimages/kptest0.png")
+-  match1 = Image("../sampleimages/kptest1.png")
+-  match3 = Image("../sampleimages/kptest2.png")
+-  match2 = Image("../sampleimages/aerospace.jpg")# should be none 
+-
+-  fs0 = match0.findKeypointMatch(template)#test zero
+-  fs1 = match1.findKeypointMatch(template,quality=300.00,minDist=0.5,minMatch=0.2)
+-  fs3 = match3.findKeypointMatch(template,quality=300.00,minDist=0.5,minMatch=0.2)
+-  print "This should fail"
+-  fs2 = match2.findKeypointMatch(template,quality=500.00,minDist=0.2,minMatch=0.1)
+-  if( fs0 is not None and fs1 is not None and fs2 is None and  fs3 is not None):
+-    fs0.draw()
+-    fs1.draw()
+-    fs3.draw()
+-    f = fs0[0] 
+-    f.drawRect()
+-    f.draw()
+-    f.getHomography()
+-    f.getMinRect()
+-    f.meanColor()
+-    f.crop()
+-    f.x
+-    f.y
+-    f.coordinates()
+-  else:
+-    assert False
+-
+-  results = [match0,match1,match2,match3]
+-  name_stem = "test_find_keypoint_match"
+-  perform_diff(results,name_stem)    
+- 
+-
+-def test_draw_keypoint_matches():
+-  try:
+-    import cv2
+-  except:
+-    pass
+-    return
+-  template = Image("../sampleimages/KeypointTemplate2.png")
+-  match0 = Image("../sampleimages/kptest0.png")
+-  result = match0.drawKeypointMatches(template,thresh=500.00,minDist=0.15,width=1)
+-
+-  results = [result]
+-  name_stem = "test_draw_keypoint_matches"
+-  perform_diff(results,name_stem,tolerance=4.0)    
+-  pass  
+-
+-def test_skeletonize():
+-  img = Image(logo)
+-  s = img.skeletonize()
+-  s2 = img.skeletonize(10)
+-
+-  results = [s,s2]
+-  name_stem = "test_skelotinze"
+-  perform_diff(results,name_stem)    
+-
+-  pass
+-
+ def test_smartThreshold():
+   img = Image("../sampleimages/RatTop.png")
+   mask = Image((img.width,img.height))
+@@ -1527,74 +1396,6 @@
+   name_stem = "test_lineCrop"
+   perform_diff(results,name_stem,tolerance=3.0)        
+   pass
+-    
+-def test_on_edge():
+-  img1 = "./../sampleimages/EdgeTest1.png"
+-  img2 = "./../sampleimages/EdgeTest2.png"
+-  imgA = Image(img1)
+-  imgB = Image(img2)
+-  imgC = Image(img2)
+-  imgD = Image(img2)
+-  imgE = Image(img2)
+-  
+-  blobs = imgA.findBlobs()
+-  circs = imgB.findCircle(thresh=200)
+-  corners = imgC.findCorners()
+-  kp = imgD.findKeypoints()
+-  lines = imgE.findLines()
+-  
+-  rim =  blobs.onImageEdge()
+-  inside = blobs.notOnImageEdge()
+-  rim.draw(color=Color.RED)
+-  inside.draw(color=Color.BLUE)
+-
+-  rim =  circs.onImageEdge()
+-  inside = circs.notOnImageEdge()
+-  rim.draw(color=Color.RED)
+-  inside.draw(color=Color.BLUE)
+-
+-  #rim =  corners.onImageEdge()
+-  inside = corners.notOnImageEdge()
+-  #rim.draw(color=Color.RED)
+-  inside.draw(color=Color.BLUE)
+-
+-  #rim =  kp.onImageEdge()
+-  inside = kp.notOnImageEdge()
+-  #rim.draw(color=Color.RED)
+-  inside.draw(color=Color.BLUE)
+-
+-  rim =  lines.onImageEdge()
+-  inside = lines.notOnImageEdge()
+-  rim.draw(color=Color.RED)
+-  inside.draw(color=Color.BLUE)
+-  
+-  results = [imgA,imgB,imgC,imgD,imgE]
+-  name_stem = "test_onEdge_Features"
+-  perform_diff(results,name_stem,tolerance=7.0)        
+-
+-def test_feature_angles():
+-  img = Image("../sampleimages/rotation2.png")
+-  img2 = Image("../sampleimages/rotation.jpg")
+-  img3 = Image("../sampleimages/rotation.jpg")
+-  b = img.findBlobs()
+-  l = img2.findLines()
+-  k = img3.findKeypoints()
+-
+-  for bs in b:
+-    tl = bs.topLeftCorner()
+-    img.drawText(str(bs.angle()),tl[0],tl[1],color=Color.RED)
+-  
+-  for ls in l:
+-    tl = ls.topLeftCorner()
+-    img2.drawText(str(ls.angle()),tl[0],tl[1],color=Color.GREEN)
+-
+-  for ks in k:
+-    tl = ks.topLeftCorner()
+-    img3.drawText(str(ks.angle()),tl[0],tl[1],color=Color.BLUE)
+-
+-  results = [img,img2,img3]
+-  name_stem = "test_feature_angles"
+-  perform_diff(results,name_stem,tolerance=9.0)        
+ 
+ def test_feature_angles_rotate():
+   img = Image("../sampleimages/rotation2.png")
+@@ -1707,32 +1508,3 @@
+     name_stem = "test_sobel"
+     s = [s]
+     perform_diff(s,name_stem)
+-
+-def test_image_new_smooth():
+-  img = Image(testimage2)
+-  result = []
+-  result.append(img.medianFilter())
+-  result.append(img.medianFilter((3,3)))
+-  result.append(img.medianFilter((5,5),grayscale=True))
+-  result.append(img.bilateralFilter())
+-  result.append(img.bilateralFilter(diameter=14,sigmaColor=20, sigmaSpace=34))
+-  result.append(img.bilateralFilter(grayscale=True))
+-  result.append(img.blur())
+-  result.append(img.blur((5,5)))
+-  result.append(img.blur((3,5),grayscale=True))
+-  result.append(img.gaussianBlur())  
+-  result.append(img.gaussianBlur((3,7), sigmaX=10 , sigmaY=12))  
+-  result.append(img.gaussianBlur((7,9), sigmaX=10 , sigmaY=12, grayscale=True))  
+-  name_stem = "test_image_new_smooth"
+-  perform_diff(result,name_stem)
+-  pass
+-
+-def test_track():
+-    ts = []
+-    bb = (195, 160, 49, 46)
+-    imgs = [Image(img) for img in trackimgs]
+-    ts = imgs[0].track("camshift", ts, imgs[1:], bb)
+-    if ts:
+-        pass
+-    else:
+-        assert False
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-simplecv.git/commitdiff/6c2bb509abaa866a069b7dd3c2289cc24507f383



More information about the pld-cvs-commit mailing list