title: formats of image in open cv
body: <p>I need to save an image in different format using opencv and c++.
  Have a code for displaying the image and exits when a key is pressed. 
  What are the possible formats in which a image in jpeg be displayed and how?</p>
  
  <pre><code>#include &lt;opencv2/core/core.hpp&gt;
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  #include &lt;iostream&gt;
  
      using namespace cv;
      using namespace std;
  
      int main( int argc, char** argv )
      {
      if( argc != 2)
      {
      cout &lt;&lt;" Usage: display_image ImageToLoadAndDisplay" &lt;&lt; endl;
      return -1;
      }
  
      Mat image;
      image = imread(argv[1], CV_LOAD_IMAGE_COLOR);  
  
      if(! image.data )                             
      {
      cout &lt;&lt;  "Could not open or find the image" &lt;&lt; std::endl ;
      return -1;
      }
  
      namedWindow( "Display window", WINDOW_AUTOSIZE );
      imshow( "Display window", image );                 
  
      waitKey(0);                                          
      return 0;
      }
  </code></pre>