opencv学习-load image and display

本文介绍了OpenCV2.x版本的C++接口,强调了Mat和imread函数相对于C接口的优势。作者决定深入学习OpenCV,并分享了读取和显示图像的基本示例。在Linux环境下,通过编写简单的shell脚本完成编译,使得程序能够使用OpenCV库。
摘要由CSDN通过智能技术生成

OpenCV2.x版本有了C++接口,如Mat imread 与 IplImage cvLoadImage.

They are the two different interfaces (Mat/imread for C++ and Ipl... and Cv.. for C interface). The C++ interface is nicer, safer and easier to use. It automatically handles memory for you, and allows you to write less code for the same task. The OpenCV guys advocate for the usage of C++, unless some very specific project requirements force you to C.

从今天开始好好学习OpenCV.


下面是sample的第一个例子,最基本,读取图片并显示。

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main( int argc, char** argv )
{
    if( argc != 2)
    {
     cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
     return -1;
    }

    Mat image;
    image = imread(argv[1], CV_LOAD_IMAGE_COLOR);	// Read the file
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值