title: How to use cv::Mat and Eigen::Matrix correctly? (OpenCV + Eigen)
body: <p>I am able to convert an OpenCV mat object to an Eigen object, and back. However when I try to display the Eigen->Mat on the screen I get a blank window, and I do not know why. I can save the image to a file so I know its converting correctly. </p>
  
  <p>Any suggestions on how to get the converted image to display on the screen?</p>
  
  <p>Here is my current code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;opencv2/opencv.hpp&gt;
  #include &lt;Eigen/Dense&gt;
  #include &lt;opencv2/core/eigen.hpp&gt;
  
  
  int main(int argc, char **argv) {
      if ( argc != 2 )
      {
          printf("usage: DisplayImage.out &lt;Image_Path&gt;\n");
          return -1;
      }
      cv::Mat image;
  
      image = cv::imread( argv[1], cv::ImreadModes::IMREAD_GRAYSCALE);
      if ( !image.data )
      {
          printf("No image data \n");
          return -1;
      }
      cv::namedWindow("Display Image", cv::WINDOW_AUTOSIZE );
      cv::imshow("Display Image", image);
      cv::waitKey(0);
      Eigen::MatrixXd eigen_matrix;
      cv::cv2eigen(image, eigen_matrix);
  
      // std::cout &lt;&lt; eigen_matrix &lt;&lt; std::endl;
  
      cv::Mat test_image;
      cv::eigen2cv(eigen_matrix, test_image);
      // This is blank
      cv::namedWindow("Display Image2", cv::WINDOW_AUTOSIZE );
      cv::imshow("Display Image2", test_image);
      cv::waitKey(0);
      cv::imwrite("test.png", test_image);
      return 0;
  }
  </code></pre>