gentoo/dev-python/simplecv/files/new-support-for-opencv-2.4.3-added.patch
Robin H. Johnson 56bd759df1
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.

This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.

Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
2015-08-08 17:38:18 -07:00

112 lines
4.8 KiB
Diff

From 164d39c1be66eb35b02fb7c30f65b5929c9e407d Mon Sep 17 00:00:00 2001
From: Vijay Mahantesh SM <vijay@vijay.(none)>
Date: Sat, 8 Dec 2012 01:55:24 +0530
Subject: [PATCH] new support for opencv 2.4.3 added
---
SimpleCV/ImageClass.py | 52 ++++++++++++++++++++++++++++++++------------------
1 file changed, 33 insertions(+), 19 deletions(-)
diff --git a/SimpleCV/ImageClass.py b/SimpleCV/ImageClass.py
index a545b50..6fab39a 100644
--- a/SimpleCV/ImageClass.py
+++ b/SimpleCV/ImageClass.py
@@ -7610,11 +7610,12 @@ class Image:
new_version = 0
#For OpenCV versions till 2.4.0, cv2.__versions__ are of the form "$Rev: 4557 $"
if not ver.startswith('$Rev:'):
- if int(ver.replace('.','0'))>=20400 :
- new_version = 1
- if int(ver.replace('.','0'))>=20402 :
- new_version = 2
-
+ if int(ver.replace('.','0'))>=20400:
+ new_version = 1
+ if int(ver.replace('.','0'))>=20402:
+ new_version = 2
+ if int(ver.replace('.','0'))>=20403:
+ new_version = 3
except:
logger.warning("Can't run Keypoints without OpenCV >= 2.3.0")
return
@@ -7622,11 +7623,11 @@ class Image:
if( forceReset ):
self._mKeyPoints = None
self._mKPDescriptors = None
-
- if( self._mKeyPoints is None or self._mKPFlavor != flavor ):
+
+ if( not(self._mKeyPoints) or self._mKPFlavor != flavor ):
if ( new_version == 0):
if( flavor == "SURF" ):
- surfer = cv2.SURF(thresh,_extended=highQuality,_upright=1)
+ surfer = cv2.SURF(thresh,_extended=highQuality,_upright=1)
self._mKeyPoints,self._mKPDescriptors = surfer.detect(self.getGrayNumpy(),None,False)
if( len(self._mKPDescriptors) == 0 ):
return None, None
@@ -7659,10 +7660,9 @@ class Image:
self._mKPDescriptors = None
self._mKPFlavor = "STAR"
del starer
-
-
- elif( new_version == 2 and flavor in ["SURF", "FAST"] ):
- if( flavor == "SURF" ):
+
+ elif( new_version >= 2 and flavor in ["SURF", "FAST"] ):
+ if( flavor == "SURF" and new_version==2):
surfer = cv2.SURF(hessianThreshold=thresh,extended=highQuality,upright=1)
#mask = self.getGrayNumpy()
#mask.fill(255)
@@ -7678,6 +7678,20 @@ class Image:
self._mKPFlavor = "SURF"
del surfer
+ if( flavor == "SURF" and new_version==3):
+ surfer = cv2.SURF(hessianThreshold=thresh,extended=highQuality,upright=1)
+ self._mKeyPoints,self._mKPDescriptors = surfer.detectAndCompute(self.getGrayNumpy(),None,useProvidedKeypoints = False)
+ if( len(self._mKPDescriptors) == 0 ):
+ return None, None
+
+ if( highQuality == 1 ):
+ self._mKPDescriptors = self._mKPDescriptors.reshape((-1,128))
+ else:
+ self._mKPDescriptors = self._mKPDescriptors.reshape((-1,64))
+
+ self._mKPFlavor = "SURF"
+ del surfer
+
elif( flavor == "FAST" ):
faster = cv2.FastFeatureDetector(threshold=int(thresh),nonmaxSuppression=True)
self._mKeyPoints = faster.detect(self.getGrayNumpy())
@@ -7693,19 +7707,19 @@ class Image:
if( len(self._mKPDescriptors) == 0 ):
return None, None
self._mKPFlavor = flavor
- del FeatureDetector
+ del FeatureDetector
elif( new_version >= 1 and flavor in ["FAST", "STAR", "MSER", "Dense"] ):
FeatureDetector = cv2.FeatureDetector_create(flavor)
self._mKeyPoints = FeatureDetector.detect(self.getGrayNumpy())
self._mKPDescriptors = None
self._mKPFlavor = flavor
- del FeatureDetector
-
- else:
- logger.warning("ImageClass.Keypoints: I don't know the method you want to use")
- return None, None
-
+ del FeatureDetector
+
+ else:
+ logger.warning("ImageClass.Keypoints: I don't know the method you want to use")
+ return None, None
+
return self._mKeyPoints,self._mKPDescriptors
def _getFLANNMatches(self,sd,td):
--
1.8.1.5