- 博客(1201)
- 资源 (6)
- 收藏
- 关注
原创 Javascript 从ES5到ES7总结 - 2 array-set-map-1
/*Array*/// foreacharray = ['first', 'second', undefined, 'fourth'];array.forEach(function(element) { console.log(element);});var myArray = new Array('1', '2', '3');myArray = myArray.con...
2019-02-05 15:20:09 451
原创 Javascript 从ES5到ES7总结 - 1 对象
var person = { name: ['Bob', 'Smith'], age: 32, gender: 'male', interests: ['music', 'skiing'], bio: function() { alert(this.name[0] + ' ' + this.name[1] + ' is ' + this.age + ' years o...
2019-02-05 15:18:56 407
原创 使用winser将nodejs 安装为windows 服务
1.npm install winser2. package.json : "scripts": { "install-windows-service": "winser -i", "uninstall-windows-service": "winser -r" } 3.for install:npm run-script install-w...
2019-01-27 19:04:57 594
原创 javascript 使用fetch完成get和post
get :fetch (url).then(...);or var result = await fetch(url);post :getDevices = async () => { const location = window.location.hostname; const settings = { method: 'PO...
2019-01-27 19:02:43 5701
原创 javascript 拷贝字符串到剪切板
const copyToClipboard = str => { const el = document.createElement('textarea'); el.value = str; el.setAttribute('readonly', ''); ...
2019-01-27 19:01:07 1196
原创 安卓获取唯一标识
String androidID = Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.ANDROID_ID);注意:这个ID在恢复出厂设置会刷新。
2019-01-27 18:59:17 747
原创 Js 跨 iframe 通信
方法:使用window的消息队列。1. iframe A, 订阅 window.addEventListener("message", function (event) { console.log("new window message"); switch (event.data.msg) { case 'a': ... break; ...
2019-01-27 18:56:26 778
原创 使用Python 训练OpenCV Cascade分类器 - 5
测试。本例使用了3个opencv的分类器:haarcascade_frontalface_alt和haarcascade_eye是自带的。分别识别人脸和人眼。还有一个是cascade,也就是自己训练出来的分类器。此处测试取决于在这一步传给OPENCV的图片参数,也就是你想要识别的特征图(本例为手表):opencv_createsamples.exe -img watch5050.jpg -b...
2019-01-19 22:02:13 3269 1
原创 使用Python 训练OpenCV Cascade分类器 - 4
创建positive和negative样本。import cv2import numpy as npimport osdef create_pos_n_neg(): for file_type in ['neg']: for img in os.listdir(file_type): if file_type == '...
2019-01-19 21:53:46 1176
原创 使用Python 训练OpenCV Cascade分类器 - 3
这一步是筛选掉不符合条件的图。 import cv2import numpy as npimport osdef find_uglies(): match = False for file_type in ['neg']: for img in os.listdir(file_type): for ugly in os.lis...
2019-01-19 21:52:49 823
原创 使用Python 训练OpenCV Cascade分类器 - 2
从imagenet下载测试图片。中间会使用cv2来处理图片大小。import urllib.requestimport cv2import numpy as npimport osdef store_raw_images():#http://www.image-net.org/api/text/imagenet.synset.geturls?wnid=n04194289 ...
2019-01-19 21:51:37 759
原创 使用Python 训练OpenCV Cascade分类器 - 1
当然前提是你已经匹配好了open cv。本文就不赘述了,推荐linux环境。0. image net urls : 下载图片样本的链接:http://image-net.org/download-imageurlshttp://www.image-net.org/api/text/imagenet.synset.geturls?wnid=n041942891. create sampl...
2019-01-19 21:50:10 2108
原创 使用Python face_recognition 人脸识别 - 14 创建人脸识别1-1比对web服务
本例是对前一篇的web服务进行的一个扩展:接受两张上传的图片,判断上传的照片是否为同一个人。实现:# this sample is to compare if the 2 input photo is the same personimport face_recognitionfrom flask import Flask, jsonify, request, redirect...
2019-01-19 21:41:16 565
原创 使用Python face_recognition 人脸识别 - 13 创建一个web 服务识别上传的图片是否包含人脸
本例使用的是轻量的web框架flask。制作web服务一个attribute 搞定。python3的安装: pip3 install flask实现代码:import face_recognitionfrom flask import Flask, jsonify, request, redirect# You can change this to any folder on...
2019-01-19 21:38:59 1164 1
原创 使用Python face_recognition 人脸识别 - 12 人脸图片1-N比对
示例说明:准备一张(或非)人脸图片,准备多张已知人脸图片数组。进行1-N比对。如果人脸存在,打印出人名;否则打印出没有找到人脸。例子中把路径写死了,真实应用可以考虑从远程获取人脸信息并生成临时目录进行比对。import face_recognition# Load the jpg files into numpy arraysbiden_image = face_recognition...
2019-01-19 21:34:29 1945
原创 使用Python face_recognition 人脸识别 - 11 识别出人脸并以矩形标记
图片库使用的还是PIL,用来highlight出识别的人脸。 import face_recognitionfrom PIL import Image, ImageDraw# This is an example of running face recognition on a single image# and drawing a box around each person th...
2019-01-19 21:30:36 1353
原创 使用Python face_recognition 人脸识别 - 10 解析一个视频文件中的人脸
示例说明:输入一个MP4文件,准备两张已知的人脸PNG照片,一旦找到匹配,弹出识别出的人脸照片。 import face_recognitionimport cv2# This is a demo of running face recognition on a video file and saving the results to a new video file.## P...
2019-01-19 21:29:06 1673
原创 使用Python face_recognition 人脸识别 - 9 从照片出抓出所有人脸属性
from PIL import Image, ImageDrawimport face_recognition# Load the jpg file into a numpy arrayimage = face_recognition.load_image_file("./images/two_people.jpg")# Find all facial features in ...
2019-01-19 21:26:35 829
原创 使用Python face_recognition 人脸识别 - 8 判断一张照片中是否存在人脸
face_recognition结合PIL库来判断指定路径的照片是否能抓出人脸。模型使用的是HOG(默认实现),下面的CNN的实现会更准确一些。from PIL import Imageimport face_recognition# Load the jpg file into a numpy arrayimage = face_recognition.load_image_fil...
2019-01-19 21:22:37 3562
原创 使用Python face_recognition 人脸识别 - 7 使用knn分类器
结合python的face_recognition的knn的实现。训练过程使用的是scikit-learn。 import mathfrom sklearn import neighborsimport osimport os.pathimport picklefrom PIL import Image, ImageDrawimport face_recognitionf...
2019-01-19 21:21:03 1722 1
原创 使用Python face_recognition 人脸识别 - 6 从webcam中获取人脸
如果你使用的是VMWARE的ubuntu,需要以下配置来允许VM访问笔记本摄像头驱动:1. make sure vm-> settings -> USB capitability is 1.12. run commandssudo apt-get install cheese build-essential linux-headers-`uname -r`sudo apt-...
2019-01-19 21:16:23 828 1
原创 使用Python face_recognition 人脸识别 - 5 人脸比对并打分
比对两张人脸编码后的照片,打印出相似度。 import face_recognition# Often instead of just checking if two faces match or not (True or False), it's helpful to see how similar they are.# You can do that by using the...
2019-01-19 21:10:51 3884
原创 使用Python face_recognition 人脸识别 - 4 标记出人脸属性
from PIL import Image, ImageDrawimport face_recognition# Load the jpg file into a numpy arrayimage = face_recognition.load_image_file("./images/biden.jpg")# Find all facial features in all the ...
2019-01-19 21:08:57 1257
原创 使用Python face_recognition 人脸识别 - 3 识别人脸轮廓并编码
import timeit# Note: This example is only tested with Python 3 (not Python 2)# This is a very simple benchmark to give you an idea of how fast each step of face recognition will run on your syste...
2019-01-19 21:06:14 959
原创 使用Python face_recognition 人脸识别 - 2 人脸1-1比对
导入face_recognition库,直接比对两张人脸照片:import face_recognitionknown_image = face_recognition.load_image_file("./images/biden.jpg")unknown_image = face_recognition.load_image_file("./images/unknown.jpg")...
2019-01-19 21:04:52 860
原创 使用Python face_recognition 人脸识别 - 1
在ubuntu环境配置步骤:sudo apt-get updatesudo apt-get install build-essential cmakesudo apt-get install libopenblas-dev liblapack-dev sudo apt-get install libx11-dev libgtk-3-devsudo apt-get install py...
2019-01-19 21:02:21 505
原创 软件项目一直赶工期,越改越忙,怎么破?
赶项目工期通常带来的是代码质量的下降。但如果项目截止日期已成定局,眼前最要紧的是快速写出可以维护的代码。编码过程关注的优先级笔者认为是:1可读性>2内聚性>3可配置性>4扩展性>5性能>6可测试性>7代码依赖>8自动化,AI前4保证可以在质量可维护的前提下如期交付,然后考虑性能等属性。重中之重必然是可读性。代码虽然是给机器执行的,但是给人读的,...
2019-01-13 23:44:39 1996
原创 ubuntu配置ssh服务
1.sudo useradd -s /sbin/nologin -M sftpuser2.sudo passwd sftpkeeperlog3. cd /etc/init.d/4.sudo sshd start5.open /etc/ssh/sshd_config file , open.6. find 'PasswordAuthentication',set to 'ye...
2019-01-08 23:23:31 1433 1
原创 ubuntu 安装python3和open cv
sudo apt-get install libopencv-dev python-opencvsudo pip3 install opencv-python在windows(坑多,不推荐):python -m pip install opencv-python
2019-01-08 23:22:29 722
原创 C# EF动态获取连接字符串的MSDTC配置
用于需要动态获取链接字符串(比如从配置中心)获取数据源地址然后链接数据库的情形,需要在服务器上配置MSDTC。以下是动态链接数据库的代码 using (var ctx = new YourDbContextWhereCanFindConnectionString()) { ... var record = "your co...
2019-01-08 23:20:57 1373 1
原创 html5 JS 循环播放多个视频源
... var video_list = [url1,url2]; var video_index = 0; var video_player = null; ...
2019-01-08 23:16:30 2192 1
原创 C# 借助bitmap进行RGB颜色比对
public static bool IsBlankImage(byte[] imageData) { //some image color :#C49A6A, rgb(196,154,106) var colorBlank = Color.FromArgb(196, 154, 106); using (va...
2019-01-08 23:14:48 2057
原创 c# 使用7zip
1. 7zip 使用密码来压缩C:\"Program Files"\7-Zip\7z.exe a -t7z D:\path\to\your\zip\files.zipD:\path\to\your\1.csv -pSECRET2. 使用密码来解压 (提取到当前目录)C:\"Program Files"\7-Zip\7z.exe e -t7z D:\path\to\your\zip\fi...
2019-01-08 23:13:30 2778 1
原创 使用.NET SFTP 登陆linux上传下载文件
1. 从这里下载https://github.com/sshnet/SSH.NET2. 使用wrapper 类...public static IList<string> SearchLogs(DateTime fromDate, DateTime toDate) { var path = Config.LogPath; ...
2019-01-08 23:10:58 779
原创 Azure部署nodejs webapp服务无法启动常见原因
0. 在 azure的webapp的 appsetting中添加nodejs版本号WEBSITE_NODE_DEFAULT_VERSION, {nodejsVersion}1.使用azure 的debug console来调试:https://yourapp.scm.azurewebsites.net/DebugConsole2. 尝试显示指定node的版本号 :"engines":...
2019-01-08 23:08:52 1319
原创 python ubuntu dlib 人脸识别11-物体追踪
1. 从文件夹中读取图片文件,这步可以结合ffmpeg来完成,将视频流切图命令为(但需要再写个脚本定期清理旧图片,比如10分钟前):ffmpeg -i myfile.avi -r 1000 -f image2 image-%07d.png2.读取图片并圈出识别出的物体:import osimport globimport dlib# Path to the video ...
2018-12-02 15:58:15 610 1
原创 python ubuntu dlib 10- 生成自然语言向量
import sysimport dlib计算特征向量:def sentence_to_vectors(sentence): # Create an empty array of vectors vects = dlib.vectors() for word in sentence.split(): # Our vectors are very...
2018-12-02 15:48:29 435
原创 python Ubuntu dlib 人脸识别9-辅助函数
全局优化函数:import dlibfrom math import sin,cos,pi,exp,sqrt# This is a standard test function for these kinds of optimization problems.# It has a bunch of local minima, with the global minimum resul...
2018-12-02 15:38:24 477
原创 python ubuntu dlib 8- 输出人脸坐标
输入图片检测人脸,输出人脸坐标import sysimport dlibif len(sys.argv) < 1: print("need specify the image file") exit()image_file = sys.argv[1]img = dlib.load_rgb_image(image_file)# Locations of candidat...
2018-12-02 15:28:20 645
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人