python - SURF features for SVM in scikit learn -


i've been trying use surf features make classifier sklearn svm (to identify 1 class of objects). keep running problems dimensions of feature vectors. i've generated array of feature objects , array of descriptors use feature vector? tried passing features , descriptors directly parameters follows:

sd = cv2.featuredetector_create("surf") keypoints = sd.detect(img) kp,des = surf.compute(img, keypoints) model = svm.svc() model.fit(des,['type1']) 

do have extract attributes of features objects or descriptor array final feature vector? should dimension of feature vector? shouldn't array of vectors (one vector keypoint)?

i solved it. problem "flatten" multi dimension descriptor single dimension vector describes entire set of keypoints. resized image standard number of rows , columns , flattened out 2d grid of pixels single dimension array. every element in array uniquely identifies 1 pixel , takes values 1 or 0 (1 means keypoint). can extend array similar format if want add more descriptive features per keypoint (the value of array element in extension value of descriptive feature). makes 1 single dimension vector containing required feature information whole image.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -