[python-SimpleCV] Initial import (#1070946)

Julien Enselme jujens at fedoraproject.org
Mon Oct 20 12:39:34 UTC 2014


commit 5ace71d3ee2f743eb8273610f0ab02fb52eef888
Author: Julien Enselme <jujens at jujens.eu>
Date:   Mon Oct 20 14:39:29 2014 +0200

    Initial import (#1070946)

 .gitignore                                   |    1 +
 python-SimpleCV-1.3-font.patch               |   54 +++++
 python-SimpleCV-1.3-sample_images_path.patch |   44 ++++
 python-SimpleCV-1.3-test.patch               |  306 ++++++++++++++++++++++++++
 python-SimpleCV-1.3-test_cameras.patch       |   22 ++
 python-SimpleCV-1.3-test_display.patch       |  255 +++++++++++++++++++++
 python-SimpleCV.spec                         |  126 +++++++++++
 sources                                      |    1 +
 8 files changed, 809 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..1ca82e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/SimpleCV-1.3.tar.gz
diff --git a/python-SimpleCV-1.3-font.patch b/python-SimpleCV-1.3-font.patch
new file mode 100644
index 0000000..043ac36
--- /dev/null
+++ b/python-SimpleCV-1.3-font.patch
@@ -0,0 +1,54 @@
+--- 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/python-SimpleCV-1.3-sample_images_path.patch b/python-SimpleCV-1.3-sample_images_path.patch
new file mode 100644
index 0000000..7c82068
--- /dev/null
+++ b/python-SimpleCV-1.3-sample_images_path.patch
@@ -0,0 +1,44 @@
+--- 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/python-SimpleCV-1.3-test.patch b/python-SimpleCV-1.3-test.patch
new file mode 100644
index 0000000..2581962
--- /dev/null
+++ b/python-SimpleCV-1.3-test.patch
@@ -0,0 +1,306 @@
+--- 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/python-SimpleCV-1.3-test_cameras.patch b/python-SimpleCV-1.3-test_cameras.patch
new file mode 100644
index 0000000..dce2def
--- /dev/null
+++ b/python-SimpleCV-1.3-test_cameras.patch
@@ -0,0 +1,22 @@
+--- 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/python-SimpleCV-1.3-test_display.patch b/python-SimpleCV-1.3-test_display.patch
new file mode 100644
index 0000000..0f5dac4
--- /dev/null
+++ b/python-SimpleCV-1.3-test_display.patch
@@ -0,0 +1,255 @@
+--- 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
diff --git a/python-SimpleCV.spec b/python-SimpleCV.spec
new file mode 100644
index 0000000..8d1ae77
--- /dev/null
+++ b/python-SimpleCV.spec
@@ -0,0 +1,126 @@
+Name:           python-SimpleCV
+Version:        1.3
+Release:        3%{?dist}
+Summary:        Open source framework for building computer vision applications
+
+License:        BSD
+URL:            http://simplecv.org/
+Source0:        http://sourceforge.net/projects/simplecv/files/1.3/SimpleCV-%{version}.tar.gz
+# Remove the tests of test.py tha depen on cv2.SURF (unfree).
+Patch0:         %{name}-%{version}-test.patch
+# Correct the path of some sample images.
+Patch1:         %{name}-%{version}-sample_images_path.patch
+# Remove the tests of test_display.py that depen on cv2.SURF (unfree).
+Patch2:         %{name}-%{version}-test_display.patch
+# Remove tests that rely on a true camera (cannont build in mock) and correct a path.
+Patch3:         %{name}-%{version}-test_cameras.patch
+# Make sure that we use the packaged fonts and remove reference to unpackaged
+# fonts : ubuntu
+Patch4:         %{name}-%{version}-font.patch
+
+BuildArch:      noarch
+BuildRequires:  python-devel
+BuildRequires:  python-setuptools
+BuildRequires:  python-nose
+BuildRequires:  python-flickrapi
+BuildRequires:  opencv-python
+BuildRequires:  scipy
+BuildRequires:  numpy
+BuildRequires:  pygame
+BuildRequires:  python-pillow
+BuildRequires:  python-svgwrite
+
+Requires:       python-ipython
+Requires:       opencv-python
+Requires:       scipy
+Requires:       numpy
+Requires:       pygame
+Requires:       python-pillow
+Requires:       python-svgwrite
+Requires:       python-flickrapi
+Requires:       astloch-fonts
+Requires:       carterone-fonts
+Requires:       cyreal-wireone-fonts
+Requires:       kranky-fonts
+Requires:       labelleaurore-fonts
+Requires:       monofett-fonts
+Requires:       reeniebeanie-fonts
+Requires:       shadowsintolight-fonts
+Requires:       specialelite-fonts
+Requires:       unifrakturmaguntia-fonts
+Requires:       vt323-fonts
+Requires:       wallpoet-fonts
+
+
+%description
+SimpleCV is a framework for Open Source Machine Vision, using OpenCV and the
+Python programming language.
+
+%prep
+%setup -q -n SimpleCV
+
+# 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
+
+# Applying patches.
+%patch0
+%patch1
+%patch2
+%patch3
+%patch4
+
+
+%build
+%{__python2} setup.py build
+
+
+%install
+%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+
+# Remove shebang
+for lib in $RPM_BUILD_ROOT%{python2_sitelib}/SimpleCV/{,*/,*/*}/*.py; do
+ sed '1{\@^#!/usr/bin/env python at d}' $lib > $lib.new &&
+ touch -r $lib $lib.new &&
+ mv $lib.new $lib
+done
+
+for lib in $RPM_BUILD_ROOT%{python2_sitelib}/SimpleCV/{,*/,*/*}/*.py; do
+ sed '1{\@^#!/usr/bin/python at d}' $lib > $lib.new &&
+ touch -r $lib $lib.new &&
+ mv $lib.new $lib
+done
+
+# Remove test files that relies on cv2.SURF (unfree)
+rm SimpleCV/tests/test_stereovision.py
+
+
+%check
+cd SimpleCV/tests
+nosetests
+
+
+%files
+%doc CHANGELOG.txt LICENSE README.markdown requirements.txt doc/*
+%{_bindir}/simplecv
+%{python2_sitelib}/SimpleCV-%{version}-py%{python2_version}.egg-info/
+%{python2_sitelib}/SimpleCV/
+
+
+%changelog
+* Thu Oct 2 2014 Julien Enselme <jujens at jujens.eu> - 1.3-3
+- Correct dependancy python-pip -> python-pillow.
+- Add bundled fonts as dependancies.
+- Add %%check directive.
+- Use a patch to correclty use packaged fonts and remove reference to ubuntu-fonts.
+
+* Mon Mar 24 2014 Julien Enselme <jujens at jujens.eu> - 1.3-2
+- Remove flickrapi (bundled library).
+- Add python-flickrapi as a requirement.
+
+* Sun Feb 09 2014 Julien Enselme <jujens at jujens.eu> - 1.3-1
+- Initial packaging
diff --git a/sources b/sources
index e69de29..6e7845d 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+3f9688af1ac8663ebfcd672c38268801  SimpleCV-1.3.tar.gz


More information about the scm-commits mailing list