http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11710
Revision: 11710
Author: drtrigon
Date: 2013-07-02 20:55:33 +0000 (Tue, 02 Jul 2013)
Log Message:
-----------
follow up; to r11709, r11707 since the we have in fact different behaviour for different OpenCV versions
Modified Paths:
--------------
trunk/pywikipedia/catimages.py
Modified: trunk/pywikipedia/catimages.py
===================================================================
--- trunk/pywikipedia/catimages.py 2013-07-02 20:39:58 UTC (rev 11709)
+++ trunk/pywikipedia/catimages.py 2013-07-02 20:55:33 UTC (rev 11710)
@@ -1031,8 +1031,12 @@
# detectMultiScale(img, hit_threshold=0, win_stride=Size(),
# padding=Size(), scale0=1.05, group_threshold=2)
enable_recovery() # enable recovery from hard crash
- found, w = hog.detectMultiScale(img, 0.25, (8,8), (32,32), 1.05, 2)
+ ret = hog.detectMultiScale(img, 0.25, (8,8), (32,32), 1.05, 2)
disable_recovery() # disable since everything worked out fine
+ if cv2.__version__ == '$Rev: 4557 $': # TS
+ found = ret
+ else: #'2.4.5' or else (e.g. on fedora 18)
+ found, w = ret
found = list(found)
# people haar/cascaded classifier
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11709
Revision: 11709
Author: drtrigon
Date: 2013-07-02 20:39:58 +0000 (Tue, 02 Jul 2013)
Log Message:
-----------
bug fix; ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
(is a follow-up to r11707)
Modified Paths:
--------------
trunk/pywikipedia/catimages.py
Modified: trunk/pywikipedia/catimages.py
===================================================================
--- trunk/pywikipedia/catimages.py 2013-07-02 13:37:22 UTC (rev 11708)
+++ trunk/pywikipedia/catimages.py 2013-07-02 20:39:58 UTC (rev 11709)
@@ -1031,9 +1031,9 @@
# detectMultiScale(img, hit_threshold=0, win_stride=Size(),
# padding=Size(), scale0=1.05, group_threshold=2)
enable_recovery() # enable recovery from hard crash
- found = list(hog.detectMultiScale(img, 0.25, (8,8), (32,32), 1.05, 2))
+ found, w = hog.detectMultiScale(img, 0.25, (8,8), (32,32), 1.05, 2)
disable_recovery() # disable since everything worked out fine
- found = [item for item in found if item]
+ found = list(found)
# people haar/cascaded classifier
# use 'haarcascade_fullbody.xml', ... also (like face detection)
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11707
Revision: 11707
Author: drtrigon
Date: 2013-07-01 21:33:58 +0000 (Mon, 01 Jul 2013)
Log Message:
-----------
bug fix; solve IndexError: index 0 is out of bounds for axis 0 with size 0
bug fix; solve TypeError: argument of type 'float' is not iterable
Modified Paths:
--------------
trunk/pywikipedia/catimages.py
Modified: trunk/pywikipedia/catimages.py
===================================================================
--- trunk/pywikipedia/catimages.py 2013-07-01 13:04:55 UTC (rev 11706)
+++ trunk/pywikipedia/catimages.py 2013-07-01 21:33:58 UTC (rev 11707)
@@ -199,10 +199,10 @@
misc += [exif['DescProducer']] if 'DescProducer' in exif else []
misc += [exif['DescCreator']] if 'DescCreator' in exif else []
- result = { 'Software': exif['Software'] if 'Software' in exif else u'-',
- 'Desc': exif['Desc'] if 'Desc' in exif else u'-',
- 'Comment': exif['Comment'] if 'Comment' in exif else u'-',
- 'Producer': exif['Producer'] if 'Producer' in exif else u'-',
+ result = { 'Software': u'%s'%exif['Software'] if 'Software' in exif else u'-',
+ 'Desc': u'%s'%exif['Desc'] if 'Desc' in exif else u'-',
+ 'Comment': u'%s'%exif['Comment'] if 'Comment' in exif else u'-',
+ 'Producer': u'%s'%exif['Producer'] if 'Producer' in exif else u'-',
'Misc': u'\n'.join(misc) if misc else u'-',}
#'Output_Extension': exif['Output_extension'] if 'Output_extension' in exif else u'-',
#'DescProducer': exif['DescProducer'] if 'DescProducer' in exif else u'-',
@@ -1033,6 +1033,7 @@
enable_recovery() # enable recovery from hard crash
found = list(hog.detectMultiScale(img, 0.25, (8,8), (32,32), 1.05, 2))
disable_recovery() # disable since everything worked out fine
+ found = [item for item in found if item]
# people haar/cascaded classifier
# use 'haarcascade_fullbody.xml', ... also (like face detection)