Skip to content

Commit 1224820

Browse files
committed
果蔬连连看
1 parent cb7b0f2 commit 1224820

File tree

5 files changed

+44
-10
lines changed

5 files changed

+44
-10
lines changed

my-opencv玩游戏game/连连看/lian-1.py

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# -*- coding: utf-8 -*-
2+
# @Time : 2018/3/9 10:52
3+
# @Author : play4fun
4+
# @File : lian-1.py
5+
# @Software: PyCharm
6+
7+
"""
8+
lian-1.py:切割图片
9+
"""
10+
11+
import cv2
12+
13+
filename = 'lianliankan2.png'
14+
img = cv2.imread(filename, cv2.IMREAD_UNCHANGED)
15+
16+
size = img.shape
17+
print('size:', size) # (627, 554, 3)
18+
width = size[1]
19+
height = size[0]
20+
21+
cv2.imshow('src', img)
22+
cv2.waitKey(0)
23+
24+
# 分割,9行627,8列554
25+
x1 = 0
26+
y1 = 0
27+
xp = int(height / 9)
28+
yp = int(width / 8)
29+
for x2 in range(xp, height, xp):
30+
for y2 in range(yp, width, yp):
31+
cut = img[x1:x2, y1:y2]
32+
cv2.imshow('cut', cut)
33+
cv2.waitKey(10)
34+
35+
y1 = y2
36+
cv2.waitKey(1000)
37+
y1 = 0
38+
x1 = x2
39+
40+
cv2.waitKey(0)
41+
cv2.destroyAllWindows()

my-opencv玩游戏game/连连看/readme.md renamed to my08-opencv玩游戏game/连连看/readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
## 连连看
2+
3+
- 图片来源
4+
- iOS app:果蔬连连看
25
- 百科:https://zh.wikipedia.org/zh-hans/%E8%BF%9E%E8%BF%9E%E7%9C%8B
36

47
- 切割图片

0 commit comments

Comments
 (0)