自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Eswai的专栏

CS小硕,机器学习,图像处理,OpenCV,MATLAB

  • 博客(27)
  • 收藏
  • 关注

原创 Python: h5py快速上手

Python: h5py快速上手1. 数据保存到h5 / hdf5文件import h5pyimport numpy as npa = np.arange(5).reshape((1,1,1,5))with h5py.File('test.h5', 'w') as f: f['data'] = a2. 从h5 / hdf5文件读取数据import ...

2018-04-02 22:00:36 2124

原创 Python需求清单requirements文件生成与使用

Python需求清单requirements文件生成与使用生成requirementspip freeze >requirements.txt安装或升级Package后,应更新该文件。基于requirements安装packagepip install -r requirements.txt...

2018-03-06 21:31:20 2014

原创 利用Docker环境配置jupyter notebook服务器

利用Docker环境配置jupyter notebook服务器Eswai: http://blog.csdn.net/eswai我们有一台高性能工作站,配置好了TensorFlow所需环境的容器。现在我希望局域网的其他计算机都能使用这个环境,但是SSH远程登录还是不够便捷。因此想到可以配置jupyter notebook服务器,其他计算机可以用浏览器来登录。1 配置docker镜像...

2018-03-04 16:17:12 10113 1

原创 Python: jupyter notebook配置初始目录

Python: jupyter notebook配置初始目录进入控制台 > jupyter notebook –generate-config生成配置文件,默认路径为~\.jupyter\jupyter_notebook_config.py修改配置文件查找c.NotebookApp.notebook_dir项,输入路径,注意去掉最前面的注释符号#

2017-11-27 22:26:52 2172

原创 笔试题:2017.9.10爱奇艺校招编程题【平方串】解题思路

问题描述平方串: 形如string s = T + T的字符串目标: 对于字符串s,除去若干字符使其成为平方串,求该平方串的最大长度。思路与实现将s分成两半,求两个子串的最大子序列长度(longest common subsequence)的最大值ans,最长平方串长度就是2*ans。const int MAXN = 50;int c[MAXN][MAXN] = { 0 };// s

2017-09-16 02:19:24 1349

原创 .bat批处理脚本:如何允许变量循环赋值

问题普通情况下,在BAT脚本中,是不能对变量循环赋值的。原因在cmd控制台,运行set /?可以得到解释: 添加了延迟环境变量扩充的支持。该支持总是按默认值被停用,但也可以通过 CMD.EXE 的 /V 命令行开关而被启用/停用。请参阅 CMD /?考虑到读取一行文本时所遇到的目前扩充的限制时,延迟环境变量扩充是很有用的,而不是执行的时候。以下例子说明直接变量扩充的问题:set VAR=bef

2017-09-12 17:25:27 18168

原创 Python: XML文件解析

Python: XML文件解析 - minidom使用xml.dom.minidom解析XML的小笔记1 读入XML文件# 导入import xml.dom.minidom# 输入路径FILE_PATH = 'example.xml'# 打开xml文档dom = xml.dom.minidom.parse(FILE_PATH)# 得到文档的树根元素root = dom.document

2017-09-01 08:12:44 455

原创 PostScript格式: 路径Path

PostScript格式:路径Path初始坐标系原点$(x=0,y=0)$为页面的左下角,向右为x轴正方向,向上为y轴正方向关键词 PostScript-3.11. np = newpath 创建新路径2. mo = moveto

2017-07-26 21:19:20 734

原创 C++ : 出错解释 base operand of '->' has non-pointer type 'std::pair<int, int>'

C++ ERROR : base operand of ‘->’ has non-pointer type ‘std::pair< int, int>’ 的解释问题描述出错代码(截取部分):list<pair<int,int>> cachelist;unordered_map<int,list<pair<int,int>>::iterator> map;void put(int key, int

2017-02-21 22:52:08 38735

原创 LeetCode: 49. Group Anagrams 对颠倒字符串分组

Leetcode: 49. Group Anagrams 对颠倒字符串分组作者: Eswai ([email protected]) CSDN: blog.csdn.net/eswai问题描述Given an array of strings, group anagrams together.Example:, Given: [“eat”, “tea”, “tan”, “ate”, “na

2017-02-20 15:51:10 447

原创 Leetcode: 309. Best Time to Buy and Sell Stock with Cooldown 有冷却机制的最优炒股问题

Leetcode: 309. Best Time to Buy and Sell Stock with Cooldown 有冷却机制的炒股问题-作者: Eswai ([email protected]) 利用有限状态自动机解决。

2017-01-12 19:25:42 364

原创 Leetcode: 18. 4Sum 四数之和

Leetcode: 18. 4Sum 四数之和问题描述Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of targe

2017-01-05 16:10:29 938

原创 Leetcode: 15. 3Sum 三数之和

Leetcode: 15. 3Sum 三数之和问题描述Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set m

2017-01-05 13:33:28 2435 2

原创 Python: IPython notebook快捷键(Jupyter notebook)

IPython notebook快捷键(Jupyter notebook)本文整理了神器IPython Notebook(或Jupyter Notebook)的快捷键功能表。其中我把cell译作代码块,或简称为块。命令模式Command Mode 按键 功能 按键 功能 Enter 进入当前块的编辑模式 X 剪切选中的代码块 Shift

2017-01-05 13:10:01 21469 2

原创 Python: 理解range和xrange的异同

Python: 理解range和xrange的异同rangerange(x)返回包含整数0到x-1的list;range(x,y)返回包含整数x到y-1的list;range(x,y,z)返回包含整数x开始,步长为z,不超过y的listP.S. 当然,还有其他用法,这里不列举了例:>>>range(4)[0,1,2,3]>>>range(1,4)[1,2,3]>>>range(1,10,4)

2016-12-14 16:13:52 508

原创 MATLAB: 用MATLAB发送邮件(以163邮箱为例)

MATLAB: 用MATLAB发送邮件(以163邮箱为例)问题描述有时我们运行一些耗时很长的程序,就让计算机自己跑,人走开了。这种情况下如果程序出错或者运行完毕,程序员不能及时获得通知。但是强大的MATLAB可以发送email,我们可以利用这个功能来提升开发体验。邮箱设置建议专门注册一个邮箱用于MATLAB发送邮件,方便和其他邮件区分,也比较安全。具体步骤如下:注册一个邮箱,如mymatlab@hh

2016-12-04 16:41:20 29510 2

原创 MATLAB: try-catch-end用法

MATLAB: try-catch-end用法try-end结构用于运行可能出错的代码。try % 尝试执行的语句Eend% 如果E运行出错,跳过并从这里开始运行try-catch-end结构try % 尝试执行的语句Ecatch % 如果E运行错误, % 执行catch和end之间的代码块end

2016-12-04 15:46:14 15262 1

原创 Leetcode: 441. Arranging Coins

Leetcode: 441. Arranging Coins排列硬币问题描述You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins.Given n, find the total number of full stair

2016-11-28 15:55:01 411

原创 Leetcode: 26. Remove Duplicates from Sorted Array

LeetCode: 26. Remove Duplicates from Sorted Array 删除有序数组中的重复元素问题描述Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate

2016-11-03 20:58:42 318

原创 OpenCV: 矩阵等对象的文件存取方式

OpenCV中的文件存取问题描述在做图像处理等工作时,经常需要对矩阵Mat等各类对象进行存取,那么在OpenCV中有没有合适的方法呢?解决方案OpenCV中保存图片的最常用方式是imwrite(),但是只能将矩阵按8位/24位图片格式保存。如果需要保存浮点数据,要使用FileStorage类,将矩阵保存为XML/YAML文件。示例如下:Mat I;/* Process of Mat I...*/

2016-11-02 16:18:30 3898

原创 LeetCode: 445. Add Two Numbers II 单链表加法

445. Add Two Numbers IIProblem descriptionYou are given two linked lists representing two non-negative numbers. The most significant digit comes first and each of their nodes contain a single digit. Ad

2016-10-30 01:57:41 1563

原创 OpenCV: 计时方法

OpenCV计时方法问题描述跑一个程序除了看它报不报错,还得计算时间效率对吧。那么在基于C++的OpenCV工程中如何计时呢?解决方案getTickCount函数double t = (double)getTickCount();/*** various operations ***/t = (getTickCount() - t) / getTickFrequency();cout <<

2016-10-28 18:47:35 967

原创 MATLAB: 图像批量剪切

MATLAB图像批量剪切Github: loper-eswai/MagicLab 问题描述源文件夹下有若干子文件夹,包含不同类别的图片文件。现要求将每个图片剪切成相同大小,保存在目标文件夹。解决方案参数设置: - src_dir: 源文件夹 [字符串] - dst_dir: 目标文件夹 [字符串] - format: 图片文件格式 [字符串] - spacing: 剪切

2016-10-27 19:33:10 4815 1

原创 OpenCV: Matrix type矩阵类型宏定义探究

OpenCV:Matrix type矩阵类型宏定义探究老司机可能会知道CV_8UC3=16,CV_32FC3=21,那么这些数字到底是怎么定义的呢?

2016-10-16 16:46:56 2359

原创 OpenCV: 颜色空间转换 cvtColor()出错?注意浮点数精度

问题描述OpenCV 2.0 中的cvtColor()函数可用于颜色空间的转换,例如RGB转HSV,RGB转YUV等等。这里笔者用它来转灰度图,即RGB2GRAY,出现了错误。/* various operations of Mat I */Mat grayI;cvtColor(I, grayI, COLOR_BGR2GRAY); 解决根据上图控制台的报错提示 OpenCV Error:

2016-10-10 11:38:11 10155 3

原创 OpenCV:批量读取图片

OpenCV:批量读取图片方法1:将图片文件名称改为编号,例如”i.bmp”,其中i=1,2,…,Nchar filename[100];Mat img[N];for(int i=0;i<N;i++){ sprintf(filename,"PATH/%d.bmp",i+1); img[i]=imread(filename); //... other operations

2016-09-21 11:28:32 1002

原创 OpenCV: 图片读取函数imread的文件路径写法

OpenCV:图片读取函数imread的文件路径写法cv::Mat cv::imread( const &string filename, int flags=1)//文件在当前目录下Mat img=imread("test.jpg");//不在当前目录//使用双反斜杠img=imread("folder\\folder2\\test.jpg");img=imread("

2016-09-21 11:27:07 29972 4

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除