opencv例程学习
文章平均质量分 87
opecv图像视频例程学习,及实现例程代码学习。
Digital2Slave
图像处理算法,机器学习,深度学习及其应用。
展开
-
opencv-图像缩放
图像大小变换void cvResize( const CvArr* src, CvArr* dst, int interpolation=CV_INTER_LINEAR ); src输入图像.dst输出图像.interpolation插值方法:CV_INTER_NN - 最近邻插值,CV_INTER_LINEAR - 双线性插值 (缺省使用)CV_INTER_AREA -转载 2013-07-28 11:25:58 · 2243 阅读 · 0 评论 -
VSRS3.5配置问题,error LINK2019 _cvInpaint error LINK1120
前一段时间一直对虚拟视点绘制软件VSRS3.5感到困惑,今天在实验室朋友的帮忙下,彻底把问题解决了。2.这个问题的产生主要是由于库文件没有选择完全;之前根据opencv官方论坛配置的库一直是不全的。//=======opencv 2.4.3======//配置DEBUG:opencv_calib3d243d.libop原创 2013-06-16 21:41:24 · 3191 阅读 · 11 评论 -
大津阈值OSTU函数实现方法对比, Mat转换为IplImage 类型,并复制数据
实现代码如下:#include #include //图像处理时间#include //图像对象厚度计算#include //使用setw必须使用该预编译命令#include "cv.h"#include "opencv2/core/core.hpp"#include "opencv2/highgui/highgui.hpp"#include "opencv2/im原创 2013-07-02 20:05:17 · 2784 阅读 · 2 评论 -
opencv-直方图均衡化
图像进行直方图均衡化可以增强图像的对比度效果!!!#include "opencv2/highgui/highgui.hpp"#include "opencv2/imgproc/imgproc.hpp"#include #include using namespace cv;using namespace std;int main( int argc, char** argv原创 2013-04-07 21:07:14 · 1773 阅读 · 0 评论 -
Opencv2.4.2+vs2008+windowsXP(32位)安装过程
Opencv2.4.2+vs2008+windowsXP(32位)安装过程准备软件:opencv2.4.2、VS2008软件1、 解压opencv2.4.2到指定路径。例如:D:\Program Files\OpenCV2.4.2 2、打开vs2008,选择工具——选项——项目和解决方案——VC++目录,显示如下界面,配置包含文件、库文件。 3、为解决方案中的项目配置原创 2012-11-23 08:54:15 · 2063 阅读 · 2 评论 -
opencv-图像反转和翻转
/*Name : ImageReverseAndRollover.cppFunction: 读入bmp图像文件,进行图像反转和翻转,并在屏幕上显示*//*========================================OpenCV实现图像翻转=====================================参考http://hi.baidu.com原创 2012-11-29 16:05:42 · 12847 阅读 · 0 评论 -
Opencv2.4.3_tutorials(学习指南)——load and display an Image
1 #include 2 #include 3 #include 45 using namespace cv;6 using namespace std;78 int main( int argc, char**argv )9 {10 if( argc != 2)11 {12 cout <<" Usage: display_image ImageToLoadAndDispla翻译 2013-02-22 15:59:30 · 1606 阅读 · 0 评论 -
opecv-图像加载,修改和保存
imread用于加载图像;cvtColor用于实现图像的转换,由RGB→Grascale;imwrite用于实现对变换后的图像进行存储;具体实现程序如下:#include #include using namespace cv;using namespace std;int main( int argc, char**argv ){ Mat image;原创 2013-03-08 14:30:33 · 1594 阅读 · 0 评论 -
opencv-Mat
Mat应用:#include #include #include #include using namespace std;using namespace cv;int main(){ //Mat() Constructor Mat M(2,2,CV_8UC3,Scalar(0,0,255)); cout<<"M = "<<endl<<" "<<M<<en原创 2013-03-23 20:57:13 · 1672 阅读 · 0 评论 -
opencv-Mat补充
opencv2.4.3所给代码如下:/* For description look into the help() function. */#include "opencv2/core/core.hpp"#include //#include //#include //#include //#include using namespace std;using name原创 2013-03-24 10:47:03 · 1411 阅读 · 0 评论 -
opencv-图像扫描,查表和处理时间选择
目标:如何扫描图像中的每一个像素点?Opencv如何存储像素矩阵值?如何测试算法的性能?#include #include #include #include using namespace std;using namespace cv;void help(){ cout << "\n--------------------------原创 2013-03-24 11:48:41 · 1453 阅读 · 0 评论 -
opencv-图像像素值矩阵掩膜操作之锐化滤波
利用掩膜和滤波函数对输入图像进行操作,并比较处理时间。#include #include #include #include using namespace std;using namespace cv;void help(char* progName){ cout << endl << "This program shows how to fi原创 2013-03-24 14:17:51 · 3136 阅读 · 0 评论 -
opencv-SURF和STFT
1.SURF: Speeded Up Robust Features" is a performant scale- and rotation-invariant interest point detector and descriptor.函数surf的作用:画三维曲面(色)图,起作用与mesh相似surf(X,Y,Z) X、Y、Z中Z通常是X,Y的函数,即Z(X,Y)原创 2013-03-24 14:38:50 · 2511 阅读 · 0 评论 -
opencv-输入两幅图像实现线性融合
#include #include #include using namespace cv;using namespace std;int main(){ double alpha = 0.5;double beta;double input; Mat src1,src2,dst; cout<<"Simple linear blender"<<endl; cout<<"-原创 2013-03-24 15:05:31 · 2524 阅读 · 0 评论 -
opencv-改变图像的对比度和亮度
#include #include #include using namespace cv;using namespace std;double alpha; /**< Simple contrast control*/int beta; /**< Simple brightness control*/int main( int argc, char**argv ){ ///原创 2013-03-24 16:16:44 · 1856 阅读 · 0 评论 -
opencv-线,椭圆,长方形(矩形),圆,填充多边形绘制
#include #include #define w 400using namespace cv;/// Function headersvoid MyEllipse( Mat img, double angle );void MyFilledCircle( Mat img, Point center );void MyPolygon( Mat img );void MyL原创 2013-03-24 17:27:09 · 7143 阅读 · 0 评论 -
opencv-canny边缘检测
#include "opencv2/imgproc/imgproc.hpp"#include "opencv2/highgui/highgui.hpp"#include #include #include using namespace cv;using namespace std;//全局变量Mat src, src_gray;Mat dst, detected_edges;原创 2013-03-27 22:30:39 · 1746 阅读 · 0 评论 -
opencv-随机生成器和文本操作
本文主要用opencv2.4.3随机函数实现生成线条,矩形,椭圆,折线,填充多边形,以及在运行窗口中显示文本的功能。#include #include #include #include using namespace cv;//全局变量const int NUMBER = 100;const int DELAY = 5; //静态变量const int window原创 2013-03-30 21:08:22 · 1667 阅读 · 0 评论 -
opencv - DFT
本文主要使用DFT相关函数实现对水平文本和旋转文本的DFT变换,在幅度谱中识别文本的变换,从而为图像旋转的检测和校正做准备。#include "opencv2/core/core.hpp"#include "opencv2/imgproc/imgproc.hpp"#include "opencv2/highgui/highgui.hpp"#include using namesp原创 2013-03-30 23:03:11 · 2307 阅读 · 0 评论 -
oencv-xml,yaml文件格式的写和读
#include #include #include using namespace cv;using namespace std;void help(char** av){ cout << endl << av[0] << " shows the usage of the OpenCV serialization functionality."原创 2013-03-31 11:08:06 · 1983 阅读 · 0 评论 -
opencv不同版本之间的互操作性
下图1,为配置截图;下图2为含有#define DEMO_MIXED_API_USE的运行结果,下图3为不含有#define DEMO_MIXED_API_USE的运行结果。实现代码如下所示:#include #include #include #include #include using namespace cv; // The new C++ interface AP原创 2013-03-31 12:23:28 · 1319 阅读 · 0 评论 -
opencv-图像滤波
在今后的几篇文章中,我将重点针对图像处理过程的一些常用操作,用opencv2.4.3代码实现。本文主要讨论图像的滤波处理过程,即图像的模糊;主要用于去除图像上面的噪声。1.线性滤波器这是最常见的线性滤波等式,其中,f(i+k,j+l)为对应图像像素点的像素值,h(k,l)为窗口系数组成的核,它主要用于对图像像素点进行加权操作。2.归一化块滤波器这原创 2013-03-31 13:29:52 · 1698 阅读 · 0 评论 -
opencv-腐蚀和膨胀
两个基本的形态学操作:腐蚀和膨胀!其作用如下所述:1.去除噪声2.孤立图像中的元素,向图像中添加独立的元素3.查找图像中的强度空洞实现代码如下:#include "opencv2/imgproc/imgproc.hpp"#include "opencv2/highgui/highgui.hpp"#include "highgui.h"#include #includ原创 2013-03-31 14:18:22 · 1455 阅读 · 0 评论 -
opencv-形态学组合运算
上一篇文章实现了图像形态学的两个基本操作:腐蚀和膨胀。本文则主要基于上文进行图像形态学的组合运算。1.开运算对图像进行先腐蚀后膨胀的操作就是图像的开运算。它的功能是有利于移走黑色前景下的白色小物体。2.闭运算对图像进行先膨胀后腐蚀的操作就是图像的闭运算。它的功能是有利于移走黑色区域小洞。3.形态学梯度形态学梯度是一幅图像腐蚀和膨胀的差值。原创 2013-03-31 15:00:57 · 1465 阅读 · 0 评论 -
opencv-图像金字塔-上采样-下采样
本文主要实现对输入图像的上采样和下采样操作,使用到pyrUP和pyrDown两个函数来对分别对图像进行上采样和下采样。图像金字塔是一系列图像集合,它们从源图像连续的进行下采样,直到需要的位置才停止操作。两种常见的图像金子塔如下所述:1.高斯金字塔:用于下采样图像。2.拉普拉斯金字塔:用于把下层低分辨率的图像进行上采样重建。本文用到的是高斯金字塔。1)高斯金字塔图形如下所示,翻译 2013-04-02 17:12:02 · 5562 阅读 · 0 评论 -
opencv-基础阈值操作
opecv带有阈值函数threshold。主要完成5种类型的阈值操作。1.Threshold Binary蓝线为阈值2.Threshold Binary, Inverted3.Truncate4.Threshold to Zero5.Threshold to Zero, Inverted原创 2013-04-02 17:55:30 · 1377 阅读 · 0 评论 -
opencv-线性滤波器filer2D
#include "opencv2/imgproc/imgproc.hpp"#include "opencv2/highgui/highgui.hpp"#include #include using namespace cv;int main ( int argc, char** argv ){ //变量声明 Mat src, dst; Mat kernel; Po原创 2013-04-02 18:19:34 · 1974 阅读 · 0 评论 -
opencv-图像添加边界(填充)
为图像填充边界,以便进行滤波,卷积等有关图像边界处理的操作。#include "opencv2/imgproc/imgproc.hpp"#include "opencv2/highgui/highgui.hpp"#include #include using namespace cv;//全局变量Mat src, dst;int top, bottom, left, righ原创 2013-04-02 20:18:00 · 7195 阅读 · 2 评论 -
opencv-sobel算子
sobel边界检测步骤:1.计算水平和垂直方向的变化:2.计算图像上每个像素点的近似梯度:或者有时候简化计算为:#include "opencv2/imgproc/imgproc.hpp"#include "opencv2/highgui/highgui.hpp"#include #include using namespace cv;原创 2013-04-02 20:52:06 · 1810 阅读 · 0 评论 -
opencv-laplace算子
#include "opencv2/imgproc/imgproc.hpp"#include "opencv2/highgui/highgui.hpp"#include #include using namespace cv;int main( int argc, char** argv ){ Mat src, src_gray, dst; int kernel_size原创 2013-04-02 21:05:23 · 1412 阅读 · 0 评论 -
opencv-Hough变换
#include "opencv2/highgui/highgui.hpp"#include "opencv2/imgproc/imgproc.hpp"#include using namespace cv;using namespace std;static void help(){ cout << "\nThis program demonstrates line f原创 2013-04-03 08:48:12 · 1609 阅读 · 0 评论 -
openv-remap,图像缩小,上下翻转,左右翻转,上下左右翻转
如题所示,本篇文章主要用opencv自带remap函数实现图像的缩小一倍居中显示,上下翻转,左右翻转,上下左右翻转等功能。具体实现代码如下所示:(附图有原始图像,程序运行结果截图四张,配置文件截图)#include "opencv2/highgui/highgui.hpp"#include "opencv2/imgproc/imgproc.hpp"#include #include原创 2013-04-07 19:27:38 · 4812 阅读 · 0 评论 -
opencv-图像仿射变换
#include "opencv2/highgui/highgui.hpp"#include "opencv2/imgproc/imgproc.hpp"#include #include using namespace cv;using namespace std;//全局变量char* source_window = "Source image";char* warp_win原创 2013-04-07 20:02:33 · 2017 阅读 · 0 评论 -
opencv-视频PSNR SSIM对比
#include // for standard I/O#include // for strings#include // for controlling float print precision#include // string to number conversion#include // Gaussian Blur#include //原创 2013-04-08 19:29:10 · 3832 阅读 · 0 评论 -
opencv-直方图计算R,G,B
图像的直方图不单单可以表示强度值(即像素值)分布情况,还可以表示图像像素点的梯度,运动方向等信息。dims:表示要处理的参数数目,可以是强度值,梯度值,方向值等。本文只对像素点的强度值进行计算直方图操作,故dim=1.bins:每一个dim下亚分割的箱子个数。本文中的bins=16.range:像素值的测量范围。本文中range=[0,255]具体的实现过程参考一下代码,及部分注释原创 2013-04-08 22:00:30 · 2076 阅读 · 0 评论 -
opencv-直方图比较
#include "opencv2/highgui/highgui.hpp"#include "opencv2/imgproc/imgproc.hpp"#include #include using namespace std;using namespace cv;int main( int argc, char** argv ){ Mat src_base, hsv_b原创 2013-04-08 22:27:09 · 1667 阅读 · 0 评论 -
opencv-反投影
#include "opencv2/imgproc/imgproc.hpp"#include "opencv2/highgui/highgui.hpp"#include using namespace cv;using namespace std;//全局变量Mat src; Mat hsv; Mat hue;int bins = 12;//函数声明void Hist_a原创 2013-04-09 22:14:49 · 2327 阅读 · 0 评论 -
opencv-模板匹配
#include "opencv2/highgui/highgui.hpp"#include "opencv2/imgproc/imgproc.hpp"#include #include using namespace std;using namespace cv;//全局变量Mat img; Mat templ; Mat result;char* image_window =原创 2013-04-10 10:42:17 · 1974 阅读 · 0 评论 -
opencv-图像轮廓
本文主要使用opencv自带findContours函数和drawContours函数实现图像的轮廓查找绘制。#include "opencv2/highgui/highgui.hpp"#include "opencv2/imgproc/imgproc.hpp"#include #include #include using namespace cv;using name原创 2013-04-10 10:50:51 · 1857 阅读 · 2 评论 -
opencv-摄像头人脸人眼实时检测
本文主要应用opencv自带函数CascadeClassifier,load和detecMultiScale,实现摄像头人脸人眼实时检测功能!#include "opencv2/objdetect/objdetect.hpp"#include "opencv2/highgui/highgui.hpp"#include "opencv2/imgproc/imgproc.hpp"原创 2013-04-10 12:00:57 · 6698 阅读 · 7 评论