title: Error when using Hough OpenCV
body: <p>If I don't do anything (that is, don't change the color detection HSV via a Controls Window), the app runs fine. However if I change the HSV values when the app is running, I get the following errors. I have tested the code without Hough, it runs fine.</p>
  
  <p>The CPU Error -</p>
  
  <blockquote>
    <p>Unhandled exception at 0x00007FF9ECA64388 (ucrtbase.dll) in HoughFinder.exe: An invalid parameter was passed to a function that considers invalid parameters fatal.</p>
  </blockquote>
  
  <p>This is my code -</p>
  
  <pre><code>VideoCapture capture(0); // 0 is my webcam
  
  ...
  
  capture.read(displayOriginal))
  ...(Code to detect colors for extra accuracy)
  cudaCanny-&gt;detect(imgThresholded, imgCanny);
  
  vector&lt;Vec2f&gt; lines;
  //Ptr&lt;HoughLinesDetector&gt; hough = createHoughLinesDetector(1, CV_PI / 180, 100); CUDA code...
  //hough-&gt;detect(imgCanny, lines); CUDA code...
  HoughLines(displayCanny, lines, 1, CV_PI / 180, 100, 0, 0); // CPU code...
      for (size_t i = 0; i &lt; lines.size(); i++)
      {
          float rho = lines[i][0], theta = lines[i][1];
          Point pt1, pt2;
          double a = cos(theta), b = sin(theta);
          double x0 = a*rho, y0 = b*rho;
          pt1.x = cvRound(x0 + 1000 * (-b));
          pt1.y = cvRound(y0 + 1000 * (a));
          pt2.x = cvRound(x0 - 1000 * (-b));
          pt2.y = cvRound(y0 - 1000 * (a));
          line(displayHough, pt1, pt2, Scalar(0, 0, 255), 3, CV_AA);
      }
  
  imshow("Hough", displayHough);
  imshow("Live Video", displayOriginal);
  </code></pre>
  
  <p><strong>Extra Info -</strong></p>
  
  <p>If I use CUDA code to use Hough, I get this error -</p>
  
  <blockquote>
    <p>Unhandled exception at 0x00007FF9F561A1C8 in HoughFinder.exe: Microsoft C++ exception: cv::Exception at memory location 0x000000A75E81EB70.</p>
  </blockquote>
  
  <p>App Error (Don't get this error while using CPU code) -</p>
  
  <blockquote>
    <p>OpenCV Error: Assertion failed (d == 2 &amp;&amp; (sizes[0] == 1 || sizes[1] == 1 || sizes[0]*sizes[1] == 0)) in cv::_OutputArray::create, file OPENCV_DIR\opencv-sources\modules\core\src\matrix.cpp, line 2363</p>
  </blockquote>
  
  <p>Can anyone help? If either the CPU or CUDA code is fixed, its fine, but I would more prefer the CUDA error to be fixed (As CUDA has extra speed).</p>