Skip to content

Commit fbe6535

Browse files
committed
drew color
1 parent 21a5921 commit fbe6535

6 files changed

Lines changed: 151 additions & 1 deletion

File tree

default

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
##
2+
# You should look at the following URL's in order to grasp a solid understanding
3+
# of Nginx configuration files in order to fully unleash the power of Nginx.
4+
# http://wiki.nginx.org/Pitfalls
5+
# http://wiki.nginx.org/QuickStart
6+
# http://wiki.nginx.org/Configuration
7+
#
8+
# Generally, you will want to move this file somewhere, and start with a clean
9+
# file but keep this around for reference. Or just disable in sites-enabled.
10+
#
11+
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
12+
##
13+
14+
# Default server configuration
15+
#
16+
server {
17+
listen 80 default_server;
18+
listen [::]:80 default_server;
19+
20+
# SSL configuration
21+
#
22+
# listen 443 ssl default_server;
23+
# listen [::]:443 ssl default_server;
24+
#
25+
# Self signed certs generated by the ssl-cert package
26+
# Don't use them in a production server!
27+
#
28+
# include snippets/snakeoil.conf;
29+
30+
root /var/www/html;
31+
32+
# Add index.php to the list if you are using PHP
33+
index index.html index.htm index.nginx-debian.html;
34+
35+
server_name _;
36+
37+
location / {
38+
# First attempt to serve request as file, then
39+
# as directory, then fall back to displaying a 404.
40+
try_files $uri $uri/ =404;
41+
}
42+
43+
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
44+
#
45+
#location ~ \.php$ {
46+
# include snippets/fastcgi-php.conf;
47+
#
48+
# # With php5-cgi alone:
49+
# fastcgi_pass 127.0.0.1:9000;
50+
# # With php5-fpm:
51+
# fastcgi_pass unix:/var/run/php5-fpm.sock;
52+
#}
53+
54+
# deny access to .htaccess files, if Apache's document root
55+
# concurs with nginx's one
56+
#
57+
#location ~ /\.ht {
58+
# deny all;
59+
#}
60+
}
61+
62+
63+
# Virtual Host configuration for example.com
64+
#
65+
# You can move that to a different file under sites-available/ and symlink that
66+
# to sites-enabled/ to enable it.
67+
#
68+
#server {
69+
# listen 80;
70+
# listen [::]:80;
71+
#
72+
# server_name example.com;
73+
#
74+
# root /var/www/example.com;
75+
# index index.html;
76+
#
77+
# location / {
78+
# try_files $uri $uri/ =404;
79+
# }
80+
#}

python_game/5.image/color.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#coding:utf-8
2+
import pygame
3+
from pygame.locals import *
4+
from sys import exit
5+
6+
pygame.init()
7+
screen = pygame.display.set_mode((640,480),0,32)
8+
#画个窗口
9+
color1 = (221,99,20)
10+
color2 = (96,130,51)
11+
12+
factor = 0
13+
def blend_color(color1,color2,blend_factor):
14+
r1,g1,b1 = color1
15+
r2,g2,b2 = color2
16+
r = r1 +(r2 -r1)* blend_factor
17+
g = g1 +(g2 -g1)* blend_factor
18+
b = b1 +(b2 -b1)* blend_factor
19+
return int(r),int(g),int(b)
20+
#此函数是为了每次计算新的颜色数据
21+
while True:
22+
23+
for event in pygame.event.get():
24+
if event.type == QUIT:
25+
exit()
26+
27+
screen.fill((255,255,255))
28+
#屏幕的底色
29+
tri = [(0,120),(639,100),(639,140)]
30+
#
31+
pygame.draw.polygon(screen,(0,255,0),tri)
32+
#画出那个绿色的锥心
33+
pygame.draw.circle(screen,(0,0,0),(int(factor*639.0),120),10)
34+
#画出那个黑球
35+
x,y = pygame.mouse.get_pos()
36+
#获取鼠标位置
37+
if pygame.mouse.get_pressed()[0]:
38+
factor = x/639.0
39+
pygame.display.set_caption("pygame color blend test - %.3f" % factor)
40+
#获取当前鼠标把球移动到的坐标,然后修改窗口标题
41+
color = blend_color(color1 ,color2,factor)
42+
#修改颜色
43+
pygame.draw.rect(screen,color,(0,240,640,240))
44+
#画出这个区域,1
45+
pygame.display.update()

python_opencv/0.jpg

-100 KB
Binary file not shown.

python_opencv/1.jpg

-99.8 KB
Binary file not shown.

python_opencv/1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#视频中的图片一张张写入
1717
video.write(img)
1818
cv2.imshow('Video',img)
19-
key=cv2.waitKey(1)#里面数字为delay时间,如果大于0为刷新时间,
19+
key=cv2.waitKey(3)#里面数字为delay时间,如果大于0为刷新时间,
2020
#超过指定时间则返回-1,等于0没有返回值,但也可以读取键盘数值,
2121
cv2.imwrite('%s.jpg'%(str(num)),img)
2222
num=num+1

python_opencv/1.py~

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#coding:utf-8
2+
import cv2
3+
4+
capture=cv2.VideoCapture(0)
5+
#将capture保存为motion-jpeg,cv_fourcc为保存格式
6+
size = (int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)),
7+
int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)))
8+
#cv_fourcc值要设置对,不然无法写入,而且不报错,坑
9+
video=cv2.VideoWriter("VideoTest.avi", cv2.cv.CV_FOURCC('I','4','2','0'), 30, size)
10+
#isopened可以查看摄像头是否开启
11+
print capture.isOpened()
12+
num=0
13+
#要不断读取image需要设置一个循环
14+
while True:
15+
ret,img=capture.read()
16+
#视频中的图片一张张写入
17+
video.write(img)
18+
cv2.imshow('Video',img)
19+
key=cv2.waitKey(1)#里面数字为delay时间,如果大于0为刷新时间,
20+
#超过指定时间则返回-1,等于0没有返回值,但也可以读取键盘数值,
21+
cv2.imwrite('%s.jpg'%(str(num)),img)
22+
num=num+1
23+
if key==ord('q'):#ord为键盘输入对应的整数,
24+
break
25+
video.release()

0 commit comments

Comments
 (0)