博客园 - xiatwhuuuid:24b78886-0ed1-41c2-8670-e3f31dcf42c4;id=1157012013-03-07T13:56:07Zxiatwhuhttps://www.cnblogs.com/xianglan/feed.cnblogs.comhttps://www.cnblogs.com/xianglan/archive/2012/02/23/2365005.html近况 - xiatwhu终于,考研成绩下来了。考得还不错,应该能上选的学校,也希望能进一个好的实验室。很长时间都没有更新了,一直在忙于考研的事情,希望以后能忙起来。联系了一个导师,以后可能要做自然语言处理方面的事情,希望自己保持学习的劲头。好了,就是这样。2012-02-23T07:38:00Z2012-02-23T07:38:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】终于,考研成绩下来了。考得还不错,应该能上选的学校,也希望能进一个好的实验室。很长时间都没有更新了,一直在忙于考研的事情,希望以后能忙起来。联系了一个导师,以后可能要做自然语言处理方面的事情,希望自己保持学习的劲头。好了,就是这样。 <a href="https://www.cnblogs.com/xianglan/archive/2012/02/23/2365005.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/08/06/2129410.htmlOpenCV2 直方图均衡化 - xiatwhu这篇文章介绍了直方图均衡化的方法2011-08-06T05:45:00Z2011-08-06T05:45:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】这篇文章介绍了直方图均衡化的方法 <a href="https://www.cnblogs.com/xianglan/archive/2011/08/06/2129410.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/08/03/2126092.htmlOpenCV2 计算直方图 - xiatwhu我们仍然如前例一样,构建一个类来处理得到直方图。我们来看看基本的类定义#ifndef HISTOGRAM_H_#define HISTOGRAM_H_#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include <opencv2/imgproc/imgproc.hpp>#include <iostream>#include <vector>class Histogram {private: int histSize[1]; float hr2011-08-03T05:33:00Z2011-08-03T05:33:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】我们仍然如前例一样,构建一个类来处理得到直方图。我们来看看基本的类定义#ifndef HISTOGRAM_H_#define HISTOGRAM_H_#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include <opencv2/imgproc/imgproc.hpp>#include <iostream>#include <vector>class Histogram {private: int histSize[1]; float hr <a href="https://www.cnblogs.com/xianglan/archive/2011/08/03/2126092.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/07/31/2122719.htmlOpenCV2 颜色识别 - xiatwhu在这个例子中,我们开始选定一种颜色,并设置一个阈值然后把图片中和所选颜色的差别在阈值中的点标定出来在这个例子中,主要要注意这两点:1. OpenCV与QT的结合,包括Mat 与 QImage 的转换2. 我们使用了类来实现此功能,创建了一个单例模式的类首先我们创建一个简单的图形界面,使用的是QT创建处理图像用的类#ifndef COLORDETECTOR_H_#define COLORDETECTOR_H_#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include <2011-07-31T06:21:00Z2011-07-31T06:21:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】在这个例子中,我们开始选定一种颜色,并设置一个阈值然后把图片中和所选颜色的差别在阈值中的点标定出来在这个例子中,主要要注意这两点:1. OpenCV与QT的结合,包括Mat 与 QImage 的转换2. 我们使用了类来实现此功能,创建了一个单例模式的类首先我们创建一个简单的图形界面,使用的是QT创建处理图像用的类#ifndef COLORDETECTOR_H_#define COLORDETECTOR_H_#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include < <a href="https://www.cnblogs.com/xianglan/archive/2011/07/31/2122719.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/07/30/2122302.htmlOpenCV2 访问各个像素点的方法 - xiatwhu内容来自《OpenCV 2 Computer Vision Application Programming Cookbook》OpenCV2 访问图像的各个像素有各种方法我们来用各种方法来实现减少图像的颜色数量color = color/div*div +div/2;若div为8,则原来RGB每个通道的256种颜色减少为32种。若div为64,则原来RGB每个通道的256种颜色减少为4种,此时三通道所有能表示的颜色有4×4×4 = 64 种首先,我们来看一个函数C++: uchar* Mat::ptr(int i=0)i 是行号,返回的是该行数据的指针。在OpenCV中,一2011-07-30T15:21:00Z2011-07-30T15:21:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】内容来自《OpenCV 2 Computer Vision Application Programming Cookbook》OpenCV2 访问图像的各个像素有各种方法我们来用各种方法来实现减少图像的颜色数量color = color/div*div +div/2;若div为8,则原来RGB每个通道的256种颜色减少为32种。若div为64,则原来RGB每个通道的256种颜色减少为4种,此时三通道所有能表示的颜色有4×4×4 = 64 种首先,我们来看一个函数C++: uchar* Mat::ptr(int i=0)i 是行号,返回的是该行数据的指针。在OpenCV中,一 <a href="https://www.cnblogs.com/xianglan/archive/2011/07/30/2122302.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/07/30/2122186.htmlOpenCV2 图像叠加 给照片加水印 - xiatwhuC++: void Mat::copyTo(OutputArray m) constC++: void Mat::copyTo(OutputArray m, InputArray mask) const这个函数可以复制图像到另一个图像或矩阵上,可选参数是掩码由于叠加的图像大小不一定相等,比如我们这里把一张小照片加到一张大照片上我们可以在大照片上设置一个和小照片一样大的感兴趣区域不使用掩码的时候,我们载入一张png,和一张jpg#include <opencv2/highgui/highgui.hpp>#include <opencv2/core/core.hpp>int2011-07-30T12:52:00Z2011-07-30T12:52:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】C++: void Mat::copyTo(OutputArray m) constC++: void Mat::copyTo(OutputArray m, InputArray mask) const这个函数可以复制图像到另一个图像或矩阵上,可选参数是掩码由于叠加的图像大小不一定相等,比如我们这里把一张小照片加到一张大照片上我们可以在大照片上设置一个和小照片一样大的感兴趣区域不使用掩码的时候,我们载入一张png,和一张jpg#include <opencv2/highgui/highgui.hpp>#include <opencv2/core/core.hpp>int <a href="https://www.cnblogs.com/xianglan/archive/2011/07/30/2122186.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/07/28/2119389.htmlOpenCV2 椒盐噪声 - xiatwhu椒盐噪声是由图像传感器,传输信道,解码处理等产生的黑白相间的亮暗点噪声。椒盐噪声往往由图像切割引起。我们用程序来模拟椒盐噪声,随机选取一些像素,把这些像素设为白色。#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include <cstdlib>void salt(cv::Mat&, int n=3000);int main(){ cv::Mat image = cv::imread("E:/Image/Lena.jpg"); salt(2011-07-28T04:00:00Z2011-07-28T04:00:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】椒盐噪声是由图像传感器,传输信道,解码处理等产生的黑白相间的亮暗点噪声。椒盐噪声往往由图像切割引起。我们用程序来模拟椒盐噪声,随机选取一些像素,把这些像素设为白色。#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include <cstdlib>void salt(cv::Mat&, int n=3000);int main(){ cv::Mat image = cv::imread("E:/Image/Lena.jpg"); salt( <a href="https://www.cnblogs.com/xianglan/archive/2011/07/28/2119389.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/07/28/2119384.htmlOpenCV2 图像的载入与显示 - xiatwhuOpenCV的接口包括C++,C,Python的我用MinGW编译OpenCV2.1 和 OpenCV2.2 从未成功过前几日发现 OpenCV 2.3发布,下载了自解压程序,解压后又visual studio 2008,2010和MinGW版的但其中的MinGW版的是官方 MinGW的,我使用的是在 http://nuwen.net/mingw.html 下载的编译程序连接时总出错,于是下载了源码包,编译后能正常使用先来看看最简单的图像的载入与显示,使用C++接口#include <opencv2/core/core.hpp>#include <opencv2/highgu2011-07-28T03:53:00Z2011-07-28T03:53:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】OpenCV的接口包括C++,C,Python的我用MinGW编译OpenCV2.1 和 OpenCV2.2 从未成功过前几日发现 OpenCV 2.3发布,下载了自解压程序,解压后又visual studio 2008,2010和MinGW版的但其中的MinGW版的是官方 MinGW的,我使用的是在 http://nuwen.net/mingw.html 下载的编译程序连接时总出错,于是下载了源码包,编译后能正常使用先来看看最简单的图像的载入与显示,使用C++接口#include <opencv2/core/core.hpp>#include <opencv2/highgu <a href="https://www.cnblogs.com/xianglan/archive/2011/07/28/2119384.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/07/02/2096270.html[Project Euler] Problem 31 - xiatwhuIn England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
It is possible to make £2 in the following way:
1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
How many different ways can £2 be made using any number of coins?2011-07-02T06:56:00Z2011-07-02T06:56:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
It is possible to make £2 in the following way:
1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
How many different ways can £2 be made using any number of coins? <a href="https://www.cnblogs.com/xianglan/archive/2011/07/02/2096270.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/06/29/2093085.html[Project Euler] Problem 30 - xiatwhuSurprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:
1634 = 14 + 64 + 34 + 44
8208 = 84 + 24 + 04 + 84
9474 = 94 + 44 + 74 + 44
As 1 = 14 is not a sum it is not included.
The sum of these numbers is 1634 + 8208 + 9474 = 19316.
Find the sum of all the numbers that can be written as the sum of fifth powers of their digits.2011-06-29T02:57:00Z2011-06-29T02:57:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:
1634 = 14 + 64 + 34 + 44
8208 = 84 + 24 + 04 + 84
9474 = 94 + 44 + 74 + 44
As 1 = 14 is not a sum it is not included.
The sum of these numbers is 1634 + 8208 + 9474 = 19316.
Find the sum of all the numbers that can be written as the sum of fifth powers of their digits. <a href="https://www.cnblogs.com/xianglan/archive/2011/06/29/2093085.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/06/29/2093049.html[Project Euler] Problem 29 - xiatwhu<img style="vertical-align: middle;" src="http://projecteuler.net/images/symbol_le.gif" alt="≤" width="10" height="12" border="0" />Consider all integer combinations of ab for 2 a 5 and 2 img style="vertical-align: middle;" src="http://projecteuler.net/images/symbol_le.gif" alt="≤" width="10" height="12" border="02011-06-29T02:38:00Z2011-06-29T02:38:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】<img style="vertical-align: middle;" src="http://projecteuler.net/images/symbol_le.gif" alt="≤" width="10" height="12" border="0" />Consider all integer combinations of ab for 2 a 5 and 2 img style="vertical-align: middle;" src="http://projecteuler.net/images/symbol_le.gif" alt="≤" width="10" height="12" border="0 <a href="https://www.cnblogs.com/xianglan/archive/2011/06/29/2093049.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/03/28/1997548.htmlOpenCV函数学习之cvLUT - xiatwhu何为LUT,就是指显示查找表(Look-Up-Table),LUT(Look-Up Table)实际上就是一张像素灰度值的映射表,它将实际采样到的像素灰度值经过一定的变换如阈值、反转、二值化、对比度调整、线性变换等,变成了另外一个与之对应的灰度值,这样可以起到突出图像的有用信息,增强图像的光对比度的作用。我在以前写的python灰度变换就是和这个是一个意思我们来看看实际运用效果:#include <cv.h>#include <highgui.h>using namespace std;int main(int argc, char** argv) { IplImage2011-03-28T03:10:00Z2011-03-28T03:10:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】何为LUT,就是指显示查找表(Look-Up-Table),LUT(Look-Up Table)实际上就是一张像素灰度值的映射表,它将实际采样到的像素灰度值经过一定的变换如阈值、反转、二值化、对比度调整、线性变换等,变成了另外一个与之对应的灰度值,这样可以起到突出图像的有用信息,增强图像的光对比度的作用。我在以前写的python灰度变换就是和这个是一个意思我们来看看实际运用效果:#include <cv.h>#include <highgui.h>using namespace std;int main(int argc, char** argv) { IplImage <a href="https://www.cnblogs.com/xianglan/archive/2011/03/28/1997548.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/03/27/1997056.html[Project Euler] Problem 28 - xiatwhuStarting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13
It can be verified that the sum of the numbers on the diagonals is 101.
What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way?2011-03-27T09:51:00Z2011-03-27T09:51:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13
It can be verified that the sum of the numbers on the diagonals is 101.
What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way? <a href="https://www.cnblogs.com/xianglan/archive/2011/03/27/1997056.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/03/27/1997035.html[Project Euler] Problem 27 - xiatwhuEuler published the remarkable quadratic formula:
n² + n + 41
It turns out that the formula will produce 40 primes for the consecutive values n = 0 to 39. However, when n = 40, 402 + 40 + 41 = 40(40 + 1) + 41 is divisible by 41, and certainly when n = 41, 41² + 41 + 41 is clearly divisible by 41.
Using computers, the incredible formula n² − 79n + 1601 was discovered, which produces 80 primes for the consecutive values n = 0 to 79. The product of the coefficients, −79 and 1601, is −12642011-03-27T09:18:00Z2011-03-27T09:18:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】Euler published the remarkable quadratic formula:
n² + n + 41
It turns out that the formula will produce 40 primes for the consecutive values n = 0 to 39. However, when n = 40, 402 + 40 + 41 = 40(40 + 1) + 41 is divisible by 41, and certainly when n = 41, 41² + 41 + 41 is clearly divisible by 41.
Using computers, the incredible formula n² − 79n + 1601 was discovered, which produces 80 primes for the consecutive values n = 0 to 79. The product of the coefficients, −79 and 1601, is −1264 <a href="https://www.cnblogs.com/xianglan/archive/2011/03/27/1997035.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/03/25/1995807.htmlOpenCV函数学习之cvAbsDiff - xiatwhucvAbsDiffCalculates absolute difference between two arrays.void cvAbsDiff(const CvArr* src1, const CvArr* src2, CvArr* dst);src1 The first source arraysrc2 The second source arraydst The destination arrayThe function calculates absolute difference between two arrays.dst(i)c = |src1(I)c − src2(I)c |Al2011-03-25T10:54:00Z2011-03-25T10:54:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】cvAbsDiffCalculates absolute difference between two arrays.void cvAbsDiff(const CvArr* src1, const CvArr* src2, CvArr* dst);src1 The first source arraysrc2 The second source arraydst The destination arrayThe function calculates absolute difference between two arrays.dst(i)c = |src1(I)c − src2(I)c |Al <a href="https://www.cnblogs.com/xianglan/archive/2011/03/25/1995807.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/03/23/1992601.html[Project Euler] Problem 26 - xiatwhuA unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given:
1/2 = 0.5
1/3 = 0.(3)
1/4 = 0.25
1/5 = 0.2
1/6 = 0.1(6)
1/7 = 0.(142857)
1/8 = 0.125
1/9 = 0.(1)
1/10 = 0.1
Where 0.1(6) means 0.166666..., and has a 1-digit recurring cycle. It can be seen that 1/7 has a 6-digit recurring cycle.
Find the value of d 1000 for which 1/d contains the longest recurring cycle2011-03-23T07:42:00Z2011-03-23T07:42:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given:
1/2 = 0.5
1/3 = 0.(3)
1/4 = 0.25
1/5 = 0.2
1/6 = 0.1(6)
1/7 = 0.(142857)
1/8 = 0.125
1/9 = 0.(1)
1/10 = 0.1
Where 0.1(6) means 0.166666..., and has a 1-digit recurring cycle. It can be seen that 1/7 has a 6-digit recurring cycle.
Find the value of d 1000 for which 1/d contains the longest recurring cycle <a href="https://www.cnblogs.com/xianglan/archive/2011/03/23/1992601.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/03/07/1976516.html[Project Euler] Problem 25 - xiatwhuThe Fibonacci sequence is defined by the recurrence relation:2011-03-07T15:05:00Z2011-03-07T15:05:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】The Fibonacci sequence is defined by the recurrence relation: <a href="https://www.cnblogs.com/xianglan/archive/2011/03/07/1976516.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/03/07/1976431.html[Project Euler] Problem 24 - xiatwhuA permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are:
012 021 102 120 201 210
What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?2011-03-07T13:37:00Z2011-03-07T13:37:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are:
012 021 102 120 201 210
What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9? <a href="https://www.cnblogs.com/xianglan/archive/2011/03/07/1976431.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/03/06/1972620.html[Project Euler] Problem 23 - xiatwhuA perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
A number n is called deficient if the sum of its proper divisors is less than n and it is called abundant if this sum exceeds n.
As 12 is the smallest abundant number, 1 + 2 + 3 + 4 + 6 = 16, the smallest number that can be written as the sum of two abundant numbers 2011-03-06T15:22:00Z2011-03-06T15:22:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
A number n is called deficient if the sum of its proper divisors is less than n and it is called abundant if this sum exceeds n.
As 12 is the smallest abundant number, 1 + 2 + 3 + 4 + 6 = 16, the smallest number that can be written as the sum of two abundant numbers <a href="https://www.cnblogs.com/xianglan/archive/2011/03/06/1972620.html" target="_blank">阅读全文</a>https://www.cnblogs.com/xianglan/archive/2011/03/06/1972587.html[Project Euler] Problem 22 - xiatwhuUsing names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score.
For example, when the list is sorted into alphabetical order, COLIN, which is worth 3 + 15 + 12 + 9 + 14 = 53, is the 938th name in the list. So, COLIN would obtain a score of 938 × 53 = 49714.2011-03-06T14:29:00Z2011-03-06T14:29:00Zxiatwhuhttps://www.cnblogs.com/xianglan/【摘要】Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score.
For example, when the list is sorted into alphabetical order, COLIN, which is worth 3 + 15 + 12 + 9 + 14 = 53, is the 938th name in the list. So, COLIN would obtain a score of 938 × 53 = 49714. <a href="https://www.cnblogs.com/xianglan/archive/2011/03/06/1972587.html" target="_blank">阅读全文</a>