OpenCV基础
来源:互联网 发布:广州java培训价格 编辑:程序博客网 时间:2024/05/22 02:53
在OpenCV中最常包含的静态库为opencv.hpp,cxcore.h,highgui.h
OpenCV中IplImage结构体最重要的参数为width,height,imagedata,nchannels
1、读取图像函数cvLoadImage(””)
2、新建图像函数cvCreateImage (size,depth,channels)
3、创建窗口函数cvNamedWindow
4、在指定窗口中显示图像 cvShowImage
5、将彩色图像转化为黑白图像cvCvtColor
5、等待按键事件 cvWaitKey
这几个函数的应用:
#include"stdafx.h"
#include<opencv.hpp>
#include<cxcore.h>
#include<highgui.h>
#include<stdio.h>
int main()
{
#if 0
cv::Mat image=cv::imread("lena.jpg");//读入一张图片
cv::imshow("Test for Opencv2.4.9",image);//显示一张图片
cv::waitKey();
#else
IplImage *ImageInfo = cvLoadImage("1.jpg");
unsignedshort mWide = ImageInfo->width;
unsignedshort mHeight = ImageInfo->height;
unsignedchar *ImageData = (unsignedchar*)ImageInfo->imageData;
unsignedchar nChannel = ImageInfo->nChannels;
IplImage *GrayImage = cvCreateImage(cvSize(mWide,mHeight),8,1);
cvCvtColor(ImageInfo,GrayImage,CV_RGB2GRAY);
printf("mWide = %d\r\n mHeight = %d\r\n nChannel = %d\r\n",mWide,mHeight,nChannel);
cvNamedWindow("the Image of show:");
cvShowImage("the Image of show:",ImageInfo);
cvNamedWindow("the GrayImage of show:");
cvShowImage("the GrayImage of show:",GrayImage);
cvWaitKey(-2);
#endif
return 0;
}
- OpenCV----OpenCV基础数据结构
- opencv 基础
- OPENCV基础
- OpenCV基础
- OpenCV基础
- opencv基础
- opencv基础
- openCV-基础
- opencv基础
- OpenCV基础
- opencv基础
- OpenCV基础数据结构--基础入门
- openCV基础函数【转】
- OpenCV基础数据结构
- OpenCV 基础数据结构 家谱!
- 学习opencv基础
- OpenCV 基础函数
- OpenCV基础结构
- Python Twisted框架中socket通讯
- HDU_4978_A simple probability problem.(推导or精度枚举)
- Eclipse的Tomcat插件安装
- HDU 2225 Asteroids!(三维BFS)
- Linux LVM硬盘管理及LVM扩容
- OpenCV基础
- 8.27 super hero
- 智能人员定位实训平台(CY-RYDW-100)
- IE6中margin-bottom为负值时失效
- STRUTS基本工作流程
- LG高调进军中华电商
- 解决org/junit/Assume$AssumptionViolatedException异常
- 报表,是件容易的事吗?
- 面向对象的设计方式处理Android编程中的GridView问题,以及自定义ListAdapter的使用