Home | Trees | Indices | Help |
---|
|
1 # PyVision License 2 # 3 # Copyright (c) 2006-2008 David S. Bolme 4 # All rights reserved. 5 # 6 # Redistribution and use in source and binary forms, with or without 7 # modification, are permitted provided that the following conditions 8 # are met: 9 # 10 # 1. Redistributions of source code must retain the above copyright 11 # notice, this list of conditions and the following disclaimer. 12 # 13 # 2. Redistributions in binary form must reproduce the above copyright 14 # notice, this list of conditions and the following disclaimer in the 15 # documentation and/or other materials provided with the distribution. 16 # 17 # 3. Neither name of copyright holders nor the names of its contributors 18 # may be used to endorse or promote products derived from this software 19 # without specific prior written permission. 20 # 21 # 22 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 26 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 34 ''' 35 This module contains a methods for finding eyes in a face image. 36 The images passed to these methods are cropped images that have 37 come from a face detector. 38 ''' 39 40 from pyvision.types.Point import Point 41 from pyvision.vector import SVM 42 from pyvision.vector.RidgeRegression import KernelRidgeRegression 43 444681 82 8348 self.x_svm = SVM.SVM(svm_type=svm_type,**kwargs) 49 self.y_svm = SVM.SVM(svm_type=svm_type,**kwargs) 50 self.x_sum = 0.0 51 self.y_sum = 0.0 52 self.point_count = 05355 ''' 56 Pass in an image that is roughly centered on the feature, 57 and a true location of that feature in the image. 58 ''' 59 self.x_svm.addTraining(location.X(),image) 60 self.y_svm.addTraining(location.Y(),image) 61 62 self.x_sum += location.X() 63 self.y_sum += location.Y() 64 self.point_count += 16567 # compute the mean location 68 self.x_svm.train(**kwargs) 69 self.y_svm.train(**kwargs) 70 71 cx = self.x_sum/self.point_count 72 cy = self.y_sum/self.point_count 73 74 self.mean = Point(cx,cy)758512087 self.x_krr = KernelRidgeRegression(**kwargs) 88 self.y_krr = KernelRidgeRegression(**kwargs) 89 self.x_sum = 0.0 90 self.y_sum = 0.0 91 self.point_count = 09294 ''' 95 Pass in an image that is roughly centered on the feature, 96 and a true location of that feature in the image. 97 ''' 98 self.x_krr.addTraining(location.X(),image) 99 self.y_krr.addTraining(location.Y(),image) 100 101 self.x_sum += location.X() 102 self.y_sum += location.Y() 103 self.point_count += 1104106 # compute the mean location 107 self.x_krr.train(**kwargs) 108 self.y_krr.train(**kwargs) 109 110 cx = self.x_sum/self.point_count 111 cy = self.y_sum/self.point_count 112 113 self.mean = Point(cx,cy)114
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Tue Apr 21 14:32:01 2015 | http://epydoc.sourceforge.net |