MV(一)----Load image

I am not good at the English.But I will use English to record the process of learn Computer Vision(CV).Today is the fisrt time to record the test,so let us to pratice a simple demo about how to read a Image and show it.it's the base about CV.it's very easy.

Firstly,I am going to introduce a library about CV.it's OpenCV.it's a open source library.it can help us to read and process the Image and video.I am not going to introduce the configure about OpenCV in the Microsoft Visual Studio.you can search these by Baidu or Google.they will provide many ways to help you solve the problem.

Secondly,let us to see the Code:

#include"iostream"
#include"opencv2/opencv.hpp"

using namespace std;
using namespace cv;

int main(int argc, char* argv)
{
	Mat src = imread("7258\\m1.png");
	imshow("src", src);
	waitKey(0);
	return 0;
}

Look!it's short and simple.But it's too hard for the rookie.In fact ,I am a rookie , too.

#include"iostream"
#include"opencv2/opencv.hpp"

#include is used to load the head file.if you lerned the C++ ,you must be know the effect.if you have never learn about the computer language,I think that you'd better learn it spend a lot time.it's important for your future.

using namespace std;
using namespace cv;

this two lines will help us cut the long code.If we don't use these we should write cv::imread() to read a image.

int main(int argc, char* argv)
{
	Mat src = imread("7258\\m1.png");
	imshow("src", src);
	waitKey(0);
	return 0;
}

this is the main function.we can see the four lines in the main function.this is the key message today.imread() will read an Image and return a Mat Object.In the OpenCV of the C++,we are often use the Mat Object.imshow(name string,Mat Object) will show the Image ,then we will see the picture on the screen.waitKey(0) help us keep the picture on the screen all the time untill you push the Enter or else Key.if we are not use the waitKey(0),you will see the picture,then disappear right away.if you have learned the C++, I belive that you are not ask the question.

Last but not least,I am not a tutor and this article is not a tutorials.I just to record the process,and let others can learn some thing from my experience.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值