application-mk

生成jni头文件:

  • 第一种
    比如包的名字是 com.example.test,类的名字是 hellojni,
    类文件路径是src/com/example/test/hellojni.class
    那么我们需要在src目录下,使用命令
    1
    javah -jni com.example.test.hellojni

函数指针和指针函数

Unix C语言环境下的多线程编程使用到函数指针来传递需要执行的函数体到线程,使用的方式就是通过函数指针来指向需要执行的代码。
函数原型:

1
int pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*func)(void*), void *arg);

PHP

Apache

Start Apache: sudo apachectl start

Stop Apache: sudo apachectl stop

Restart Apache: sudo apachectl restart


Open PHP

To open PHP, need to modify the following config file

1
sudo vim /etc/apache2/httpd.conf

Find the line #LoadModule php5_module libexec/apache2/libphp5.so, remote the # sign.

In mac, the default Apache directory is /Library/WebServer/Documents, create a file named index.php, if it’s not exist, write <?php phpinfo(); ?> as the first line. Open browser to access localhost, if the PHP info page displayed, that means PHP is configured to open successfully.

Change Apache Default Directory

  上面说到了mac下Apache的默认文件夹为/Library/WebServer/Documents,该目录默认是隐藏的,操作不是很方便,我们可以将其修改成自定义的目录。

Open terminal and input: sudo vim /etc/apache2/httpd.conf

Find the following lines

1
2
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">

Replace the directory with you preferred one, restart Apache, move the just created index.php to the directory, and then test in the browser to see if the php info page still working.

图像识别之灰度,二值化,高斯模糊处理

在图像处理中,灰度和二值化是其他操作的前提。灰度的方式有多种,比较简单的处理就是取RGB平均值,从而使RGBA8888格式的图片转化为了单色道的灰度图,每个像素存储在一个char中而非四个char。
高斯模糊,图像处理软件会提供”模糊”(blur)滤镜,使图片产生模糊的效果。”模糊”的算法有很多种,其中有一种叫做”高斯模糊”(Gaussian Blur)。它将正态分布(又名”高斯分布”)用于图像处理。
二值化,设定某个条件将像素转为黑白两种色,这里设置的条件为:是否大于色素平均值再减去40,即buffer_temp[x]>avage_char-40?255:0。

Java集合类型

Java 集合可分为 Set、List 和 Map 三种体系:
Set:无序、不可重复的集合。
List:有序,可重复的集合。
Map:具有映射关系的集合。
Collection 接口是 List、Set 和 Queue 接口的父接口,Set 判断两个对象是否相同不是使用 == 运算符,而是根据 equals 方法。