Import Image and Read Image

1.How to import image and read image?

Create file: The first thing we will do here we are in our project and we are going to click and you can right click anywhere and you can create a new item and we will call this chapter one.

Header files: enter file, so here first of all we are going to include all the header files that we require now throughout this course we will need only three files for opencv. so in one of the chapters we will need one more, but when we go there i will show you how to include that as well only three header files for opencv for opencv, so in one of the chapters we will need one more, but for the rest of them we will need only three files. so we are going to include we are going to write include and then we will write opencv and we will first need our image and then we will write opencv and we will first need our image codex, second need our highgui and imgproc.

 

we can start off by writing our path now our path will be a string so we can write here string but you can see it doesn't recognize string and the reason is that we have to use the standard library define that this is a string. to avoid these two things what we can do is we can write using name space cv and we can write using namespace std. we are going to define our path. we need create string path to get the image. when we have path, we are going to import our image so we say that Mat going to import our image so we will say that mat image is equals to imread and we will give in the path. this Mat is basically a matric data type that is introduced by opencv to handle all the images, so whenever we are talking about images, we will write the data type as matte. so then we will write  imshow  to show our image. but it will close automatically because we are not giving it any delay, so we have to add a delay so we can write waitkey, and here we can write 0 for infinity. so this way whenever ir opens up it will not close until we actually press the close butten. so let's run this. 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值