Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

100 150

AHnme Rlrrinn

Open adaptive_threshold_Img.py Save a 92% Ada..


1opencv/Blurring
adaptive_threshold_img-py 4_resize.py
1 inport cv2 book3.jpg
3 #img=cv2. inread(" people. jpg")
4 ing=cv2.imread("book. jpg")
5 resize=cv2. resize (img, (500, 700))
6 i=cv2.cvtColor (resize,cv2.COLOR_BGR2GRAY)
7 gaussian blur=cv2.GaussianBlur(i, (1,1),0)
8 adap=cV2. adaptiveThreshold (gaussian_blur, thresh
255,cv2.ADAPTIVE THRESH MEANC,cv2.THRESH BINARY, 25,30) otsu.jpg
9 cv2.inshow("Adaptive Thresholding" , adap)
10 cv2.imwrite"Adaptive Thresholding.jpg",adap
11 cv2.waitKey()
12
In My Dreams
13 #edge=cv2. Canny(adap,30, 150)
a 14 #cv2. imshow("Edge show",edge)
15 #cv2.waitKey(0) Ofall the things I've seen,
16
17 #edge=cv2. Canny (adap , 70,170) you make the most appearances in my dreams.
18 #cv2.inshow("Edge show",edge)
19 #cv2. waitKey (0)
20
21 #edge=cv2. Canny (adap , 50, 190)
22 #cv2. imshow("Edge show", edge)
23 #cv2.waitKey(0)

26
27 #cV2. imwrite("thresh_otsu. jpg", thresh1)
28 #cV2. waitKey()

Python v Tab Width: 8 Ln 10, Col 45 INS


Home ODencV Blurring Edge show

Open adaptive_thresholdimg.py Save


0 Rec -Jopencv/Blurring
adaptive_threshold_img.py 4_resize.py contours1.py

est 2
Iimport cv2
img.py
La
3 #img=cv2. imread(" people.jpg")
4 ing=cv2.imread("class. jpg")
5 resize=cv2.resiz , (500,
1ze(tng,(
St 6 i=cv2.cvtColor (resize cu2 COL 0BBGR2GRAY)
gaussian blur=cv2.GaussianBlur (i,(1,1),0)
est 8 adap=cv2.adaptiveThreshold (gaussian blur,
esti 255,cv2.ADAPTIVE_THRESH_ MEAN_C, Cv2.THRESH_BINARY,25,30) ing. py
9 edge=cV2.Canny (adap, 50, 190)
D 10 cv2.imshow(" Edge show",edge)
11 cv2.waitKey (0)
12

13 #cv2.imwrite("Adaptive Thresholding. jpg", adap)


14 #Cv2.waitKey()
15
16 #edge=cv2. Canny(adap, 30, 150)
17 #cv2. imshow("Edge show",edge)
18 #cv2.waitKey(0)
19
20 #edge=cv2.Canny (adap, 70, 170)
21 #cV2. imshow(" Edge show",edge)
22 #Cv2.waitKey (0)
23

24 #edge-cv2. Canny(adap ,50, 190)


25 #cV2.imshow("Edge show",edge)
26 #Cv2.waitKey (0)
27
28
29
30 #cv2.imwrite("thresh otsu.ina"thresh1)
Python v Tab Width: 8 Ln 4, Col 22 INS
Open face.py Save
-1opencv/recog
Video X

4_resize.py contours1.py face.py


1 Lmport cv2
2 Lmport os
3

4 cascPath=os . path.dirname(cv2._file_)+"/data/
haarcascade_frontalface_default.xml"
5 faceCascade = cv2.CascadeClassifier (cascPath)
6
7 video_capture = cv2.VideoCapture (0)
9 while True:
10 # Capture frame -by -frame
11 ret, frames = video_capture . read()
12
13 gray = cv2.cvtColor (frames, cV2.COLOR_BGR2GRAY)
14
15 faces = faceCascade.detectMultiScale(
16 gray,
17 scaleFactor=1.1,
18 minNeighbors=5,
minSize=(30, 30),
2 flags=cv2.CASCADE_SCALE_IMAGE
21 )
22
23 # Draw a rectangle around the faces
24 for (x, y, w, h) in faces:
25 cV2.rectangle(frames, (x, y), (x+W, y+h), (0, 255, 0), 2)
26
# the resulting frane
27
28 D0spLay
cV2.imshow( deo', frames) (x=128, y=3) -R:77 G:79 B:65
29
1if cv2.waitKev(1) & 0xEF == 0 r d a ) :
Python Tab Width: 8 Ln 1, Col 1 INS

You might also like