├── README.md └── src ├── IrisProcessing.py ├── IrisProcessing.pyc └── Main.py /README.md: -------------------------------------------------------------------------------- 1 | # irisRecognition -------------------------------------------------------------------------------- /src/IrisProcessing.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import cv2 3 | import math 4 | 5 | def captureVideoFromCamera(): 6 | cap = cv2.VideoCapture(0) 7 | 8 | while (True): 9 | # Capture frame-by-frame 10 | ret, frame = cap.read() 11 | 12 | # Our operations on thqe frame come here 13 | gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 14 | tryToShowPupil(gray) 15 | # Display the resulting frame 16 | cv2.imshow('frame', gray) 17 | if cv2.waitKey(1) & 0xFF == ord('q'): 18 | break 19 | 20 | # When everything done, release the capture 21 | cap.release() 22 | cv2.destroyAllWindows() 23 | 24 | #this method presents the image with some title 25 | #image = choosed image 26 | #title = title for choosed image 27 | def showImage(image,title): 28 | cv2.imshow(title, image) 29 | cv2.waitKey(0) 30 | cv2.destroyAllWindows() 31 | 32 | #This method draw circle on respective image 33 | #image = choosed image 34 | #circles = array of circles to draw 35 | #filled = boolean value that indicates if the circles will be filled with white color or not 36 | def drawCirclesOnImage(image,circles,filled=False): 37 | thickness = 2 38 | if filled: thickness = -1 39 | for i in circles: 40 | # draw the outer circle 41 | cv2.circle(image, (i[0], i[1]), i[2], (255, 255, 255), thickness, 2) 42 | # draw the center of the circle 43 | cv2.circle(image, (i[0], i[1]), 2, (255, 255, 255), thickness, 3) 44 | return image 45 | 46 | #Draw lines on image 47 | #image = choosed image 48 | #lines = array of lines to draw 49 | def drawLinesOnImage(image,lines): 50 | for rho, theta in lines[0]: 51 | a = np.cos(theta) 52 | b = np.sin(theta) 53 | x0 = a * rho 54 | y0 = b * rho 55 | x1 = int(x0 + 1000 * (-b)) 56 | y1 = int(y0 + 1000 * (a)) 57 | x2 = int(x0 - 1000 * (-b)) 58 | y2 = int(y0 - 1000 * (a)) 59 | cv2.line(image, (x1, y1), (x2, y2), (0, 0, 255), 2) 60 | return image 61 | 62 | #Draw a rectangle on a image 63 | #image = choosed image 64 | #topLefPoint = the top left corner point 65 | #width = width of rectangle 66 | #height = height of rectangle 67 | def drawRectangleOnImage(image,topLeftPoint,width,height): 68 | 69 | bottomRightPoint = (topLeftPoint[0]+width,topLeftPoint[1]+height) 70 | cv2.rectangle(image,topLeftPoint,bottomRightPoint,(255,255,255)) 71 | 72 | #returns a rectangle based on parameters 73 | #circle region 74 | #offSetBy a tuple with some values indicating how much it should be bigger or smaller than circle 75 | def rectangleOfCircle(circle,offSetBy=(0,0)): 76 | # rect with radio equal iris circle 77 | heightOne = int(circle[2] * 2 + offSetBy[1]) 78 | widthOne = int(circle[2] * 2 + offSetBy[0]) 79 | 80 | circleCenterXOne = circle[0] 81 | circleCenterYOne = circle[1] 82 | 83 | topLeftPointOne = (int(circleCenterXOne - widthOne / 2), int(circleCenterYOne - heightOne / 2)) 84 | return [topLeftPointOne[0],topLeftPointOne[1],widthOne,heightOne] 85 | 86 | #This method only calculates the distance between two points 87 | def __distanceBetweenPoints(px1,py1,px2,py2): 88 | a = (px2 - px1) ** 2 + (py2 - py1) ** 2 89 | b = math.sqrt(a) 90 | return b 91 | 92 | # this method codificates the iris region, preparing it to be saved and/or recognized 93 | # eyeImage = the original image with iris 94 | #pupilCircle = the circle that represents the pupil region 95 | #irisCircle = the circle that represents the iris region 96 | #showProcess = Boolean value that indicates if you want to see steps of process 97 | def __irisCodification(eyeImage,pupilCircle,irisCircle,showProcess=False): 98 | copyImage = eyeImage.copy() 99 | # rect inside iris circle 100 | # heightOne = int(irisCircle[2] - 5) 101 | # widthOne = int(math.sqrt((irisCircle[2] ** 2) - (heightOne ** 2)/4)*2) 102 | 103 | # rect with radio equal iris circle 104 | offSetBy = (0, -3*int(irisCircle[2] - pupilCircle[2])/2)#(widthOffset,heightOffset) 105 | rectOutIris = rectangleOfCircle(irisCircle,offSetBy) 106 | if showProcess: drawRectangleOnImage(copyImage, (rectOutIris[0],rectOutIris[1]), rectOutIris[2],rectOutIris[3]) # iris region rectangle 107 | 108 | 109 | rectOutPupil = rectangleOfCircle(pupilCircle) 110 | if showProcess: drawRectangleOnImage(copyImage, (rectOutPupil[0], rectOutPupil[1]), rectOutPupil[2], 111 | rectOutPupil[3]) # iris region rectangle 112 | 113 | # only iris region image 114 | irisRectImage = eyeImage[rectOutIris[1]:rectOutIris[1] + rectOutIris[3], 115 | rectOutIris[0]:rectOutIris[0] + rectOutIris[2]] 116 | 117 | cv2.imshow("cropped iris rect", irisRectImage) 118 | cv2.imshow("iris image", copyImage) 119 | cv2.waitKey(0) 120 | cv2.destroyAllWindows() 121 | 122 | 123 | #This method try to find iris outer countorn 124 | #eyeImage must have the pupil paited of black 125 | #pupilCircle = circle that represents the pupil region 126 | def __irisCircleOnImage(blackedPupilEyeImage,pupilCircle,showProcess): 127 | # eyeImage.shape[0] lines 128 | # eyeImage.shape[1] columns 129 | center = (blackedPupilEyeImage.shape[0] / 2, blackedPupilEyeImage.shape[1] / 2) 130 | processedImage = cv2.medianBlur(blackedPupilEyeImage, 11)#11#cv2.Canny(blackedPupilEyeImage, 5, 70, 3) # cv2.Canny(processedImage, 55, 60,3)# 131 | 132 | if showProcess: showImage(processedImage, "Canny Iris Image") 133 | 134 | #processedImage = cv2.GaussianBlur(processedImage, (9,9), 0,0) # cv2.GaussianBlur(eyeImage, (9, 9), 2, 2) 135 | 136 | #if showProcess: showImage(processedImage, "Blurred Iris Image") 137 | 138 | i = 30 139 | max = 100 140 | bestIrisCircle = None 141 | while (i < max and bestIrisCircle is None): 142 | print "tentativa "+str(i - 30) 143 | objCircles = cv2.HoughCircles(processedImage, cv2.HOUGH_GRADIENT, 2, center[0] / 2, 200, i, pupilCircle[2],int(pupilCircle[2] + 20)) 144 | if i == max - 1: 145 | print "teste" 146 | if objCircles is None: 147 | print"No Circles were found" 148 | elif objCircles.__len__() > 0: 149 | circles = objCircles[0] 150 | if circles.__len__() > 0: 151 | if circles.__len__() == 1: 152 | bestIrisCircle = circles[0] 153 | else: 154 | if bestIrisCircle is None: 155 | bestIrisCircle = circles[0] 156 | lastDistance = __distanceBetweenPoints(pupilCircle[0], pupilCircle[1], bestIrisCircle[0], 157 | bestIrisCircle[1]) 158 | for k in circles: 159 | d = __distanceBetweenPoints(pupilCircle[0], pupilCircle[1], k[0], k[1]) 160 | if d == 0 and k[2] > pupilCircle[2]: 161 | return k 162 | elif d < lastDistance: 163 | lastDistance = d 164 | bestIrisCircle = k 165 | 166 | i += 1 167 | 168 | print int(pupilCircle[2] + 20) 169 | print bestIrisCircle[2] 170 | #return bestIrisCircle 171 | return [pupilCircle[0],pupilCircle[1],bestIrisCircle[2]]#fixing some deviation on center 172 | 173 | def __irisCircleOnImageV1(blackedPupilEyeImage,pupilCircle,showProcess=False): 174 | # eyeImage.shape[0] lines 175 | # eyeImage.shape[1] columns 176 | 177 | center = (blackedPupilEyeImage.shape[0] / 2, blackedPupilEyeImage.shape[1] / 2) 178 | processedImage = cv2.medianBlur(blackedPupilEyeImage, 11) 179 | 180 | if showProcess: showImage(processedImage, "Median Blurred Iris Image") 181 | 182 | i = 30 183 | max = 100 184 | bestIrisCircle = None 185 | while (i < max and bestIrisCircle is None): 186 | print "tentativa "+str(i - 30) 187 | objCircles = cv2.HoughCircles(processedImage, cv2.HOUGH_GRADIENT, 2, center[0] / 2, 200, i, pupilCircle[2],int(pupilCircle[2] + 20)) 188 | if i == max - 1: 189 | print "teste" 190 | if objCircles is None: 191 | print"No Circles were found" 192 | elif objCircles.__len__() > 0: 193 | circles = objCircles[0] 194 | if circles.__len__() > 0: 195 | if circles.__len__() == 1: 196 | bestIrisCircle = circles[0] 197 | else: 198 | if bestIrisCircle is None: 199 | bestIrisCircle = circles[0] 200 | lastDistance = __distanceBetweenPoints(pupilCircle[0], pupilCircle[1], bestIrisCircle[0], 201 | bestIrisCircle[1]) 202 | for k in circles: 203 | d = __distanceBetweenPoints(pupilCircle[0], pupilCircle[1], k[0], k[1]) 204 | if d == 0 and k[2] > pupilCircle[2]: 205 | return k 206 | elif d < lastDistance: 207 | lastDistance = d 208 | bestIrisCircle = k 209 | 210 | i += 1 211 | 212 | print int(pupilCircle[2] + 20) 213 | print bestIrisCircle[2] 214 | #return bestIrisCircle 215 | return [pupilCircle[0],pupilCircle[1],bestIrisCircle[2]]#fixing some deviation on center 216 | 217 | 218 | #This method tries to find the region that corresponds to pupil 219 | def __pupilCircleOnImage(eyeImage,showProcess): 220 | if showProcess : showImage(eyeImage, "Original Iris Image") 221 | # eyeImage.shape[0] lines 222 | # eyeImage.shape[1] columns 223 | center = (eyeImage.shape[0] / 2, eyeImage.shape[1] / 2) 224 | aspectRatio = center[1]/center[0] 225 | baseKSize = 9 226 | blurKSize = (baseKSize,baseKSize) 227 | 228 | processedImage = eyeImage 229 | processedImage = cv2.GaussianBlur(processedImage, blurKSize, blurKSize[0]/2,blurKSize[1]/2) # cv2.GaussianBlur(eyeImage, (9, 9), 2, 2) 230 | 231 | if showProcess: showImage(processedImage, "Blurred Iris Image") 232 | 233 | # do not offer a really good improvement 234 | #processedImage = cv2.Canny(processedImage, 5, 70, 3) # cv2.Canny(processedImage, 55, 60,3)# 235 | #if showProcess: showImage(processedImage, "Canny Iris Image") 236 | 237 | print "primeira tentativa da pupila" 238 | # HoughCircles(gray, circles, CV_HOUGH_GRADIENT,2, gray->rows/4, 200, 100 );//center[0] / 2 239 | objCircles = cv2.HoughCircles(processedImage, cv2.HOUGH_GRADIENT, 2, center[0] / 2, 200, 100) 240 | # objCircles = cv2.HoughCircles(eyeImage, cv2.HOUGH_GRADIENT, 2, center[0] / 2, 200, 100) 241 | 242 | if objCircles is None: 243 | print "segunda tentativa da pupila" 244 | objCircles = cv2.HoughCircles(eyeImage, cv2.HOUGH_GRADIENT, 2, center[0] / 2, 200, 100) 245 | 246 | if objCircles is None: 247 | raise Exception("No Circles were found") 248 | elif objCircles.__len__() > 0: 249 | circles = objCircles[0] 250 | if circles.__len__() > 0: 251 | circle = circles[0] 252 | if circles.__len__() > 1: 253 | print("found "+str(circles.__len__())+" circles") 254 | lastDistance = __distanceBetweenPoints(center[0], center[1], circles[0][0], circles[0][1]) 255 | for i in circles: 256 | d = __distanceBetweenPoints(center[0], center[1], i[0], i[1]) 257 | if d < lastDistance: 258 | lastDistance = d 259 | circle = i 260 | return circle 261 | return objCircles 262 | 263 | #make all initial images work 264 | # working 265 | def __pupilCircleOnImageV1(eyeImage,showProcess): 266 | return __pupilCircleOnImage(eyeImage,showProcess) 267 | 268 | 269 | #make all initial images work on first trial 270 | # working 271 | def __pupilCircleOnImageV1_5(eyeImage,showProcess): 272 | if showProcess : showImage(eyeImage, "Original Iris Image") 273 | 274 | center = (eyeImage.shape[0] / 2, eyeImage.shape[1] / 2) 275 | baseKSize = 9 276 | blurKSize = (baseKSize,baseKSize) 277 | 278 | processedImage = eyeImage 279 | processedImage = cv2.GaussianBlur(processedImage, blurKSize, 3,3)# change 280 | 281 | if showProcess: showImage(processedImage, "Blurred Iris Image") 282 | 283 | 284 | print "primeira tentativa da pupila" 285 | objCircles = cv2.HoughCircles(processedImage, cv2.HOUGH_GRADIENT, 2, center[0] / 2, 200, 100) 286 | 287 | if objCircles is None: 288 | print "segunda tentativa da pupila" 289 | objCircles = cv2.HoughCircles(eyeImage, cv2.HOUGH_GRADIENT, 2, center[0] / 2, 200, 100) 290 | 291 | if objCircles is None: 292 | raise Exception("No Circles were found") 293 | elif objCircles.__len__() > 0: 294 | circles = objCircles[0] 295 | if circles.__len__() > 0: 296 | circle = circles[0] 297 | if circles.__len__() > 1: 298 | print("found "+str(circles.__len__())+" circles") 299 | lastDistance = __distanceBetweenPoints(center[0], center[1], circles[0][0], circles[0][1]) 300 | for i in circles: 301 | d = __distanceBetweenPoints(center[0], center[1], i[0], i[1]) 302 | if d < lastDistance: 303 | lastDistance = d 304 | circle = i 305 | return circle 306 | return objCircles 307 | 308 | 309 | 310 | #make all other images work 311 | def __pupilCircleOnImageV2(eyeImage,showProcess=False): 312 | width = eyeImage.shape[1] 313 | height = eyeImage.shape[0] 314 | average = np.median(eyeImage) 315 | center = (width / 2, height / 2) # change on 2 fixing 316 | 317 | if showProcess : showImage(eyeImage, "Original Iris Image") 318 | 319 | baseKSize = 9 320 | blurKSize = (baseKSize,baseKSize) 321 | #radius = width - 50 322 | #if height < width: radius = height 323 | #cv2.circle(processedImage, center, radius/2, (0, 0, 0), -1, 8,0) 324 | #cv2.ellipse(processedImage,center,(radius/2,radius/3),0,0,360,(255, 255, 255),-1,8) 325 | #cv2.rectangle(processedImage,(center[0] - radius/2,center[1] - radius/2),(center[0] + radius/2,center[1] + radius/2),(255, 255, 255),-1,8) 326 | #processedImage = eyeImage - processedImage 327 | #if showProcess: showImage(processedImage, "cutted Iris Image") 328 | 329 | # // Homogeneous 330 | # blur: 331 | # blur(image, dstHomo, Size(kernel_length, kernel_length), Point(-1, -1)); 332 | # // Gaussian 333 | # blur: 334 | # GaussianBlur(image, dstGaus, Size(kernel_length, kernel_length), 0, 0); 335 | # // Median 336 | # blur: 337 | # medianBlur(image, dstMed, kernel_length); 338 | # // Bilateral 339 | # blur: 340 | # bilateralFilter(image, dstBila, kernel_length, kernel_length * 2, kernel_length / 2); 341 | 342 | print "primeira tentativa da pupila" 343 | 344 | processedImage = cv2.GaussianBlur(eyeImage, blurKSize, 3,3)# change on 1_5 345 | #processedImage = cv2.bilateralFilter(processedImage,30,50,100,25) 346 | #processedImage = cv2.medianBlur(processedImage,7) 347 | #processedImage = cv2.blur(processedImage,(5,5),(-1,-1)) 348 | 349 | if showProcess: showImage(processedImage, "Gaussian Blurred Iris Image") 350 | 351 | #average = np.median(processedImage) 352 | #processedImage = cv2.inRange(processedImage,0,average)#inRange(original, Scalar(30,30,30), Scalar(80,80,80), mask_pupil); 353 | #if showProcess: showImage(processedImage, "Teste Image") 354 | 355 | # # do not offer a really good improvement 356 | # v = np.median(eyeImage) 357 | # # apply automatic Canny edge detection using the computed median 358 | # lower = int(max(0, (1.0 - 0.33) * v)) 359 | # upper = int(min(255, (1.0 - 0.33) * v)) 360 | # 361 | # processedImage = cv2.Canny(processedImage, lower,upper, 3)#cv2.Canny(processedImage, 40,170, 3) # cv2.Canny(processedImage, 55, 60,3)# 362 | # if showProcess: showImage(processedImage, "Canny Iris Image") 363 | 364 | objCircles = cv2.HoughCircles(processedImage, cv2.HOUGH_GRADIENT,2, center[0] / 2, 30, 151)#change on 2 works on all initial 365 | 366 | if objCircles is None: 367 | print "segunda tentativa da pupila" 368 | processedImage = cv2.bilateralFilter(eyeImage, 30, 50, 100, 25) 369 | if showProcess: showImage(processedImage, "Bilateral Filtered Iris Image") 370 | objCircles = cv2.HoughCircles(processedImage, cv2.HOUGH_GRADIENT, 2, center[0] / 2, 30,151) 371 | 372 | if objCircles is None: 373 | print "terceira tentativa da pupila" 374 | processedImage = cv2.medianBlur(eyeImage, 11)#11 375 | if showProcess: showImage(processedImage, "Median Blurred Iris Image") 376 | objCircles = cv2.HoughCircles(processedImage, cv2.HOUGH_GRADIENT,2, center[0] / 2, 30, 151)#change on 2 works on all initial 377 | 378 | if objCircles is None: 379 | print "quarta tentativa da pupila" 380 | if showProcess: showImage(eyeImage, "Original Iris Image") 381 | objCircles = cv2.HoughCircles(eyeImage, cv2.HOUGH_GRADIENT, 2, center[0] / 2, 200,200) # change on 2 works on all initial 382 | 383 | if objCircles is None: 384 | raise Exception("No Circles were found") 385 | elif objCircles.__len__() > 0: 386 | circles = objCircles[0] 387 | if circles.__len__() > 0: 388 | circle = circles[0] 389 | if circles.__len__() > 1: 390 | print("found "+str(circles.__len__())+" circles")# change on V2 391 | copiedImage = eyeImage.copy() 392 | drawCirclesOnImage(copiedImage,circles,False) 393 | showImage(copiedImage, "Found these ones") 394 | return circle 395 | return objCircles 396 | 397 | 398 | 399 | #not in use 400 | def __averageOfAreaOnCircle(image,circle): 401 | img = image.copy() 402 | 403 | y = int(circle[0]) - 1 - int(circle[2]) 404 | x = int(circle[1]) + 5 - int(circle[2]) 405 | 406 | crop_img = img[y:y + 2 * int(circle[2]), 407 | x:x + 2 * int(circle[2])] # Crop from x, y, w, h -> 100, 200, 300, 400 408 | #cv2.imshow("cropped", crop_img) 409 | #cv2.waitKey(0) 410 | return np.median(crop_img) 411 | 412 | 413 | #The image must be on gray scale 414 | #tenta encontrar a linha formada pelas palpebras 415 | def __eyelidsLines(eyeImage,showProcess): 416 | cannyImage = cv2.Canny(eyeImage, 50, 70, 3) 417 | if showProcess : showImage(cannyImage,"After Apply Canny") 418 | 419 | lines = cv2.HoughLines(cannyImage,1,np.pi/180,1) 420 | if lines is None: 421 | raise Exception("No Lines of eyelids where found") 422 | print "encontrou" + str(lines.__len__()) + " linhas" 423 | return lines 424 | 425 | 426 | 427 | 428 | #------------- 429 | 430 | 431 | #Finds the pupil on a image and draws a circle on a image presenting the pupil 432 | def tryToShowPupil(path): 433 | eyeImage = cv2.imread(path, cv2.IMREAD_GRAYSCALE) 434 | try: 435 | pupilCircle = __pupilCircleOnImageV2(eyeImage, True) 436 | drawCirclesOnImage(eyeImage,[pupilCircle]) 437 | showImage(eyeImage,"Circles found on Iris Image") 438 | except Exception, e: 439 | print e 440 | 441 | 442 | def showEyeLidsOnImageAtPath(path): 443 | eyeImage = cv2.imread(path, cv2.IMREAD_GRAYSCALE) 444 | showImage(eyeImage,"Original Image") 445 | try: 446 | lines = __eyelidsLines(eyeImage, True) 447 | drawLinesOnImage(eyeImage,lines) 448 | showImage(eyeImage, "Detected Lines of eyelids") 449 | except Exception, e: 450 | print e 451 | 452 | 453 | 454 | def segmentIrisOnImageAtPath(path): 455 | 456 | eyeImage = cv2.imread(path, cv2.IMREAD_GRAYSCALE) 457 | copyImage = eyeImage.copy() 458 | try: 459 | pupilCircle = __pupilCircleOnImageV2(copyImage,True) 460 | 461 | drawCirclesOnImage(copyImage,[pupilCircle],True) 462 | showImage(copyImage,"Painted pupil") 463 | 464 | irisCircle = __irisCircleOnImageV1(copyImage,pupilCircle,True) 465 | drawCirclesOnImage(copyImage,[irisCircle]) 466 | showImage(copyImage,"Circles for Iris found on Iris Image") 467 | 468 | __irisCodification(eyeImage,pupilCircle,irisCircle,True) 469 | 470 | except Exception, e: 471 | print e 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | -------------------------------------------------------------------------------- /src/IrisProcessing.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josechagas/irisRecognition/497743c0f88b5938cc3d33d29b9feed36285387b/src/IrisProcessing.pyc -------------------------------------------------------------------------------- /src/Main.py: -------------------------------------------------------------------------------- 1 | import IrisProcessing as irisP 2 | 3 | def pupilV1(): 4 | ###### Pupil 5 | 6 | irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L01.jpg") 7 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R01.jpg") 8 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L02.jpg")#2 9 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R02.jpg") 10 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L03.jpg") 11 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R03.jpg") 12 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L04.jpg") 13 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R04.jpg") 14 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R05.jpg") 15 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L05.jpg") 16 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R06.jpg") 17 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L06.jpg") 18 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R07.jpg") 19 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L07.jpg") 20 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L09.jpg") 21 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R09.jpg") 22 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R10.jpg") 23 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L10.jpg") 24 | 25 | 26 | def pupilV1_5(): 27 | ###### Pupil 28 | 29 | # initial 30 | irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L01.jpg") 31 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R01.jpg") 32 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L02.jpg") 33 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R02.jpg") 34 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L03.jpg") 35 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R03.jpg") 36 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L04.jpg") 37 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R04.jpg") 38 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R05.jpg") 39 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L05.jpg") 40 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R06.jpg") 41 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L06.jpg") 42 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R07.jpg") 43 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L07.jpg") 44 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L09.jpg") 45 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R09.jpg") 46 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R10.jpg") 47 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L10.jpg") 48 | 49 | 50 | 51 | def pupilV2(): 52 | ###### Pupil 53 | 54 | 55 | # # others 56 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/1.jpg")#2 57 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/2.jpg")#2 58 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/3.jpg")#3 59 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/4.jpg")#2 60 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/5.jpg")#2 61 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/6.jpg")#3 62 | irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/7.jpg")#not working 63 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/8.jpg")#not working 64 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/9.jpg")#3 65 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/10.jpg")#not working 66 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/11.jpg")#3 67 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/12.jpg")#2 68 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/13.jpg")#3 69 | # irisP.tryToShowPupil("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/14.jpg")#3 70 | 71 | 72 | def iris(): 73 | ##### Iris 74 | 75 | #Initial 76 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L01.jpg") 77 | irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R01.jpg") 78 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L02.jpg") 79 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R02.jpg") 80 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L03.jpg") 81 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R03.jpg") 82 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L04.jpg") 83 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R04.jpg") 84 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R05.jpg") 85 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L05.jpg") 86 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R06.jpg") 87 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L06.jpg") 88 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R07.jpg") 89 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L07.jpg") 90 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L08.jpg") 91 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R08.jpg") 92 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L09.jpg") 93 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R09.jpg") 94 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R10.jpg") 95 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L10.jpg") 96 | # 97 | # #others 98 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/1.jpg") 99 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/2.jpg") 100 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/3.jpg")#with canny 101 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/4.jpg") 102 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/5.jpg") 103 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/6.jpg") 104 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/7.jpg")#not working 105 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/8.jpg")#not working 106 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/9.jpg") 107 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/10.jpg")#not working 108 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/11.jpg") 109 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/12.jpg") 110 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/13.jpg") 111 | # irisP.segmentIrisOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/others/14.jpg") 112 | 113 | def eyelids(): 114 | ##### Iris 115 | 116 | #Initial 117 | irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001L01.jpg") 118 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001R01.jpg") 119 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001L02.jpg") 120 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001R02.jpg") 121 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001L03.jpg") 122 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001R03.jpg") 123 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001L04.jpg") 124 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001R04.jpg") 125 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001R05.jpg") 126 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001L05.jpg") 127 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001R06.jpg") 128 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001L06.jpg") 129 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001R07.jpg") 130 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001L07.jpg") 131 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001L08.jpg") 132 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001R08.jpg") 133 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001L09.jpg") 134 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001R09.jpg") 135 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001R10.jpg") 136 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/S1001L10.jpg") 137 | # 138 | # #others 139 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/others/1.jpg") 140 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/others/2.jpg") 141 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/others/3.jpg")#with canny 142 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/others/4.jpg") 143 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/others/5.jpg") 144 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/others/6.jpg") 145 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/others/7.jpg")#not working 146 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/others/8.jpg")#not working 147 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/others/9.jpg") 148 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/others/10.jpg")#not working 149 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/others/11.jpg") 150 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/others/12.jpg") 151 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/others/13.jpg") 152 | # irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/Images/iris/others/14.jpg") 153 | 154 | 155 | def main(): 156 | print "ola" 157 | 158 | 159 | ###### Pupil 160 | 161 | #pupilV1() 162 | #pupilV1_5() 163 | #pupilV2() 164 | 165 | ###### Iris 166 | iris() 167 | 168 | ###### Eyelids 169 | #eyelids() 170 | 171 | 172 | 173 | 174 | 175 | 176 | ######## Eyelids 177 | 178 | #irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L01.jpg") 179 | #irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R01.jpg") 180 | #irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L02.jpg") 181 | #irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R02.jpg") 182 | #irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001L03.jpg") 183 | #irisP.showEyeLidsOnImageAtPath("/Users/joseLucas/Desktop/Python Projects/IrisRecognition/Images/iris/S1001R03.jpg") 184 | 185 | 186 | main() --------------------------------------------------------------------------------