OpenCV 之图像篇 常用函数
来源:互联网 发布:unity3d虚拟现实 编辑:程序博客网 时间:2024/06/07 06:19
HighGUI Reference Manual
http://www.ai.rug.nl/vakinformatie/pas/content/Highgui/opencvref_highgui.htm
cpp文件前包含头文件
#include "cv.h"
#include "highgui.h"
需要包含的库文件
cv210.lib
cvaux210.lib
cxcore210.lib
highgui210.lib
经常会用到的图像函数
// Create a size
CvSize sz = cvSize( img->width & -2, img->height & -2 );
// Flip Image
cvConvertImage(resultImg, resultImg, CV_CVTIMG_FLIP);
切忌此函数不可用于通道(nChannel)超过3的iplImage,否则图像将失去原有的色调
// Allocate space for image
IplImage* image = cvCreateImage( imgSize, IPL_DEPTH_8U, 1);
IplImage* pyr = cvCreateImage( cvSize(sz.width/2, sz.height/2), 8, 3 );
// Change the color
cvCvtColor( difference,greyImage, CV_BGR2GRAY );
// Gaussian smooth
cvSmooth(image,image,CV_GAUSSIAN,7,7);
// Thresholding
cvThreshold(difference,difference,50,255,CV_THRESH_BINARY);
// Image show
cvShowImage("Output",output);
// Make a copy of image
IplImage* timg = cvCloneImage( img );
// Create angle and scale
double angle = -90.0;
double scale = 1.0;
CvMat* rot_mat = cvCreateMat(2,3,CV_32FC1);
IplImage* dst = cvCreateImage( cvSize(resultImg->height, resultImg->width), 8, 1 );
cvConvertImage
// Compute rotation matrix
CvPoint2D32f center = cvPoint2D32f( resultImg->width/2, resultImg->height/2 );
cv2DRotationMatrix( center, angle, scale, rot_mat );
// Do the transformation
cvWarpAffine( resultImg, dst, rot_mat );
// Copy an Image
cvCopy( timg, tgray, 0 );
// Clone an Image
IplImage* dst = cvCloneImage(resultImg);
// Create window with name "image"
cvNamedWindow( "image", 1 );
// Resize Image
IplImage *imgB = resizeImage (imgIn, 1024, 768, false);
// Show image in window
cvShowImage("src", pImg);
// Save and Load Image
cvSaveImage(outFileName,img);
cvLoadImage(fileName);
img=cvLoadImage(fileName,flag);
flag: >0 the loaded image is forced to be a 3-channel color image
=0 the loaded image is forced to be a 1 channel grayscale image
<0 the loaded image is loaded as is (with number of channels in the file).
Supported image formats: BMP, DIB, JPEG, JPG, JPE, PNG, PBM, PGM, PPM, SR, RAS, TIFF, TIF
// Distrory window with name "image"
cvDestroyWindow("image");
// Release memory space
cvReleaseImage( &newImg );
// Release Image after Distrory
cvReleaseImage(&pImg);
// Wait for key press
cvWaitKey(0);
// Capture a key press, but more importantly allow the window to refresh
key = cvWaitKey(1);
- OpenCV 之图像篇 常用函数
- opencv常用图像函数
- OpenCV 图像处理常用函数
- OpenCV 图像处理常用函数
- opencv常用图像处理函数
- opencv 图像的常用函数
- opencv图像处理常用函数
- opencv 图像操作,常用 OpenCV 内置函数
- opencv学习篇(1) 图像处理和图像识别中常用的OpenCV函数
- 图像处理中常用的OpenCV函数
- 图像处理常用的OpenCV函数
- OpenCV 图像处理常用函数(转)
- opencv常用图像(矩阵)操作函数
- opencv常用图像(矩阵)操作函数
- OpenCV常用函数——图像采样
- OpenCV图像处理中常用函数汇总
- OpenCV图像处理篇之阈值操作函数
- 图像处理和图像识别中常用的OpenCV函数
- 光照
- php网站验证码无法显示
- EVB 系列协议(802.11qbg D1.2)
- 短代码-字符串检测
- A cygwin mirror website
- OpenCV 之图像篇 常用函数
- google-glog 修改 参数的三种方法,包括日志目录
- WIN7 IIS安装
- CQL概念
- Flash Builder 4-找不到所需的 Adobe Flash Player
- EJB的工作原理
- MFC诊断信息输出(一)
- 用户打电话给腾讯QQ客服
- Spring事务拦截器 AOP原理