Skip to content

Commit 68651a6

Browse files
committed
csharp
1 parent 0d83160 commit 68651a6

File tree

10 files changed

+128
-17
lines changed

10 files changed

+128
-17
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# acf
2+
13
[acf](https://github.com/yaoweidong/ACFPedestrianDetection)
24
integral channel feature(积分通道特征)
35
aggregated channel features(聚合通道特征),是基于ICF的改进
File renamed without changes.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# surf
22

33
notes on the openSurf Library
4-
--------
4+
55
[openSurf](https://web.archive.org/web/20150206140535/http://www.chrisevansdev.com/)
6+
67
**Author: Shristopher Evans**
78
**Year: 2009**

algorithm/math/transform.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
3. 原点不变
2929

3030
- 平移不是线性变换而是仿射变换
31-
- 可以通过增加一个维度来使仿射变换表示线性变换(线性变换只有乘法没有加法)
31+
- 可以通过增加一个维度来使仿射变换表示线性变换(线性变换只有乘法没有加法),齐次坐标表示
3232

3333
> $$\begin{bmatrix}\vec{y} \\ 1\end{bmatrix}= \begin{bmatrix} A &\vec{b} \\ 0 & 1\end{bmatrix} \cdot \begin{bmatrix} \vec{x} \\ 1 \end{bmatrix}$$ (2)
3434
3535
[最小二乘法求解](../../books/esl/2_overviewOfSupervisedLeraning.md)
3636
[最小二乘法求解-Levenberg-Marquardt](../optim/lm.md)
37-
[仿射变换矩阵求解](opencv-estimateAffine2D、estimateAffinePartial2D、estimateRigidTransform、getAffineTransform)
37+
[仿射变换矩阵求解](opencv-estimateAffine2D、estimateAffinePartial2D、estimateRigidTransform、getAffineTransform)
3838
[svd解法及证明](https://igl.ethz.ch/projects/ARAP/svd_rot.pdf),并没有对旋转矩阵加约束
3939

4040
> $$y=x^Tw+b$$ (3)

algorithm/optim/icp.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,34 @@
22

33
2019-04-19 09:20
44

5+
[icp总体思路](http://ais.informatik.uni-freiburg.de/teaching/ss12/robotics/slides/17-icp.pdf)
6+
57
根据对应点之间误差的度量方式,ICP可以分为:
68

79
- point-to-point
810
- point-to-plane
9-
- plane-to-plane,
11+
- plane-to-plane
12+
13+
## 闭式解
14+
15+
如果点与点之间的关系(旋转和平移)是确定的,就可以使用闭式解(closed form),即对协方差矩阵做奇异值分解的方法。[证明过程](https://igl.ethz.ch/projects/ARAP/svd_rot.pdf)
16+
17+
- 协方差矩阵
18+
19+
> $$W=\sum_{i=1}^{N_p}x_iy_i$$(1)
20+
21+
- 奇异值分解(SVD)
22+
23+
> $$W=U\begin{bmatrix} \sigma1 & 0 & 0 \\
24+
0 & \sigma2 & 0 \\
25+
0 & 0 & \sigma3 \end{bmatrix}V^T$$(2)
26+
其中,U、V是酉矩阵(unitary matrix),酉矩阵的共轭矩阵是其逆矩阵。$\sigma1\geqslant\sigma2\geqslant\sigma3$为奇异值。
27+
28+
- 那么,结果为
29+
30+
> $$\begin{aligned}R&=UV^T\\
31+
T&=\mu_x-R\mu_y\end{aligned}$$(3)
32+
33+
## 迭代方法求解
34+
35+
如果点与点之间的关系不是确定的,那么就无法确定全局最优解,而只能得到局部最小值。

item/face/faceCollect.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,15 @@ centerloss人脸识别
7474
lbp特征:通过对原图像划分为多个不重叠的小块,单独统计小块内的lbp直方图作为特征,根据相似性度量来分类
7575
lgbp直方图序列人脸识别:先做gabor变换,对gabor变换得到的图做lbp直方图统计
7676

77-
7877
## Joint Cascade Face Detection and Alignment(MSRA,ECCV14)
78+
7979
[文章讲解](http://blog.jobbole.com/85783/)
8080

8181
## 数据库
82+
8283
google的leveldb数据库,不适合做查询工作,不支持网络服务
8384
sqlite是一个轻型的数据库
8485
mysql跨平台,可以使用c++操作数据库
8586
MariaDB,类似mysql
86-
xml
87+
xml
8788
protobuf:一般用于网络通信,把复杂数据转为序列化数据

program/dotnet/csharp.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# c_sharp
22

3-
[c#类定义、函数查询](https://docs.microsoft.com/en-us/dotnet/api/index?view=netframework-4.7.2)
4-
[microsoft c#](https://docs.microsoft.com/zh-cn/dotnet/csharp/index)
5-
[runoob](http://www.runoob.com/csharp/csharp-tutorial.html)
6-
3+
[c#类定义、函数查询](https://docs.microsoft.com/en-us/dotnet/api/index?view=netframework-4.7.2)
4+
[microsoft c#](https://docs.microsoft.com/zh-cn/dotnet/csharp/index)
5+
[runoob](http://www.runoob.com/csharp/csharp-tutorial.html)
76
可以使用[mono](https://www.mono-project.com/)在ubuntu下开发界面程序
87

98
## 数据类型
109

11-
值类型
12-
引用类型
13-
指针类型
10+
1. 值类型: 派生自System.ValueType
11+
2. 引用类型: 不包含实际数据,指的是一个内存地址。内置引用类型包含以下三种:
12+
- object
13+
- dynamic
14+
- string
15+
3. 指针类型: 存储地址
1416

1517
## 数组
1618

@@ -22,6 +24,18 @@
2224
double[] balance = new double[10];
2325
```
2426

27+
## 字符串
28+
29+
```cpp
30+
// string是System.String类的别名。
31+
// 类的属性
32+
string.Chars // 获取char对象的指定地址?
33+
string.Length //
34+
// 类的方法
35+
string.Compare() //字符串比较
36+
...
37+
```
38+
2539
## 结构
2640

2741
类是引用类型,结构是值类型。
@@ -32,8 +46,15 @@ double[] balance = new double[10];
3246

3347
比较像c++中的纯虚类,用于统一继承类的接口
3448

49+
## 不安全代码(unsafe)
50+
51+
代码块使用unsafe修饰时,允许使用指针类型,**不安全代码或非托管代码**是指使用了指针变量的代码块?
52+
c#中的变量受垃圾回收器管理,所以变量在程序运行时有可能会被移动到其它位置,所以指针要加fixed修饰。通过stackalloc申请分配的内存不受内存管理器管理。
53+
3554
## 图像处理
3655

37-
[imageprocessor](https://imageprocessor.org/)
38-
[自带的GDI]
39-
[c#读取图像各种方法性能对比](https://blogs.msdn.microsoft.com/dotnet/2017/01/19/net-core-image-processing/)
56+
[imageprocessor](https://imageprocessor.org/)
57+
[自带的GDI](df)
58+
[c#读取图像各种方法性能对比](https://blogs.msdn.microsoft.com/dotnet/2017/01/19/net-core-image-processing/)
59+
[c++ OpenCV <===> c# Bitmap](https://github.com/sumsuddin/ImageProcessingOpenCV)
60+
[数组 ===> 图像](https://blog.csdn.net/sirenxiaohuayuan/article/details/50345875)

program/dotnet/dotnet.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# .net
22

33
[ubuntu install](https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/install)
4-
[.net指南](https://docs.microsoft.com/zh-cn/dotnet/standard/)
4+
[.net指南](https://docs.microsoft.com/zh-cn/dotnet/standard/)
55
[.net框架](https://www.cnblogs.com/eshizhan/archive/2010/01/26/1657041.html)
66
[命令行](https://docs.microsoft.com/zh-cn/dotnet/core/tools/index?tabs=netcore2x)
77

@@ -10,3 +10,11 @@
1010

1111
.net的初级组成是CLI(common language infrastructure)和CLR(common language runtime,通用语言运行时)
1212

13+
c#就是基于.net的托管代码。
14+
c++/cli是微软设计用来替代c++托管扩展(managed c++)的语言。
15+
c#的P/Invoke技术
16+
17+
## tips
18+
19+
- native code: 非托管代码
20+
- managed code: 托管代码

program/dotnet/ide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# integrated development environment (IDE)
2+
3+
```shell
4+
sudo apt-get install monodevelop
5+
```

program/dotnet/mixed.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Csharp && C++ 混合编程
2+
3+
1. 非托管c++代码编译成dll,然后在c#中使用dllimport调用。这种方法只能使用函数,不支持类
4+
2. 直接编写托管c++输出类库,供c#调用。但是托管c++不兼容本机c++中的很多内容?
5+
3. 利用托管c++把本机c++包装起来?
6+
7+
## 代码示例
8+
9+
```c#
10+
// c++中的代码
11+
extern "C"{
12+
__declspec(dllexport) void hello() {}
13+
__declspec(dllexport) bool __stdcall world(char *str) {}
14+
}
15+
// c#中的代码
16+
// DllImport用于标识非托管代码段。
17+
// 形参: dllname, 可选属性:EntryPoint(非托管方法入口点), CharSet(封送字符串参数的编码方式?Unicode,Ansicode), CallingConvention(调用约定)
18+
// 1. 数据复制封送 2. 数据内存地址封送
19+
using System.Runtime.InteropServices;
20+
class CPP{
21+
[DllImport("process.dll", EntryPoint="hello")]
22+
public static extern void hello();
23+
[DllImport("process.dll", EntryPoint="world")]
24+
public static extern void world(string str);
25+
}
26+
27+
// c#调用
28+
CPP.hello();
29+
CPP.world("heollo");
30+
```
31+
32+
33+
```cpp
34+
// c#与c++中类型的转换对应关系
35+
handle <---> IntPtr
36+
char * <---> string
37+
unsigned char * <---> ref byte
38+
int * <---> ref int
39+
int & <---> ref int
40+
```
41+
42+
## tips
43+
44+
- [呼叫约定](http://www.cnblogs.com/manyou/archive/2012/07/20/2600565.html)
45+
- 提示找不到cppdll时,也可能是因为没有找到cppdll的依赖项
46+
- P/Invoke (platform invocation services,平台调用服务),公共语言运行时(CLR)提供的跨平台调用方法
47+
- interop 互操作

0 commit comments

Comments
 (0)