File: debugviewer.cpp

package info (click to toggle)
os-autoinst 4.3%2Bgit20160919-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,860 kB
  • ctags: 665
  • sloc: perl: 7,624; cpp: 1,584; python: 216; makefile: 188; sh: 63
file content (37 lines) | stat: -rw-r--r-- 961 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* 
   this is from the opencv documentation - just extended with a loop
*/

#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: debugviewer qemuscreenshot/last.png" << endl;
     return -1;
    }

    Mat image;
    while (1) {
      image = imread(argv[1], CV_LOAD_IMAGE_COLOR);   // Read the file
      
      if(! image.data )                              // Check for invalid input
	{
	  cout <<  "Could not open or find the image" << std::endl ;
	  return -1;
	}
      
      namedWindow( "Display window", WINDOW_AUTOSIZE );// Create a window for display.
      imshow( "Display window", image );                   // Show our image inside it.
      
      if (waitKey(300) >= 0)                                          // Wait for a keystroke in the window
	break;
    }
    return 0;
}