Skip to content

Commit 6a2fb85

Browse files
committed
添加博客
1 parent 6a590c3 commit 6a2fb85

File tree

6 files changed

+266
-44
lines changed

6 files changed

+266
-44
lines changed

_config.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ keywords: "dotnet,python,C#,linux,js,jquery,javascript,开发者,程序猿,程
1414
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
1515
url: https://gxwang.gitee.io/
1616
root: /
17-
permalink: :year/:month/:day/:title/
17+
permalink: :title/
18+
#permalink: :year/:month/:day/:title/
1819
tag_dir: tags
1920
archive_dir: archives
2021
category_dir: categories
@@ -99,17 +100,17 @@ exclude_generator:
99100
# branch: master
100101

101102
#部署至github
102-
# deploy:
103-
# type: git
104-
# repository: git@github.com:edsiongithub/edsiongithub.github.io
105-
# branch: master
106-
107-
#部署至gitee
108103
deploy:
109104
type: git
110-
repository: git@gitee.com:gxwang/gxwang.git
105+
repository: git@github.com:edsiongithub/edsiongithub.github.io
111106
branch: master
112107

108+
#部署至gitee
109+
# deploy:
110+
# type: git
111+
# repository: git@gitee.com:gxwang/gxwang.git
112+
# branch: master
113+
113114

114115
sitemap:
115116
path: sitemap.xml

source/_posts/2021-09-16 powershell.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,5 @@ powershell默认背景色为蓝色,连接到Linux后,由于linux中的目录
4646

4747
![修改powershell背景色](http://gxwang.gitee.io/blogimages/20210916/backgroundcolor.png)
4848

49+
50+
如果你是从任务栏固定打开的,可以在任务栏上右键powershell,在属性设置页面中选择颜色面板,修改背景颜色即可。
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
title: python实现简单的人脸识别
3+
date: 2021-10-09 14:04:00
4+
tags:
5+
- opencv-python
6+
- 人脸识别
7+
---
8+
9+
想做一个简单的人脸识别,大概的需求:通过笔记本的摄像头获取人脸,根据已保存的图片标签(文件名以名字命名),识别出面部后,将名字打印在摄像头的获取界面。
10+
11+
搜索后确定技术方案:python + opencv + face_recognition
12+
<!--more-->
13+
14+
## python 人脸识别
15+
16+
安装需要的包:
17+
```
18+
pip install opencv-python
19+
pip install pillow
20+
pip install dlib
21+
pip install face_recognition
22+
```
23+
创建facerecognition.py文件,使用下面的代码。在代码文件目录下创建images文件夹,里面放入自己照片,并用名字命名照片。
24+
另外,需要从```C:\Windows\Fonts```目录中拷贝宋体的字体文件(simsun.ttc)放在代码同目录下。
25+
26+
```python
27+
import numpy as np
28+
import face_recognition
29+
import cv2
30+
import os
31+
from PIL import ImageFont, ImageDraw, Image
32+
33+
def cv2AddChineseText(img, text, position, textColor=(0, 255, 0), textSize=30):
34+
if (isinstance(img, np.ndarray)): # 判断是否OpenCV图片类型
35+
img = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
36+
# 创建一个可以在给定图像上绘图的对象
37+
draw = ImageDraw.Draw(img)
38+
# 字体的格式
39+
fontStyle = ImageFont.truetype(
40+
"simsun.ttc", textSize, encoding="utf-8")
41+
# 绘制文本
42+
draw.text(position, text, textColor, font=fontStyle)
43+
# 转换回OpenCV格式
44+
return cv2.cvtColor(np.asarray(img), cv2.COLOR_RGB2BGR)
45+
46+
47+
def face(path):
48+
#存储知道人名列表
49+
known_names=[]
50+
#存储知道的特征值
51+
known_encodings=[]
52+
for image_name in os.listdir(path):
53+
load_image = face_recognition.load_image_file(path+image_name) #加载图片
54+
image_face_encoding = face_recognition.face_encodings(load_image)[0] #获得128维特征值
55+
known_names.append(image_name.split(".")[0])
56+
known_encodings.append(image_face_encoding)
57+
58+
59+
#打开摄像头,0表示内置摄像头
60+
video_capture = cv2.VideoCapture(0)
61+
process_this_frame = True
62+
while True:
63+
ret, frame = video_capture.read()
64+
# opencv的图像是BGR格式的,而我们需要是的RGB格式的,因此需要进行一个转换。
65+
rgb_frame = frame[:, :, ::-1]
66+
if process_this_frame:
67+
face_locations = face_recognition.face_locations(rgb_frame)#获得所有人脸位置
68+
face_encodings = face_recognition.face_encodings(rgb_frame, face_locations) #获得人脸特征值
69+
face_names = [] #存储出现在画面中人脸的名字
70+
for face_encoding in face_encodings:
71+
matches = face_recognition.compare_faces(known_encodings, face_encoding,tolerance=0.5)
72+
if True in matches:
73+
first_match_index = matches.index(True)
74+
name = known_names[first_match_index]
75+
else:
76+
name="unknown"
77+
face_names.append(name)
78+
79+
process_this_frame = not process_this_frame
80+
81+
# 将捕捉到的人脸显示出来
82+
for (top, right, bottom, left), name in zip(face_locations, face_names):
83+
cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2) # 画人脸矩形框
84+
# 加上人名标签
85+
cv2.rectangle(frame, (left, bottom - 35), (right, bottom), (0, 0, 255), cv2.FILLED)
86+
frame=cv2AddChineseText(frame, '我猜你叫:' + name, (left + 6, bottom - 6),(255, 255, 255), 30)
87+
cv2.imshow('frame', frame)
88+
if cv2.waitKey(1) & 0xFF == ord('q'):
89+
break
90+
91+
video_capture.release()
92+
cv2.destroyAllWindows()
93+
94+
95+
96+
if __name__=='__main__':
97+
face("./images/") #存放已知图像路径
98+
```
99+
100+
101+
测试识别结果,在images目录下放一张自己的图片,文件名以名字命名,测试结果如下:
102+
![识别结果](https://raw.githubusercontent.com/edsiongithub/blogimages/master/20210831/%E8%AF%86%E5%88%AB%E7%BB%93%E6%9E%9C.png)
103+
104+
## 踩过的坑
105+
1. 安装dlib时遇到的坑
106+
安装dlib时报错:需要安装cmake。
107+
```
108+
pip install cmake
109+
```
110+
如果cmake已经在python目录下的sitepackages中,则更新pip。
111+
```
112+
pip install -U --force-reinstall pip -user
113+
```
114+
接下来安装dlib就可以了。cmake需要编译,这个时候CPU消耗会很大,机器比较卡。
115+
116+
2. 在摄像头捕捉界面显示中文乱码
117+
cv1.putText可以用来输出文字在图像捕获框上,但输出中文时变成乱码了。此时,可以通过将中文画成图像,再输出到图像捕获框上。封装一个cv2AddChineseText函数即可。
118+
119+
参考:
120+
python人脸识别:<a href="https://zhuanlan.zhihu.com/p/79784400">https://zhuanlan.zhihu.com/p/79784400</a>
121+
安装dlib错误<a href="https://blog.csdn.net/SunshinePluto/article/details/116177270">https://blog.csdn.net/SunshinePluto/article/details/116177270</a>
122+
显示中文乱码<a href="https://blog.csdn.net/hijacklei/article/details/116010860">https://blog.csdn.net/hijacklei/article/details/116010860</a>
123+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: windows上使用netsh映射端口至Hyper-v虚拟机
3+
date: 2021-10-18 08:17:11
4+
layout: 2021-10-18 08:17:11
5+
tags:
6+
- windowns
7+
- netsh proxy
8+
---
9+
10+
前段时间折腾Hyper-v虚拟机的双网卡功能,按照某些教程,理论上一个内部网络接口,一个外部网络接口,是能够满足需求了的。
11+
12+
13+
<!--more-->
14+
15+
微软提供了一个<a href="https://docs.microsoft.com/zh-cn/windows-server/networking/technologies/netsh/netsh">Network Shell工具</a>,官方文档上给出的定义如下:
16+
>Network shell (netsh) 是一种命令行实用工具,使用该工具,你可以在运行 Windows Server 的计算机上安装网络通信服务器组件之后配置和显示各种网络通信服务器角色和组件的状态。
17+
18+
>一些客户端技术,例如动态主机配置协议 (DHCP) 客户端和BranchCache,也提供 netsh 命令,通过这些命令,你可以配置运行 Windows 10 的客户端计算机。
19+
20+
>在大多数情况下,netsh 命令提供的功能与你使用每个网络服务器角色或网络功能的 Microsoft 管理控制台 (MMC) 管理单元时提供的功能相同。 例如,可以使用 NPS MMC 管理单元或 netsh nps 上下文中的 netsh 命令来配置网络策略服务器 (NPS) 。
21+
22+
23+
直接进入实际操作。比如我的环境如下:
24+
* 台式主机:windows10 , IP ```202.120.xx.xx```
25+
* Hyper-v虚拟机:Linux Ubuntu20 , IP地址```192.168.137.38```
26+
* 笔记本:windows10, IP ```202.120.xx.xxx```
27+
实际情况是,我只能在台式主机上连接我的Hyper-v虚拟机,用下面的命令,在台式机主机上创建一个代理,这样笔记本通过连接台式机的IP地址,即可通过台式机转发至虚拟机的特定端口上了。
28+
29+
把虚拟机的80端口映射出来,这样访问台式机的80端口(前提台式机的端口不能被占用),就相当于访问虚拟机的80端口了。
30+
```
31+
netsh interface portproxy add v4tov4 listenport=80 connectport=80 connectaddress=192.168.137.38
32+
```
33+
比如我想通过笔记本直接ssh连接Hyper-V上的Linux虚拟机,我只需要添加22端口的映射,在笔记本上直接ssh台式机的IP地址,即可访问到Hyper-v虚拟机了。
34+
```
35+
netsh interface portproxy add v4tov4 listenport=22 connectport=22 connectaddresss=192.168.137.38
36+
```
37+
38+
查看所有映射情况:
39+
```
40+
netsh interface portproxy show all
41+
```
42+
43+
删除某条端口映射
44+
```
45+
netsh interface portproxy delete v4tov4 listenport=5000
46+
```

source/drafts/信息资产申请.md

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,32 @@ layout: 2021-07-01 09:31:14
55
---
66

77

8-
## 新申请
98

9+
## 网站类申请
1010

1111
```mermaid
12-
graph TB
13-
A(开始) -->
14-
B[申请人发起申请] -->
15-
C[院系部门审批] -->
16-
D{是否同意}
17-
D -->|同意| E[信息办审批]
18-
D -->|退回| B[申请人发起申请]
19-
E -->
20-
F{是否同意}
21-
F -->|同意| H[资产入库] --> G(结束)
22-
F -->|退回| B[申请人发起申请]
12+
graph TB
13+
A(开始)-->
14+
B[提交申请]-->
15+
D{是否需要虚拟机}
16+
D -->|是| E[经费负责人审核]
17+
D -->|否| C[院系部门审批]---> F[网站群建站]
18+
E --> L[院系部门审批]
19+
L --> M[创建虚拟机]
20+
M --> G
21+
F --> G[用户部署]
22+
G --> H[安全扫描]
23+
H --> I[域名解析]
24+
I --> K(结束)
2325
```
24-
25-
## 申请修改
26-
27-
```mermaid
28-
graph TB
29-
A(开始) -->
30-
B[申请人发起申请] -->
31-
C[院系部门审批] -->
32-
D{是否同意}
33-
D -->|同意| E[信息办审批]
34-
D -->|退回| B[申请人发起申请]
35-
E -->
36-
F{是否同意}
37-
F -->|同意| H[资产入库] --> G(结束)
38-
F -->|退回| B[申请人发起申请]
39-
```
40-
41-
42-
## 困难点
43-
44-
1. 数据对接
45-
* 人员、部门数据自成体系,需要与UBI对接
46-
* 原数据结构是否重构
47-
2. 申请修改表单较复杂
26+
1. 用户申请
27+
用户发起申请,填写网站基本信息,选择部署方式
28+
2. 部署方式:
29+
* 选择网站群:经过部门审核,进入信息办网站群建站环节,完成后进入用户部署,安全扫描,域名解析后流程结束
30+
* 选择虚拟机:经过经费负责人审核,进入院系负责人审核,同意后云管平台根据参数部署虚拟机,完成后反馈给UBI,进入用户部署,安全扫描,域名解析后流程结束。
31+
32+
虚拟机部署方式:
33+
1. 确定云管平台部署虚拟机所必须的参数,接口信息
34+
2. 财务系统对接,获取经费号及经费负责人信息(或者直接走云平台接口获取)
35+
3. 虚拟机收费情况,是将收费逻辑在UBI上实现,还是云管平台提供接口提供计算结果
36+
4. 部署完成后反馈给UBI平台接口定义

source/resume/index_en.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: My Resume
3+
date: 2021-10-20 15:57:27
4+
---
5+
6+
7+
8+
## Education Experience
9+
1. 2011 -- 2014 Comupter Scince and Technolodge in East China Nomal University Master degree
10+
2. 2006 -- 2010 Infomation and Computation Scince in Guangdong University of Petrochemical Technology Bachelor degree
11+
---
12+
13+
## Work Experience
14+
1. 2014 -- now Information Technology Service Center in ECNU Engineer
15+
---
16+
17+
## Skills
18+
1. code languages:
19+
C#, javascript, python, go
20+
2. OS
21+
windows10, winserver(2019,2012,2008), linux(ubuntu)
22+
3. database
23+
ms sqlserver, oracle, radis, mysql
24+
4. tools
25+
asp.net(webform,mvc,webapi,core),flask,k2 workflow engine,markdown, git
26+
---
27+
28+
## Project Experience
29+
30+
#### Orgonization Management System
31+
1. asp.net core + MS SQLSERVER + ORACLE
32+
2. EntityFrameworkCore
33+
3. Bootstrap + Jquery + ace
34+
35+
#### Summer/Winter Camp Register System
36+
1. asp.net mvc + ms sqlserver
37+
2. short message register、login、information manage、enroll manage
38+
39+
#### Campus Card Web API
40+
1. asp.net web api + oracle
41+
2. card balance、 lost card、 invest money and so on
42+
43+
#### Draw Lots Tools
44+
1. asp.net webform + jquery
45+
46+
#### Campus Workflow Platform
47+
1. asp.net + ms sqlserver + k2 workflow engine
48+
2. extjs for front pages
49+
50+
#### Letters Management System
51+
1. asp.net webform + ms sqlserver
52+
2. CrystalReport component for print templates
53+
---
54+
55+
#### Hexo blog in git pages
56+
1. https://edsiongithub.github.io/
57+
2. hexo + yilia styles
58+
59+
#### Puji Education Official Website
60+
1. https://www.pujiedu.com
61+
2. asp.net mvc + ms sqlserver

0 commit comments

Comments
 (0)