Rev 3 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3 | Rev 5 | ||
---|---|---|---|
1 | /*------------------------------------------------------------------------------------------*\
|
1 | /*------------------------------------------------------------------------------------------*\
|
2 | This file contains material supporting chapter 1 of the cookbook:
|
2 | This file contains material supporting chapter 1 of the cookbook:
|
3 | Computer Vision Programming using the OpenCV Library.
|
3 | Computer Vision Programming using the OpenCV Library.
|
4 | by Robert Laganiere, Packt Publishing, 2011.
|
4 | by Robert Laganiere, Packt Publishing, 2011.
|
5 | 5 | ||
6 | This program is free software; permission is hereby granted to use, copy, modify,
|
6 | This program is free software; permission is hereby granted to use, copy, modify,
|
7 | and distribute this source code, or portions thereof, for any purpose, without fee,
|
7 | and distribute this source code, or portions thereof, for any purpose, without fee,
|
8 | subject to the restriction that the copyright notice may not be removed
|
8 | subject to the restriction that the copyright notice may not be removed
|
9 | or altered from any source or altered source distribution.
|
9 | or altered from any source or altered source distribution.
|
10 | The software is released on an as-is basis and without any warranties of any kind.
|
10 | The software is released on an as-is basis and without any warranties of any kind.
|
11 | In particular, the software is not guaranteed to be fault-tolerant or free from failure.
|
11 | In particular, the software is not guaranteed to be fault-tolerant or free from failure.
|
12 | The author disclaims all warranties with regard to this software, any use,
|
12 | The author disclaims all warranties with regard to this software, any use,
|
13 | and any consequent failure, is purely the responsibility of the user.
|
13 | and any consequent failure, is purely the responsibility of the user.
|
14 |
|
14 |
|
15 | Copyright (C) 2010-2011 Robert Laganiere, www.laganiere.name
|
15 | Copyright (C) 2010-2011 Robert Laganiere, www.laganiere.name
|
16 | \*------------------------------------------------------------------------------------------*/
|
16 | \*------------------------------------------------------------------------------------------*/
|
17 | 17 | ||
18 | #include <opencv2/core/core.hpp>
|
18 | #include <opencv2/core/core.hpp>
|
19 | #include <opencv2/highgui/highgui.hpp>
|
19 | #include <opencv2/highgui/highgui.hpp>
|
20 | 20 | ||
21 | int main() { |
21 | int main() { |
22 | 22 | ||
23 | // read an image
|
23 | // read an image
|
24 | cv::Mat image= cv::imread("img.jpg"); |
24 | cv::Mat image= cv::imread("baboon1.jpg"); |
25 | // create image window named "My Image"
|
25 | // create image window named "My Image"
|
26 | cv::namedWindow("My Image"); |
26 | cv::namedWindow("My Image"); |
27 | // show the image on window
|
27 | // show the image on window
|
28 | cv::imshow("My Image", image); |
28 | cv::imshow("My Image", image); |
29 | // wait key for 5000 ms
|
29 | // wait key for 5000 ms
|
30 | cv::waitKey(5000); |
30 | cv::waitKey(5000); |
31 | 31 | ||
32 | return 1; |
32 | return 1; |
33 | }
|
33 | }
|
34 | 34 |