diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 5f994e23..677247e4 100755 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,13 @@ - + + + + + + + @@ -27,6 +33,16 @@ + + + + + + + + + + @@ -37,28 +53,28 @@ - - + + - - + + - - + + - - + + - - + + @@ -67,8 +83,8 @@ - - + + @@ -77,8 +93,8 @@ - - + + @@ -87,8 +103,8 @@ - - + + @@ -97,8 +113,8 @@ - - + + @@ -107,8 +123,8 @@ - - + + @@ -159,7 +175,6 @@ @@ -896,105 +916,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1091,17 +1012,92 @@ - - - + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -1116,16 +1112,26 @@ - + - - + + - + + + + + + + + + + + @@ -1154,7 +1160,7 @@ - + @@ -1162,7 +1168,7 @@ - + @@ -1170,7 +1176,7 @@ - + @@ -1178,7 +1184,7 @@ - + @@ -1186,7 +1192,7 @@ - + @@ -1194,15 +1200,31 @@ - + - - + + - + + + + + + + + + + + + + + + + + @@ -1210,7 +1232,7 @@ - + @@ -1218,7 +1240,7 @@ - + @@ -1226,7 +1248,15 @@ - + + + + + + + + + @@ -1234,7 +1264,7 @@ - + @@ -1242,7 +1272,15 @@ - + + + + + + + + + @@ -1250,7 +1288,7 @@ - + @@ -1258,7 +1296,7 @@ - + @@ -1266,7 +1304,7 @@ - + @@ -1274,7 +1312,7 @@ - + @@ -1282,7 +1320,7 @@ - + diff --git "a/ch04-\345\233\276\347\211\207/4.1_imread_imshow.py" "b/ch04-\345\233\276\347\211\207/4.1_imread_imshow.py" index 5e2af2f0..889a1276 100755 --- "a/ch04-\345\233\276\347\211\207/4.1_imread_imshow.py" +++ "b/ch04-\345\233\276\347\211\207/4.1_imread_imshow.py" @@ -3,15 +3,15 @@ import numpy as np import cv2 -print cv2.__version__ +print(cv2.__version__) # Load an color image in grayscale -img = cv2.imread('messi5.jpg',0) +img = cv2.imread('messi5.jpg', 0) img.I -cv2.namedWindow('image',cv2.WINDOW_NORMAL) -cv2.imshow('image',img) +cv2.namedWindow('image', cv2.WINDOW_NORMAL) +cv2.imshow('image', img) cv2.waitKey(0) cv2.destroyAllWindows() # -cv2.imwrite('messigray.png',img) \ No newline at end of file +cv2.imwrite('messigray.png', img) diff --git "a/ch09-\345\233\276\345\203\217\347\232\204\345\237\272\347\241\200\346\223\215\344\275\234/9.itemset.py" "b/ch09-\345\233\276\345\203\217\347\232\204\345\237\272\347\241\200\346\223\215\344\275\234/9.itemset.py" index 57db2a30..1c2bf270 100755 --- "a/ch09-\345\233\276\345\203\217\347\232\204\345\237\272\347\241\200\346\223\215\344\275\234/9.itemset.py" +++ "b/ch09-\345\233\276\345\203\217\347\232\204\345\237\272\347\241\200\346\223\215\344\275\234/9.itemset.py" @@ -3,6 +3,6 @@ import numpy as np img=cv2.imread('../data/messi5.jpg') -print img.item(10,10,2) +print (img.item(10,10,2)) img.itemset((10,10,2),100) -print img.item(10,10,2) +print (img.item(10,10,2)) diff --git "a/ch09-\345\233\276\345\203\217\347\232\204\345\237\272\347\241\200\346\223\215\344\275\234/9.shape.py" "b/ch09-\345\233\276\345\203\217\347\232\204\345\237\272\347\241\200\346\223\215\344\275\234/9.shape.py" index 4afc06fc..9cad14ee 100755 --- "a/ch09-\345\233\276\345\203\217\347\232\204\345\237\272\347\241\200\346\223\215\344\275\234/9.shape.py" +++ "b/ch09-\345\233\276\345\203\217\347\232\204\345\237\272\347\241\200\346\223\215\344\275\234/9.shape.py" @@ -2,13 +2,11 @@ import cv2 import numpy as np +img = cv2.imread('../data/messi5.jpg', 0) # gray +print(img.shape) -img=cv2.imread('../data/messi5.jpg',0)#gray -print img.shape - -img=cv2.imread('../data/messi5.jpg') -print img.shape - -print img.size -print img.dtype +img = cv2.imread('../data/messi5.jpg') +print(img.shape) +print(img.size) +print(img.dtype) diff --git "a/ch11-\347\250\213\345\272\217\346\200\247\350\203\275\346\243\200\346\265\213\345\217\212\344\274\230\345\214\226/11.getTickCount.py" "b/ch11-\347\250\213\345\272\217\346\200\247\350\203\275\346\243\200\346\265\213\345\217\212\344\274\230\345\214\226/11.getTickCount.py" index 605ccbc0..3cd6871f 100755 --- "a/ch11-\347\250\213\345\272\217\346\200\247\350\203\275\346\243\200\346\265\213\345\217\212\344\274\230\345\214\226/11.getTickCount.py" +++ "b/ch11-\347\250\213\345\272\217\346\200\247\350\203\275\346\243\200\346\265\213\345\217\212\344\274\230\345\214\226/11.getTickCount.py" @@ -5,9 +5,9 @@ img1 = cv2.imread('../data/ml.jpg') e1 = cv2.getTickCount() -for i in xrange(5,49,2): +for i in range(5,49,2): img1 = cv2.medianBlur(img1,i) e2 = cv2.getTickCount() t = (e2 - e1)/cv2.getTickFrequency() -print t +print (t) # Result I got is 0.521107655 seconds \ No newline at end of file diff --git "a/ch13-\351\242\234\350\211\262\347\251\272\351\227\264\350\275\254\346\215\242/13.find_object_hsv.py" "b/ch13-\351\242\234\350\211\262\347\251\272\351\227\264\350\275\254\346\215\242/13.find_object_hsv.py" index 5f2aeb3d..d7b5ad43 100755 --- "a/ch13-\351\242\234\350\211\262\347\251\272\351\227\264\350\275\254\346\215\242/13.find_object_hsv.py" +++ "b/ch13-\351\242\234\350\211\262\347\251\272\351\227\264\350\275\254\346\215\242/13.find_object_hsv.py" @@ -18,10 +18,10 @@ #的三层括号应 分别对应于 cvArray cvMat IplImage green=np.uint8([[[0,255,0]]]) hsv_green=cv2.cvtColor(green,cv2.COLOR_BGR2HSV) -print hsv_green +print (hsv_green) #[[[60 255 255]]] black=np.uint8([[[0,0,0]]]) hsv_black=cv2.cvtColor(black,cv2.COLOR_BGR2HSV) -print hsv_black +print (hsv_black) #[[[0 0 0]]] \ No newline at end of file