title: OpenCv and vectors to convert picture to YUV and then reverse it back
body: <p>I have a problem using openCV, I need to split picture into vector to YUV color scheme and then reverse it back, I'm new in this stuff and i don't know how to solve my problem and also I couldn't find any solution. The problem is that after changing it from YUV back into basic, the basic picture is different from the one i had at the beginning of the process(and they should look the same), it looks like maybe color component is missing or something. Can anyone help me solve my problem?  </p>
  
  <pre><code>#include &lt;QCoreApplication&gt;
  #include &lt;iostream&gt;
  #include "opencv2/opencv.hpp"
  #include "opencv2/core/core.hpp"
  #include "opencv2/highgui/highgui.hpp"
  #include "opencv2/imgproc/imgproc.hpp"
  
  using namespace cv;
  using namespace std;
  
  
  int main(int argc, char *argv[])
  {
      QCoreApplication a(argc, argv);
  
      //reading picture from pc and importing it into Mat variable
      Mat zdjecie, zdjeciePoZmianie, zdjecieOdwr, pom, zdjMerge;
  
      //zdjecie variable - have basic picture in it
      //zdjeciePoZmianie - new picture after converting to YUV and spliting it
      //zdjecieOdwr - to inverse the process to have basic picture from YUV pic
      //zdjMerge - variable when i merged vector into
  
      zdjecie=imread("/home/major/Downloads/Dan.jpg",CV_LOAD_IMAGE_COLOR);
      imshow("pic before operations",zdjecie);
  
      //Separating picture components
      vector&lt;Mat&gt; vec1, vec2;
      cvtColor(zdjecie, zdjeciePoZmianie, CV_BGR2YUV);
      split(zdjeciePoZmianie,vec1);
  
      pom=Mat::zeros(Size(zdjeciePoZmianie.cols, zdjeciePoZmianie.rows),CV_8UC1);
      vec2.push_back(vec1[0]);
      vec2.push_back(vec1[1]);
      vec2.push_back(vec1[2]);
  
      merge(vec2,zdjMerge);
  
      imshow("after changing to YUV", zdjMerge);
  
      //Reversing to the basic pic
      cvtColor(zdjeciePoZmianie, zdjecieOdwr, CV_BGR2YUV);
      imshow("Reversed back", zdjecieOdwr);
      return a.exec();
  }
  </code></pre>
  
  <p>This is how it looks YUV to normal</p>
  
  <p><img src="https://i.stack.imgur.com/yNfGp.png" alt=""></p>