title: To get pixel values of images
body: <p>Below is the code which provides width,height and BGR values of 2 images.But the problem is until i close the first image i cant see the second image.What modifications to be made such that i can see both images at a time and get the all the pixel values.</p>
  
  <pre><code>1 . #include &lt;cv.h&gt;
  #include&lt;iostream&gt;
  #include &lt;cxcore.h&gt;
  #include &lt;highgui.h&gt;
  
  using namespace std;
  
  int main(int argc, char** argv[])
  {
      int  width,height;
       int i=0,j=0,k=3,l=3;
  
          IplImage *img1 = cvLoadImage("E:/images.jpg");
          cvNamedWindow("Image1:",1);
          cvShowImage("Image1:",img1);
          cout &lt;&lt; "Width:" &lt;&lt;  img1-&gt;width &lt;&lt; endl;
          cout &lt;&lt; "Height:" &lt;&lt;  img1-&gt;height &lt;&lt; endl;
          CvScalar s;
          s=cvGet2D(img1,i,j); // get the (i,j) pixel value
          printf("B=%f, G=%f, R=%f\n",s.val[0],s.val[1],s.val[2]);
          cvWaitKey();
          cvDestroyWindow("Image1:");
  
          IplImage *img2 = cvLoadImage("C:/Users/Public/Pictures/Sample Pictures/Tulips.jpg");
          cvNamedWindow("Image2:",2);
          cvShowImage("Image2:",img2);
          cout &lt;&lt; "Width:" &lt;&lt;  img2-&gt;width &lt;&lt; endl;
          cout &lt;&lt; "Height:" &lt;&lt;  img2-&gt;height &lt;&lt; endl;
  
          s=cvGet2D(img2,k,l); // get the (k,l) pixel value
          printf("B1=%f, G1=%f, R1=%f\n",s.val[0],s.val[1],s.val[2]);
          cvWaitKey();
          cvDestroyWindow("Image2:");
  
          cvReleaseImage(&amp;img1);
          cvReleaseImage(&amp;img2);
  
          return 0;
  }
  </code></pre>