▼页尾

07 2011 档案

摘要:在这个例子中,我们开始选定一种颜色,并设置一个阈值然后把图片中和所选颜色的差别在阈值中的点标定出来在这个例子中,主要要注意这两点:1. OpenCV与QT的结合,包括Mat 与 QImage 的转换2. 我们使用了类来实现此功能,创建了一个单例模式的类首先我们创建一个简单的图形界面,使用的是QT创建处理图像用的类#ifndef COLORDETECTOR_H_#define COLORDETECTOR_H_#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include < 阅读全文
posted @ 2011-07-31 14:21 xiatwhu 阅读(15944) 评论(1) 推荐(0)
摘要:内容来自《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中,一 阅读全文
posted @ 2011-07-30 23:21 xiatwhu 阅读(25075) 评论(1) 推荐(1)
摘要: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 阅读全文
posted @ 2011-07-30 20:52 xiatwhu 阅读(12710) 评论(6) 推荐(0)
摘要:椒盐噪声是由图像传感器,传输信道,解码处理等产生的黑白相间的亮暗点噪声。椒盐噪声往往由图像切割引起。我们用程序来模拟椒盐噪声,随机选取一些像素,把这些像素设为白色。#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( 阅读全文
posted @ 2011-07-28 12:00 xiatwhu 阅读(8686) 评论(1) 推荐(0)
摘要: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 阅读全文
posted @ 2011-07-28 11:53 xiatwhu 阅读(7619) 评论(0) 推荐(0)
摘要: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? 阅读全文
posted @ 2011-07-02 14:56 xiatwhu 阅读(529) 评论(0) 推荐(0)

▲页首
西