- 博客(23)
- 资源 (8)
- 收藏
- 关注
原创 数字图像处理——用Java对图像做镜像变换
水平镜像变换,也就是把图像的像素点按照垂直中线做调换。代码实现也很简单:import javax.imageio.ImageIO;import java.awt.image.BufferedImage;import java.io.File;import java.io.IOException;public class ImageMirror { public static void
2017-05-31 22:27:04 4195
原创 数字图像处理——用Java对数字图像写水印
写水印这个是数字图像处理中十分常见的操作,比如我们在CSDN上传个图片啥的,它还要在图片的右下方写点“http://blog.csdn.net/sinat_36246371”,那么我们用Java代码也在图片上写点啥,直接看代码吧。import java.awt.Color;import java.awt.Font;import java.awt.Graphics;import java.awt
2017-05-31 20:46:31 1020
原创 数字图像处理——用Java获取像素点的RGB值
从前面的文字中就可以看出,对数字图像的处理都是在像素级上操作的,准确地讲是操作像素点的RGB值,在图像取反和灰度图像转换两篇中已经涉及到了对RGB操作的相关代码,相信大家已经也看到了,就是这一段:for (int j = 0; j < height; j++) { for (int i = 0; i < width; i++) { int p = image.getRGB(i
2017-05-31 20:15:26 15055 1
原创 数字图像处理——用Java将彩色图像转换为灰度图像
灰度图直观地讲就是将原来的RGB图像转换为只有灰度级的图像,做这一步处理也比较简单,只要把每个像素点的RGB值拿出来,算一下他们的平均值(R+G+B)/3(R+G+B)/3,然后再替换原来的RGB值就OK了。原图: 处理后的图像: 代码实现:import java.io.File;import java.io.IOException;import java.awt.image.Buf
2017-05-31 20:03:20 9027
原创 数字图像处理——用Java对数字图像取反
图像取反相当于取底片,对于每个像素点的RGB来讲,就是: R′=255−RR'=255-RG′=255−GG'=255-GB′=255−BB'=255-B用R’,G’,B’来替换R,G,B。直接上图吧,假如原图像是这样的: 那么处理后的图像就是这样的: 代码实现如下:import java.io.File;import java.io.IOException;import java
2017-05-31 19:46:42 4105
原创 数字图像处理——用Java对数字图像进行读写
数字图像处理是计算机视觉,视频语义分析的基础知识。要对数字图像进行处理,比如调整灰度级,图像增强,图像模糊等等操作,首先要对图像进行读写操作。用Java对数字图像进行读写比较简单,用ImageIO.read读,用ImageIO.write写。import java.io.File;import java.io.IOException;import java.awt.image.BufferedI
2017-05-31 19:31:27 2076
原创 查找成绩排名第二的学生
假设有这样的一张表student:name mark---------------Alice 98Bob 67Eric 75Kato 84首先找到排名第一的学生,这一步没啥难度:SELECT name, MAX(mark) as mark FROM student 有了最高成绩了,那么次高成绩也就很容易搞定了,也就是把所有小于最高成绩的全部拿出来,然后再在这个
2017-05-31 12:25:31 7307
翻译 Java发送邮件
原文地址:Send email using Java Program如果你在Java,J2EE或者Python平台上写代码,那么发送邮件是一个基本不用考虑的需求。发送邮件可能需要发送错误警告和注册人或者登录人的确认。Java提供这样的一些功能。Java需要三样东西来发送邮件:JavaMail APIJava Activation Framework (JAF)SMTP服务器详情你可以从Jav
2017-05-30 13:01:23 753
原创 Linux中的netstat命令
最近因为一个端口问题搞得挺恼火的,在解决问题的过程中又用了不少netstat命令,那么借此机会就再复习一下netstat在几种常用参数下的用法吧。显示所有监听和非监听的套接字$ netstat -a显示所有TCP端口,t就是TCP,下同$ netstat -at显示所有UDP端口,u就是UDP,下同$ netstat -au列出只监听的端口$ netstat -l列出只监听的TCP端口$ netst
2017-05-30 10:35:16 917
翻译 利用分治法解决凸包问题
凸包的意思就是包含所有给定点的凸多边形。![这里写图片描述](http://img.blog.csdn.net/20170530091726010?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvc2luYXRfMzYyNDYzNzE=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gra
2017-05-30 09:44:46 11030
原创 按顺序输出字符串中的唯一字符
例子:input: "Hello world";output: "Hewrd";input: "Microsoft Google Oracle";output: "MisftGgOa";方法一:双层循环,时间复杂度O(n2)O(n^2)。这种方法好理解,两层循环做嵌套,对字符串中的每个字符逐个比较,这种方法简单是简单,但是时间复杂度相对较高。方法二:两次循环,时间复杂度O(n)O(n)。这种方法
2017-05-27 16:13:59 631
原创 已知一个整数n,求n^n的前k位
这个题目咋眼不是很难,不就是求一下nnn^n么,大不了计算机费点时间,但是当你真的把代码写好后,你会发现当n=15(1515=43789389038085937515^{15}=437893890380859375)的时候,你的变量就扛不住了,再大了就产生了溢出,咋办呢?我们可以换个角度想一个这个问题,假设 y=nny=n^n 于是 log10y=nlog10n\log_{10} y=n\lo
2017-05-27 15:36:29 587
原创 MySQL创建只读账号
应用场景:只要公司有数据团队的,那免不了让这帮家伙把全公司的数据库数据都摸一遍,但是要是直接把root用户给了他们,未免有点危险,于是只能给这帮人设权限,一般而言,他们只是做读操作,既然做读操作,那么只要有个select权限就可以了。我们可以通过GRANT来创建用户:GRANT SElECT ON *.* TO 'read_only_user'@'ip' IDENTIFIED BY "pa$$wo
2017-05-25 15:15:10 12418
翻译 绳索数据结构(字符串快速拼接)
原文地址:Ropes Data Structure (Fast String Concatenation)字符串连接是一种十分常见的操作。当字符串以传统的方式(例如字符数组)存储的时候,连接操作需要花费O(n)O(n)的时间(在这里n是元字符串的长度)。我们可以利用绳索数据结构减少拼接花费的时间。绳索数据结构绳索是一个二叉树,这个二叉树的节点包含除叶子节点以外,节点左边字符的个数。叶子节点包含的是字
2017-05-24 23:44:07 3641
原创 MySQL中decimal与float的区别
创建一张表:CREATE TABLE `dvf` ( `id` int(11) NOT NULL AUTO_INCREMENT, `field1` decimal(10,2) DEFAULT NULL, `field2` float(10,2) DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB AUTO_INCREMENT=4 DEFA
2017-05-24 15:39:58 1610
原创 不登录到MySQL执行SQL语句
一般来讲,我们在MySQL中执行查询都是进入到mysql中执行的,比如通过命令登录:$ mysql -u root -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 7Server version: 5.7.17-0ubuntu0.16.
2017-05-24 14:00:15 11664
原创 使用MySQL帮助
在实际工作中可能会涉及到不同的数据库,就是使用相同的数据库,可能也会涉及到不同版本,那么在这样的情况下有些命令或者语法可能就会因为不同的版本产生变化,所以为了方便查询不同版本下面的命令或者语法,MySQL产品专门提供了各自的帮助文档。首先使用? contents查看MySQL提供帮助分类:mysql> ? contents;You asked for help about help categor
2017-05-23 16:22:19 371
原创 在IntelliJ IDEA构建Kotlin项目
一觉醒来,突然发现Google将Kotlin作为了Android的一级开发语言,说以后与Java并驾齐驱(但我总感觉Java要被抛弃的节奏,主要是Oracle事情有时候做的……),Kotlin以前真还没关注过,打开IntelliJ IDEA以后,发现其实Kotlin模块早就有了。于是赶快写一个简单的Hello Kotlin压压惊。一、打开new->project,就在Java工程下选择Kotlin(
2017-05-20 11:47:09 10484
原创 Product of Array Except Self
题目地址:https://leetcode.com/problems/product-of-array-except-self/#/descriptionGiven an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all th
2017-05-17 11:20:54 337
原创 Convert BST to Greater Tree
题目地址:https://leetcode.com/problems/convert-bst-to-greater-tree/#/descriptionGiven a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the orig
2017-05-11 14:03:07 597
转载 互联网组织的未来:剖析GitHub员工的任性之源
来源:http://innolauncher.com/github/ 如果有这么家任性的公司,没有所谓”经理人”这一层,人都在做自己喜欢的事情,并且创造价值,而其他的事情,就顺其自然让他发生。这里能节省多少官僚主义带来的浪费?这样的公司得跑得有多快?得有多少无谓的冲突消解于无形?能形成多惊人的创新文化啊?GitHub就是一家尝试无线趋近这种理想主义的公司!程序猿(媛)们应该都知道GitHub,Gi
2017-05-09 09:35:46 481
原创 获取MySQL配置文件路径
在实际工作中,MySQL可能会涉及多个配置文件,但是因为各种原因我们无法找到它们的路,那么我们可以通过以下命令可以找到:首先找到mysqld的路径:$ which mysqld/usr/sbin/mysqld通过mysqld找到所有配置文件的路径:$/usr/sbin/mysqld --verbose --help | grep -A 1 'Default options'Default opt
2017-05-05 11:24:43 7492
翻译 K邻近算法
K-Nearest Neighbours是机器学习中最基本的聚类算法,它属于监督学习领域,用于模式识别,数据挖掘以及干扰检测等领域。因为其不需要参数,所以在实际应用场景中被广泛应用,对于数据的分布也不需要做任何假设(例如高斯分布就是相反的例子)。给定一些数据(也称为训练数据),它们根据自身属性的坐标做了分类。例如,下表中的数据点包含两个特征: 现在已知另外一组数据点(测试数据),根据对训练集的
2017-05-04 14:58:08 547
OSGi in Action
2017-10-05
apt-mirror-api-0.1.jar
2016-11-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人