Ask Your Question

sheikha's profile - activity

2017-03-17 00:40:24 -0600 received badge  Enthusiast
2017-03-15 20:30:05 -0600 commented question SIFT in python 2.7.9 and opencv2 doesn't work

opencv 2.4.9 @berak

2017-03-14 14:06:45 -0600 asked a question SIFT in python 2.7.9 and opencv2 doesn't work

I tried a simple program to implement sift

import cv2
import numpy as np

img = cv2.imread('sheikha.jpg')
gray= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

sift = cv2.SIFT()
kp = sift.detect(gray,None)

img=cv2.drawKeypoints(gray,kp)

cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows()

but am getting an error

Traceback (most recent call last): File "sift.py", line 7, in <module> sift = cv2.SIFT() AttributeError: 'module' object has no attribute 'SIFT'

i tried replacing this line with sift = cv2.xfeatures2d.SIFT_create()

and still error

Traceback (most recent call last): File "sift.py", line 7, in <module> sift = cv2.xfeatures2d.SIFT_create() AttributeError: 'module' object has no attribute 'xfeatures2d'

please help!

2017-02-27 09:46:55 -0600 commented question I need to extract invariant features of iris from a normal picture

am currently trying with hd pictures, please help.. next week is the project submission and i have no other way

2017-02-26 11:20:00 -0600 asked a question I need to extract invariant features of iris from a normal picture

First with haar-cascade method face and eyes are detected (but eye detection is not applicable to all pictures, its even identifying more than 2 eyes or just 1 eye)

then with cv2.medianBlur(img,5) and cv2.Canny(img, 100, 100), input image is smoothened and edges are detected

next i have to apply hough circles to locate iris position inside eyes but fails.. please help .. here is my code


import numpy as np import cv2 face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassifier('haarcascade_eye_tree_eyeglasses.xml')

img = cv2.imread('sheikha.jpg',0) '''img = cv2.medianBlur(img,5)''' edges = cv2.Canny(img, 100, 100) faces = face_cascade.detectMultiScale( img, scaleFactor=1.3, minNeighbors=5, minSize=(30, 30)) print "Detected %d faces." % len(faces)

print "Drawing rectangles..." for (x, y, w, h) in faces: cv2.rectangle(img, (x, y), (x + w, y + h), (0,255,0), 2) eyes = eye_cascade.detectMultiScale(img, scaleFactor=1.3, minNeighbors=5,minSize=(10,10)) for (ex,ey,ew,eh) in eyes : cv2.rectangle(edges,(ex,ey),(ex+ew,ey+eh),(255,0,0),2)

        circles = cv2.HoughCircles(edges,cv2.cv.CV_HOUGH_GRADIENT,1,20,param1=50,param2=10,minRadius=2,maxRadius=15) 

        circles = np.uint16(np.around(circles))
        for i in circles[0,:]:
            cv2.circle(edges,(i[0],i[1]),i[2],(0,255,0),2)
            cv2.circle(edges,(i[0],i[1]),2,(0,0,255),3)

print "Drawn Rectangles." cv2.imshow('image',edges) cv2.waitKey(0) cv2.destroyAllWindows()

2017-02-26 11:13:28 -0600 commented answer OpenCV python: face crop program

not able to detect eyes.. i actually tried with single image.. please help