title: Qt + OpenCV - Displaying images on QLabel
body: <p>I'm trying to capture live view from camera, and redirecting it to show up on QLabel.
  But only half view comes (see below):
  <img src="https://i.stack.imgur.com/n8xDJ.png" alt="Screenshot"></p>
  
  <p>The left hand side window, is shown using cv::imshow(), which works perfectly.
  I'm capturing the Mat in a different thread, and then emitting a signal with a Qimage as a parameter, and then setting the image to the QLabel in the slot.</p>
  
  <p>here's the code:</p>
  
  <pre><code>while(true){
      cam &gt;&gt; mat;
      cv::imshow("name",mat);
      emit send_UIupdate(mat2qimage(mat));
  }
  </code></pre>
  
  <p>and in the slot setting the image to Qlabel:</p>
  
  <pre><code>void Dialog::updateUI(const QImage &amp;img){
      label-&gt;setPixmap(QPixmap::fromImage(img));
  }
  </code></pre>
  
  <p>using the below to convert Mat to QImage:</p>
  
  <pre><code>QImage camera::mat2qimage(const cv::Mat&amp; mat) {
      cv::Mat rgb;
      cv::cvtColor(mat, rgb, CV_BGR2RGB);
      return QImage((const unsigned char*)(rgb.data), rgb.cols, rgb.rows, QImage::Format_RGB888);
  }
  </code></pre>
  
  <p><strong>Any suggestions, to solve this problem ??</strong></p>