title: Contrast & brightness of images using IplImage
body: <p>Please have a look at the following code</p>
  
  <pre><code>using namespace cv;
  double alpha = 1.6;
  int beta = 50;
  int i = 0;
  IplImage* input_img = cvLoadImage("c:\\Moori.jpg", CV_LOAD_IMAGE_GRAYSCALE);
  IplImage* imageGray = cvCreateImage(cvSize(input_img-&gt;width, input_img-&gt;height), IPL_DEPTH_8U, 1);
      for( int y = 0; y &lt; input_img-&gt;height; y++ )
      { 
          for( int x = 0; x &lt; input_img-&gt;width; x++ )
          { 
  
              i = y * imageGray-&gt;width + x;
              imageGray-&gt;imageData[i] = (alpha * input_img-&gt;imageData[i]) + beta;
          }
      }
  cvNamedWindow("Image IplImage", 1);
  cvShowImage("Image IplImage", imageGray);
  waitKey();
  cvReleaseImage(&amp;imageGray);
  cvReleaseImage(&amp;input_img);
  cvDestroyWindow("Image IplImage");
  </code></pre>
  
  <p>when I run this code, it shows an image with many dark pixels.
  But, when i run the code, which is available at:
  <a href="http://docs.opencv.org/doc/tutorials/core/basic_linear_transform/basic_linear_transform.html" rel="nofollow">http://docs.opencv.org/doc/tutorials/core/basic_linear_transform/basic_linear_transform.html</a>
  it works fine. I want to do by IplImage. Please help</p>