Ask Your Question

krisscer's profile - activity

2017-09-04 15:26:51 -0600 received badge  Student (source)
2017-05-03 15:16:04 -0600 asked a question HOG Descriptor Documentation

Hi, does anyone know where can i find detailed opencv HOG descriptor documentation and also documentation for this method getDefaultPeopleDetector() ? OpenCV documentation is not detailed enough

thanks

2017-04-23 04:35:35 -0600 commented question convert numpy array

def predict(models, item): maxProb = 0.0 bestClass = "" for clazz, model in models.iteritems(): prob = predictSingle(model, item) if prob > maxProb: maxProb = prob bestClass = clazz print('predicting') return (bestClass, maxProb)

def predictSingle(model, item):
output = svm_predict([0], [item], model, "-q -b 1")
prob = output[2][0][0]
print('predicting single')
return prob

This is a snippet of the predict method and the predict single method it is using SVM

2017-04-17 10:50:11 -0600 asked a question convert numpy array

Hi I am loading an image from a file and i need to convert it from an numpy array to either a dictionary , list or tuple . Any suggestions pls ?

I am loading an image from a file using face = cv2.imread('faces/face.jpg') Then passing face to this method

results = classify(models,face)

def classify(models, dataSet):
    results = {}
    for trueClazz in CLASSES:
        count = 0
        correct = 0
        print("Class,Predicted Class,Problem")
        predClazz, prob = predict(models, dataSet)
        print "%s,%s,%f" % (trueClazz,predClazz, prob)
        count += 1
    print('classifying')
    return results

The error is :

  File "C:\Python27\lib\site-packages\svm.py", line 71, in gen_svm_nodearray
    raise TypeError('xi should be a dictionary, list or tuple')
TypeError: xi should be a dictionary, list or tuple
2017-03-17 03:52:49 -0600 commented question How to load an image dataset

I am using SVM , I have tree classes which are child , adult and senior . Each class has a dedicated folder filled with images

2017-03-17 03:47:40 -0600 received badge  Enthusiast
2017-03-16 12:55:33 -0600 asked a question How to load an image dataset

Hi guys , i am building an image classification application. I have the image dataset in separate folders , any idea how can i load the images so i will be able to train the classifier ? I am really new to this so a few pointers could be helpful!

Thanks

2017-03-16 12:52:41 -0600 commented question Create CSV file with images

yes it is in the python folder

2017-03-14 14:55:13 -0600 asked a question Create CSV file with images

Hi , I'm trying to follow the opencv fisherface tutorial and i want to create a csv file with images names and labels. When i type in the command python create_csv.py, the file is not being found. Where should i put the file ? Thanks Krista

2017-02-13 10:29:55 -0600 commented question HOG pedestrian Detection

it doesn't detect people

2017-02-13 10:29:54 -0600 answered a question HOG pedestrian Detection

it doesn't detect people

2017-02-09 02:15:15 -0600 asked a question HOG pedestrian Detection

Hi , i am try to implement a pedestrian detector. When i used a video the code below works perfectly fine but when i use my webcam it doesn't work. does anyone have a solution ? Thanks :)

def inside(r, q):
rx, ry, rw, rh = r
qx, qy, qw, qh = q
return rx > qx and ry > qy and rx + rw < qx + qw and ry + rh < qy + qh

def draw_detections(img, rects, thickness = 1):
for x, y, w, h in rects:
    # the HOG detector returns slightly larger rectangles than the real objects.
    # so we slightly shrink the rectangles to get a nicer output.
    pad_w, pad_h = int(0.15*w), int(0.05*h)
    cv2.rectangle(img, (x+pad_w, y+pad_h), (x+w-pad_w, y+h-pad_h), (0, 255, 0), thickness)

if __name__ == '__main__':

hog = cv2.HOGDescriptor()
hog.setSVMDetector( cv2.HOGDescriptor_getDefaultPeopleDetector() )
cap = cv2.VideoCapture(0)
while True:
    ret,frame=cap.read()
    found,w=hog.detectMultiScale(frame, winStride=(8,8), padding=(32,32), scale=1.05)
    draw_detections(frame,found)
    cv2.imshow('feed',frame)
    if cv2.waitKey(1) & 0xFF == ord('e'):
           break