Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 31 lines (23 sloc) 0.999 kb
a76c4b8 add detroit_test and opecvtest
Ted Hansen authored
1 import cv
2
3 cv.NamedWindow("ArenaScannerOrg", 1)
4 #cv.NamedWindow("ArenaScanner", 2)
5 capture = cv.CaptureFromCAM(0)
6 while True:
7 img = cv.QueryFrame(capture)
8 image_size = cv.GetSize(img)
9
10 ## grayscale = cv.CreateImage(image_size, 8, 1)
11 ## cv.CvtColor(img, grayscale, cv.CV_RGB2GRAY)
12
13 hc = cv.Load("C:\scratch\opencv\data\haarcascades\haarcascade_frontalface_default.xml")
14 faces = cv.HaarDetectObjects(img, hc, cv.CreateMemStorage())
15 for (x,y,w,h),n in faces:
16 cv.Rectangle(img, (x,y), (x+w,y+h), 255)
17
18
19 # imghsv = cv.CreateImage(image_size, 8, 3)
20 # cv.CvtColor(img, imghsv, cv.CV_BGR2HSV)
21 # imgThreshed = cv.CreateImage(image_size, 8, 1)
22 # cv.InRangeS(imghsv, cv.Scalar(20, 100, 100), cv.Scalar(30, 255, 255), imgThreshed) ##yellow
23
24
25 cv.ShowImage("ArenaScannerOrg", img)
26 #cv.ShowImage("ArenaScanner", imgThre)
27 if cv.WaitKey(10) == 27: #esc key
28 break
29 cv.DestroyWindow("ArenaScannerOrg")
30 #cv.DestroyWindow("ArenaScanner")
Something went wrong with that request. Please try again.