个人学习笔记(备份)

编程笔记

1、Halcon

1)链接

教程链接:https://blog.csdn.net/maweifei/article/details/78162581?locationNum=10&fps=1

2)代码

(1)基础算子

read_image

(Image, 'E:/图片/2222.bmp')//读图

get_image_size

(Image, Width, Height)//获取宽高

dev_open_window

(0, 0, Width/4, Height/4, 'black', WindowHandle)开窗

dev_display

(Image)显示图片

threshold

(Image, Regions, 121, 176)

closing_circle

(Regions, RegionClosing, 17)闭运算

connection

(RegionClosing, ConnectedRegions)连接区域

select_shape

(ConnectedRegions, SelectedRegions, 'area', 'and', 5013.55, 14065)

decompose3(Image,Red,Green,Blue)通道转换

dev_update_off

()

dev_close_window

()关闭窗口

dev_open_window_fit_image

(Image, 0, 0, 522, 522, WindowID)

rgb1_to_gray

(Image, GrayImage)转灰度

draw_rectangle1

(WindowID, Row1, Column1, Row2, Column2)矩形框

gen_rectangle1

(Rectangle, Row1, Column1, Row2, Column2)//绘制矩形

reduce_domain

(GrayImage, Rectangle, ImageReduced)

edges_sub_pix

(ImageReduced, Edges, 'lanser2', 0.5, 20, 40)

trans_from_rgb(Red,Green,Blue,ImageResult1,ImageResult2,ImageResult3,'hsv')

read_ocr_class_mlp('Industrial_0-9A-Z_Rej.omc',OCRHandle)

do_ocr_multi_class_mlp(SortedRegions,ImageResult2,OCRHandle,Class,Confidence)

open_file

('E:/halcon图像/新建文本文档.txt', 'output', FileHandle)

fwrite_string

(FileHandle, 'hello')

fnew_line

(FileHandle)

close_file

(FileHandle)

area_center(SortedRegions,Area,Row,Column)

for

i:= 0 to 5 by 1

disp_message(3600,

Class[i], 'window', i, i, 'black', 'true')

3)Halcon快捷键

F2:

重置执行

F5:

执行

F6:

单步运行

F7:

进入定义

2、Matlab

1)链接

函数大全:https://blog.csdn.net/proton_boke/article/details/55257136

2)代码

rectangle('position',ocrResults.WordBoundingBoxes(i,:));

end

[H,T,R]

= hough(BW);

rectangle('position',ocrResults.WordBoundingBoxes(a1,:));

date=load('海豚.txt');

x=date(:,1);

y=date(:,2);

z=date(:,3);

scatter3(x,y,z);

1.full: 滑动步长为1,图片大小为N1xN1,卷积核大小为N2xN2,卷积后图像大小:N1+N2-1 x N1+N2-1

2.same: 滑动步长为1,图片大小为N1xN1,卷积核大小为N2xN2,卷积后图像大小:N1xN1

3.valid:滑动步长为S,图片大小为N1xN1,卷积核大小为N2xN2,卷积后图像大小:(N1-N2)/S+1 x (N1-N2)/S+1

p = [0 0 0 0 0;

0 1 1 1

0;

0 1 1 1

0;

0 1 1 1

0;

0 0 0 0

0];

q=[0 -(1/2) 0;

-(1/2) 1

-(1/2);

0 -(1/2)

0];

conv2(p,q,'same')

3、DOS指令

1)链接

Win+Linux: https://blog.csdn.net/liuyinghui523/article/details/38687629

Win : https://blog.csdn.net/hikvision_java_gyh/article/details/44617275

2)代码

(1)control

panel

(2)产品信息:slmgr.vbs -dlv

ipconfig

regedit (注册表)

(3)鼠标右键事项加速(除user都可删)

[HKEY_CLASSES_ROOT\Directory\Background\shellex]

计算机\HKEY_CLASSES_ROOT\Directory(查询)

(4)窗口黑科技

[HKEY_CLASSES_USER\Software\Microsoft\Windows\DWM]

建里DWORD文件命名为AnimationsShiftKey值改为1

start

Ecoh off

lots of boxes

start box

(5)文件隐藏(.bat):copy/b xiao.bat+xiao.jpg=nv.jpg

(6)查看激活状态: slmgr.vbs -xpr

(7)win10关闭自动更新

1)Windows+R,输入“regedit”回车,打开注册表编辑器,定位到 HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows在「Windows」节点下新建一个名为「WindowsUpdate」的项在「WindowsUpdate」项下新建一个名为「AU」的项

在「HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU」下新建一个名为「AUOptions」的 32 位 DWORD 值,双击该值,将数值设置为2.

注意:此方案涉及注册表的修改,建议您在操作前将注册表备份。

2)如果是专业版系统,请您同时按下微软徽标键和R键,输入“gpedit.msc”回车,打开:计算机配置-管理模板-Windows组件-Windosw 更新,在右侧将“配置自动更新”和“允许自动更新立即安装”的状态改为“已禁用”

4、C#

1)链接

委托: https://blog.csdn.net/y1196645376/article/details/51408114

https://blog.csdn.net/shanyongxu/article/details/50739050

http://www.cnblogs.com/JimmyZhang/archive/2007/09/23/903360.html

多线程:https://blog.csdn.net/my___dream/article/details/44397677

登陆窗口关闭:https://blog.csdn.net/lekelaier_msn/article/details/1654172

2)代码

//释放

this.Close();

this.Dispose(); //释放内存,比第一个好。

Application.Exit();

/退出

if

(HDevWindowStack.IsOpen())

{

HOperatorSet.CloseWindow(HDevWindowStack.Pop());

}

//多线程:

//线程的优先级可以通过Thread类Priority属性设置,Priority属性是一个ThreadPriority型枚举,列举了5个优先等级:AboveNormal、BelowNormal、Highest、Lowest、Normal。普通线程的优先级默认为Normal;如果想有更高的优先级,可设置为AboveNormal或Highest;如果想有较低的优先级,可设置为BelowNormal或Lowest。

class

Program

{

public

static void game()

{

Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd

hh:mm:ss.fff") + " 线程一");

}

public static void music()

{

Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd

hh:mm:ss.fff") + " 线程二");

}

static

void Main(string[] args){

Thread

t1 = new Thread(new ThreadStart(game));//开始一个玩游戏的线程

Thread

t2 = new Thread(new ThreadStart(music));//开始一个听音乐的线程

t1.Priority

= ThreadPriority.BelowNormal;

t2.Priority

= ThreadPriority.Lowest;

t1.Start();

t2.Start();

Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd

hh:mm:ss.fff") + " 总事件");

Console.ReadKey(); }

}

Control.CheckForIllegalCrossThreadCalls

= false;解除跨线程检查

static

Semaphore GetProfileSemaphore = new Semaphore(0,1);

static

Semaphore DisplayProfileSemaphore = new Semaphore(1,1);

//信号量

private

void GetProfile()

{

while (true)

{

DisplayProfileSemaphore.WaitOne();

GatherProfile();

//Console.WriteLine("TaskGetProfile");

GetProfileSemaphore.Release();

//Thread.Sleep(100);

//Application.DoEvents();

}

}

private

void GetDisplayProfile()

{

while

(true)

{

GetProfileSemaphore.WaitOne();

DisplayProfile();

//Console.WriteLine("TaskDisplayProfile");

DisplayProfileSemaphore.Release();

//Thread.Sleep(100);

//Application.DoEvents();

}

}

(1)委托:包装函数,让函数作为参数使用(指针)

1.定义委托对象 public delegate void MyDelegate();

2.定义被委托对象

3.创建委托变量,进行方法的绑定

4.运用委托事件的关键是三要素的关系:委托,事件,方法。

定义委托,定义委托事件,定义响应方法。

3)Visual

Studio快捷键

F5: 执行

F9:

断点

F10:逐过程

F11:

逐句

F12:

进入定义

Ctrl+‘-’返回

5、MySQL

1)链接

help 文档 -> 百度->CSDN

-> pudn

各种数据库:https://blog.csdn.net/intbird/article/details/38338963

MySQL+C#: https://blog.csdn.net/shawncheer/article/list/4

C#操作: https://wenku.baidu.com/view/8fc6583a580216fc700afd4d.html

数据库恢复:https://blog.csdn.net/airujingye/article/details/70526943

远程连接: https://blog.csdn.net/Bear_Rider/article/details/79616455

https://blog.csdn.net/u014546553/article/details/53281705

2)代码

//Command对象通过ExecuteNonQuery方法更新数据库的过程非常简单,需要进行的步骤如下:

【1】创建数据库连接。

【2】创建Command对象,并指定一个SQL Insert、Update、Delete查询或存储过程。

【3】把Command对象依附到数据库连接上。

【4】调用ExecuteNonQuery方法。

【5】关闭连接。

//连接数据库

public

static string ConnStr = @"server=localhost; user id=root;

password=root20162016; database=eggs; charset=utf8";

//打开

public static MySqlConnection Open_Conn(string ConnStr)

{

try

{

MySqlConnection Conn = new MySqlConnection(ConnStr);

Conn.Open();

return Conn;

}

catch (Exception Ex)

{

throw Ex;

}

}

//执行

public static MySqlCommand Run_SQL(string SQL, string ConnStr)

{

try

{

MySqlConnection Conn =

Open_Conn(ConnStr);

MySqlCommand Cmd = new MySqlCommand(SQL, Conn);

return

Cmd;

}

catch (Exception Ex)

{

throw

Ex;

}

}

//关闭

public static void Close_Conn(MySqlConnection Conn)

{

if (Conn != null)

{

Conn.Close();

Conn.Dispose();

}

GC.Collect();

}

//<returns>返回MySqlConnection对象</returns>

private MySqlConnection

GetMysqlConnection()

{

string M_str_sqlcon = string.Format("server={0};user

id=

{1};password={2};database={3};port={4};Charset={5}", server,

userid, password, database, port,

charset);

MySqlConnection myCon = new

MySqlConnection(M_str_sqlcon);

return myCon;

}

//联合查询

(SELECT 表1.字段, 表2.字段,

FROM (SELECT 表.字段1, 表.字段2 FROM 表 WHERE 条件 ) 表1 )

UNION ALL

(SELECT 表.字段1, 表.字段2 FROM 表 WHERE 条件 ) 表2

WHERE 相关条件

ORDER BY 排序条件

6、Python

1)链接

总纲: https://blog.csdn.net/cppdaxue_com/article/details/74520585

2)代码

(1)初级思想

import

os

import

time

Number

= int(input('输入整型: '))

tuple1=

('A','B','C')

member

= list(tuple1)

member.append('D')

member.extend(['E','F'])

member.remove('F')

score

= 100

def

odd(x):

return x % 2

def

Function(score1):

x = score1

def Function2():#内部函数

nonlocal x

temp = range(x)

show = list(filter(lambda x : x%2 , temp))

for i in show:

if 100>= i

>=80:

print(i,member[0])

elif 80>= i

>=60:

print(i,member[1])

else:

print(i,member[2])

Function2()

def

hanoi(n,x,y,z):

if n == 1:

print(x,'->',z)

else:

hanoi(n-1,x,z,y)#将前n-1个从x移到y上

print(x,'->',z)#将最后一个从x移到z上

hanoi(n-1,y,x,z)#将y上n-1个移到x上

if

Number == 1:

Function(score)

elif

7>=Number>1:

hanoi(Number,'X','Y','Z')

else:

f = open('D:\\A_Project\\Python Project\\read.txt')

for each_line in f:

print(each_line) #str1 =

f.read(-1)

print(os.path.basename ('D:\\A_Project\\Python

Project\\read.txt'))

print(time.localtime(os.path.getatime('D:\\A_Project\\Python

Project\\read.txt')))

f.close( )

(2)模块(封装)在安装py的根目录下创建

例:Temparature。py{

def c2f(cel):

fah = cel * 1.8 + 32

return fah

def f2c(fah):

cel = (fah - 32)/1.8

return cel

}

import

Temparature as t

print("32摄氏度 = %.2f华氏度" %t.c2f(32))

(3)网络爬虫

import

urllib.request

response

= urllib.request.urlopen("http://www.fishc.com")#获取对象

html

= response.read()#读取对象

html

= html.decode("utf-8")#解码

print(html)

(1)函数

可以嵌套函数

lambda 函数: g = lambda x,y : x+y g(x)

(2)

BIF 过滤器 filter filter(,)

映射 map()

(3)

递归: 分治思想 (占内存 合理运用) py默认递归深度100层 import

sys (可改深度)

汉诺塔思想 分解思路 100层 第一步 将1-99移到 b 第二步 将100移到c 递归

(4)

列表 : list() 创建 [ ]

元组 : tuple() 创建 (,)

字典 : dict() 创建 { }

(5)

异常捕获: try - finally

try:

检测范围

except Exceptiopn[as reason ]

出现异常(Exception 后的处理代码) (异常后的代码不会被继续执行)

finally:

必须执行的代码

(6)

else:

while :

if : 结果一

break

else: 结果二

(7)

生成器: yield(h和return相似 但是只返回不结束,只暂停)

(8)迭代(生成器)

列表推导式: a = [i for i in range(100) if not(i%2) and i%3]

字典推导式: b = {i:i%2 == 0 for i in range(10)}

集合推导式: c = {i for i in [1,1,1,2,5,6]}

(9)

容器 -> 数据的封装

函数 -> 语句的封装

类 -> 方法和属性的封装

(10)添加索引目录

sys.path.append("D:\\A_Project\\Python

Project\\module")

(11)爬虫

help文档 搜索url查找帮助 方法参数介绍

编码原理: 鱼C

网址查看元素 找到对应的上传数据和响应数据 应用列表或者字典对应

py中进行编解码操作

(12)反爬虫

修改header

1 通过request 的headers参数修改

head = {}

head['User-Agent']

= 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101

Firefox/61.0'

2 通过request.add_header()方法修改

req =

urllib.request.Request(url,data)#生成对象

req.add_header('User-Agent','Mozilla/5.0

(Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0')

运用代理

1 参数是一个字典

2 定制、创建一个opener

3 安装、调用opener

消除特殊字符的功能 前边加 ‘\’

(13)正则表达式

import re

re.search(r'[01]\d\d|2[0-4]\d|25[0-5]','188')

匹配IP:

re.search(r'([01]{0,1}\d{0,1}\d|2[0-4]\d|25[0-5]\.){3}([01]{0,1}\d{0,1}\d|2[0-4]\d|25[0-5])','192.168.1.1')

re.search(r"<.+?>" , ' ')

7、OpenCV+C++

1)链接

启蒙: https://blog.csdn.net/gg_simida/article/details/71320602

2)代码

8、R语言

1)链接

综合:https://blog.csdn.net/qq_34941023/article/details/51607745

2)代码

9、Machine Vision

1) 链接

CVPR:http://dblp.uni-trier.de/db/conf/cvpr/index.html

ICCV:http://www.informatik.uni-trier.de/~ley/db/conf/iccv/index.html

ECCV:http://www.informatik.uni-trier.de/~ley/db/conf/eccv/index.html

Matchine

Vision: https://blog.csdn.net/u010551600/article/details/80799419

Anaconda+Tensorflow环境配置:

http://www.cnblogs.com/willnote/p/6746499.html

http://www.cnblogs.com/denny402/p/5849416.html

2) Note

win下caffe配置: https://jingyan.baidu.com/article/8ebacdf00b251749f65cd539.html

cuda与cudnn: https://blog.csdn.net/fangjin_kl/article/details/53906874

10、Method

1)链接

汉化教程链接:https://jingyan.baidu.com/article/046a7b3e8d230bf9c27fa928.html

资源链接: https://pan.baidu.com/s/1NO87oktZMdq8LOj26pKIag

2)Notes

作业提交 :https://219.243.50.211:8443/svn/2018-learn

裁片项目:https://219.243.50.211:8443/svn/LineScan1.0

EggsPro : https://219.243.50.211:8443/svn/Egg3.0/

环境配置:

(1)包含文件 告诉VC去哪找头文件(include)库的位置 D:\opencv\include

(2)库文件 即寻找库链接器的位置 D:\opencv\build\x64\lib

(3)设置环境变量D:\opencv\build\x64\bin

(4)配置链接器 输入即为项目Debug配置增加库文件 .lib

项目开发:

UI层+业务逻辑层+数据层

循环采集、定时器、多线程、回调函数

工具:

Live Start Page

截图 win +shift +s

查找: win + s

11、Ubuntu+Caffe

1)链接

Caffe官网:

http://caffe.berkeleyvision.org/

Stanford:

http://cs231n.stanford.edu/

Le-Net_Mnist: https://blog.csdn.net/hjxu2016/article/details/53780687

安装: https://blog.csdn.net/CAU_Ayao/article/details/80578600

2)Notes

1.test:

./build/examples/cpp_classification/classification.bin

./models/bvlc_reference_caffenet/deploy.prototxt

./models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel

./data/ilsvrc12/imagenet_mean.binaryproto ./data/ilsvrc12/synset_words.txt

./examples/images/cat.jpg

3)终端

cd caffe

ls #列表

sh **.sh

#可执行文件

gedit 添加环境变量

pkg-config--modversion **** 查看版本

sudo netease-cloud-music

Ctrl+Alt+T 打开终端 Ctrl+D 关闭终端

12、Anaconda+tf

1)链接

2)Notes

虚拟环境搭建:

创建虚拟环境:conda create -n your_env_name python=xx

激活虚拟环境:source activate your_env_name

安装所需CUDA conda install cudatoolkit=9.0

安装所需CUDNN conda install cudnn=7.1.4

安装tensorflow: pip install tensorflow-gpu==1.9.0

关闭虚拟环境:source deactivate your_env_name

虚拟环境可删除conda remove -n your_env_name(虚拟环境名称) --all

显卡调用:nvidia-smi

命令查看被已被占用的GPU 号 设置未被占用的GPU进行训练

tensorflow默认占用所有显卡的显存,请按需设置使用的gpu数量,设置方法:可以在python文件中设置,也可以在执行程序的命令中设置。详见:

https://blog.csdn.net/guvcolie/article/details/77164230

https://blog.csdn.net/sunwuhuang1/article/details/53946462

查看已安装包: conda list

查看虚拟环境列表 conda info --envs

Pip

升级: python -m pip install --upgrade pip

服务器:FTP :219.243.50.211 4A513 genglei

刷新服务器ifconfig -a dhclient enp129s0f0

调用显卡:

Python调用

import os

os.environ["CUDA_VISIBLE_DEVICES"]= "5"#指定节点上面跑程序的区域.

终端调用: CUDA_VISIBLE_DEVICES="0,1"

开线程:

Yum install screen安装screen

Screen -ls 显示当前线程

Screen -S yourname 新建线程

Screen -r yourname 回到线程

Ctrl +A +D暂时离开当前线程

Screen -d yourname 结束session

Screen -S screenID -X quit关闭线程

查看线程:ps aux|grep user_name|grep python

关闭线程:kill -s 9 线程编码

skill

猜你喜欢

转载自blog.csdn.net/qq_36203584/article/details/90477203