Permalink
Browse files

static/image

dip.py
final.py
  • Loading branch information...
1 parent a33b56a commit a567781411b662d9203da1af4037f9ed15813006 @firzendragon firzendragon committed Jun 26, 2011
Showing with 136,160 additions and 2,198 deletions.
  1. +21,991 −0 Mouth.xml
  2. +8,953 −0 Nariz.xml
  3. +52 −0 detection.py
  4. +12 −10 dip.py
  5. +246 −202 final.py
  6. BIN final.pyc
  7. +23,550 −0 haarcascade_frontalface_alt2.xml
  8. +10,930 −0 haarcascade_mcs_eyepair_big.xml
  9. +21,991 −0 haarcascade_mcs_mouth.xml
  10. +48,433 −0 haarcascade_mcs_nose.xml
  11. +0 −188 image/data_1/morph01and04.jpg.data
  12. +0 −88 image/data_1/morph01and21.jpg.data
  13. +0 −156 image/data_1/morph02and03.jpg.data
  14. +0 −156 image/data_1/morph03and02.jpg.data
  15. +0 −188 image/data_1/morph04and01.jpg.data
  16. +0 −156 image/data_1/morph04and06.jpg.data
  17. +0 −88 image/data_1/morph05and21.jpg.data
  18. +0 −156 image/data_1/morph06and04.jpg.data
  19. +0 −176 image/data_1/morph06and17.jpg.data
  20. +0 −140 image/data_1/morph10and18.jpg.data
  21. +0 −176 image/data_1/morph17and06.jpg.data
  22. +0 −140 image/data_1/morph18and10.jpg.data
  23. +0 −88 image/data_1/morph21and01.jpg.data
  24. +0 −88 image/data_1/morph21and05.jpg.data
  25. BIN image/morph01.jpg
  26. BIN image/morph02.jpg
  27. BIN image/morph03.jpg
  28. BIN image/morph04.jpg
  29. BIN image/morph05.jpg
  30. BIN image/morph06.jpg
  31. BIN image/morph09.jpg
  32. BIN image/morph10.jpg
  33. BIN image/morph11.jpg
  34. BIN image/morph13.jpg
  35. BIN image/morph15.jpg
  36. BIN image/morph16.jpg
  37. BIN image/morph17.jpg
  38. BIN image/morph18.jpg
  39. BIN image/morph19.jpg
  40. BIN image/morph20.jpg
  41. BIN static/image/01.jpeg
  42. BIN static/image/02.jpeg
  43. BIN static/image/03.jpeg
  44. BIN static/image/04.jpeg
  45. BIN static/image/05.jpeg
  46. BIN static/image/06.jpeg
  47. BIN static/image/morph01_Resized1.jpg
  48. +2 −2 static/index.html
View
Oops, something went wrong.
View
Oops, something went wrong.
View
@@ -0,0 +1,52 @@
+import sys, os
+from opencv.cv import *
+from opencv.highgui import *
+
+def detectObjects(image):
+ """Converts an image to grayscale and prints the locations of any
+ faces found"""
+ grayscale = cvCreateImage(cvSize(image.width, image.height), 8, 1)
+ cvCvtColor(image, grayscale, CV_BGR2GRAY)
+
+ storage = cvCreateMemStorage(0)
+ cvClearMemStorage(storage)
+ cvEqualizeHist(grayscale, grayscale)
+ #cascade = cvLoadHaarClassifierCascade('haarcascade_frontalface_alt2.xml', cvSize(1,1))
+ #cascade = cvLoadHaarClassifierCascade('haarcascade_frontalface_alt2.xml', cvSize(1,1))
+ cascade = cvLoadHaarClassifierCascade('haarcascade_frontalface_alt2.xml',cvSize(1,1))
+ cascade_eyes = cvLoadHaarClassifierCascade('haarcascade_mcs_eyepair_big.xml',cvSize(1,1))
+ cascade_nose = cvLoadHaarClassifierCascade('haarcascade_mcs_nose.xml',cvSize(1,1))
+ cascade_mouth = cvLoadHaarClassifierCascade('haarcascade_mcs_mouth.xml',cvSize(1,1))
+
+ #faces = cvHaarDetectObjects(img,cascade, storage, 1.2, 2, CV_HAAR_DO_CANNY_PRUNING, cvSize(20, 20));
+ #faces = cvHaarDetectObjects(grayscale, cascade, storage, 1.2, 2, CV_HAAR_DO_CANNY_PRUNING, cvSize(50,50))
+ faces = cvHaarDetectObjects(grayscale, cascade, storage, 1.2, 2, CV_HAAR_DO_CANNY_PRUNING, cvSize(50,50))
+ eyes = cvHaarDetectObjects(grayscale, cascade_eyes, storage, 1.15, 3, 0, cvSize(25,15))
+ nose = cvHaarDetectObjects(grayscale, cascade_nose, storage, 1.15, 3, 0, cvSize(25,15))
+ mouth = cvHaarDetectObjects(grayscale, cascade_mouth, storage, 1.15, 4, 0, cvSize(25,15))
+
+ print "faces"
+ if faces:
+ for f in faces:
+ print("[(%d,%d) -> (%d,%d)]" % (f.x, f.y, f.x+f.width, f.y+f.height))
+ print "eyes"
+ if eyes:
+ for f in eyes:
+ print("[(%d,%d) -> (%d,%d)]" % (f.x, f.y, f.x+f.width, f.y+f.height))
+ print "nose"
+ if nose:
+ for f in nose:
+ print("[(%d,%d) -> (%d,%d)]" % (f.x, f.y, f.x+f.width, f.y+f.height))
+ print "mouth"
+ if mouth:
+ for f in mouth:
+ print("[(%d,%d) -> (%d,%d)]" % (f.x, f.y, f.x+f.width, f.y+f.height))
+
+
+
+def main():
+ image = cvLoadImage(sys.argv[1]);
+ detectObjects(image)
+
+if __name__ == "__main__":
+ main()
View
@@ -21,22 +21,24 @@ def get(self):
def post(self):
print self.request.arguments
lines = []
- for x in self.request.arguments['lines'][0].split():
- tmp = x.split(',')
- line = [[float(tmp[0]), float(tmp[1])], [float(tmp[2]), float(tmp[3])]]
- lines.append(line)
- #print lines
+ if 'lines' in self.request.arguments:
+ for x in self.request.arguments['lines'][0].split():
+ tmp = x.split(',')
+ line = [[float(tmp[0]), float(tmp[1])], [float(tmp[2]), float(tmp[3])]]
+ lines.append(line)
+ #print lines
rlines = []
- for x in self.request.arguments['rlines'][0].split():
- tmp = x.split(',')
- rline = [[float(tmp[0]), float(tmp[1])], [float(tmp[2]), float(tmp[3])]]
- rlines.append(rline)
+ if 'rlines' in self.request.arguments:
+ for x in self.request.arguments['rlines'][0].split():
+ tmp = x.split(',')
+ rline = [[float(tmp[0]), float(tmp[1])], [float(tmp[2]), float(tmp[3])]]
+ rlines.append(rline)
#print rlines
out = final.inputImage(self.request.arguments['left'][0], self.request.arguments['right'][0], lines, rlines, 0.5, 1, 1, 2)
- out.save('test.jpg', quality = 100)
+ #out.save('test.jpg', quality = 100)
#jpg_temp = splitext(jpg1)[0]+"_Resized1.jpg"
#nim.save(jpg_temp, quality = 100)
Oops, something went wrong.

0 comments on commit a567781

Please sign in to comment.