title: opencv c++ change ipl to mat accumulate
body: <p>i tried to change code ipl to mat</p>
  
  <p>but failed</p>
  
  <p>i use opencv 4.1.2</p>
  
  <p>this sample uses opencv 2.4.13</p>
  
  <p><a href="https://jadeshin.tistory.com/entry/cvAcc%EC%97%90-%EC%9D%98%ED%95%9C-%EB%B0%B0%EA%B2%BD-%EC%98%81%EC%83%81-%EA%B3%84%EC%82%B0" rel="nofollow noreferrer">https://jadeshin.tistory.com/entry/cvAcc에-의한-배경-영상-계산</a></p>
  
  <p>i can't use ipl</p>
  
  <p>so i changed</p>
  
  <pre><code> #include &lt;opencv2\opencv.hpp&gt;
   #include &lt;opencv2\highgui\highgui.hpp&gt;
   #include &lt;opencv2\core\mat.hpp&gt;
   #include &lt;opencv2\imgproc.hpp&gt;
   #include &lt;iostream&gt;
  
  using namespace cv;
  using namespace std;
  
  int main()
  {
      VideoCapture cap("ball.avi");
      if (!cap.isOpened())
      {
              cout &lt;&lt; "file not found." &lt;&lt; endl;
              return 0;
      }
      Mat image;
      Size size = Size((int)CAP_PROP_FRAME_WIDTH, (int)CAP_PROP_FRAME_HEIGHT);
      Mat grayImage(size, CV_8UC1);
      Mat sumImage(size, CV_32FC1);
      sumImage.setTo(Scalar::all(0));
      int nFrameCount = 0;
      for (;;)
      {
              cap.read(image);
              if (image.empty())
              {
                      cout &lt;&lt; "could'nt capture" &lt;&lt; endl;
                      break;
              }
  
              cvtColor(image, grayImage, COLOR_BGR2GRAY);
              accumulate(grayImage, sumImage, NULL); //here is error
              imshow("grayImage", grayImage); 
              char chKey = waitKey(50);
              if (chKey == 27)
                      break;
              nFrameCount++;
      }
      convertScaleAbs(sumImage, sumImage, 1.0 / nFrameCount);
      imwrite("ballBkg.jpg", sumImage);
      destroyAllWindows();
      return 0;
  }
  </code></pre>
  
  <p>nothing wrong to compile but wrong to excute</p>
  
  <p>i did also try, catch</p>
  
  <p>but also failed</p>
  
  <p>what's wrong with accumulate?</p>