error when i using cv::merge
<p>I am getting following error while using <code>cv::merge()</code> statement to merge two images:</p>

<blockquote>
  <p>OpenCV Error: Assertion failed (mv[i].size == mv[0].size &amp;&amp; mv[i].depth() == depth) in merge, file /home/yasin/ProgramFile/opencv-3.0.0/modules/core/src/convert.cpp, line 950
      terminate called after throwing an instance of 'cv::Exception'
       what():  /home/yasin/ProgramFile/opencv-3.0.0/modules/core/src/convert.cpp:950: error: (-215) mv[i].size == mv[0].size &amp;&amp; mv[i].depth() == depth in function merge</p>
</blockquote>

<p>I tried to solve this problem by searching and using some methods but my effort was not useful.</p>

<p>My methods are:</p>

<pre><code>void TakeDFT(cv::Mat&amp;source,cv::Mat&amp;DFTofSource){
    cv::Mat OriginalFloat;
    OriginalFloat.convertTo(source,CV_32FC1,1.0/255.0);
    cv::Mat OriginalComplex[2] = {
        OriginalFloat,cv::Mat::zeros(OriginalFloat.size(),CV_32F)
    };
    cv::Mat dftready;
    dftready.convertTo(dftready,CV_32F);
    cv::merge(OriginalComplex,2,dftready);
    cv::dft(dftready,DFTofSource,cv::DFT_COMPLEX_OUTPUT);
}
</code></pre>

<p>and:</p>

<pre><code>void TakeDFT(cv::Mat&amp;source,cv::Mat&amp;DFTofSource){
    cv::Mat OriginalFloat;
    OriginalFloat.convertTo(source,CV_32FC1,1.0/255.0);
    cv::Mat OriginalComplex[2] = {
        OriginalFloat,cv::Mat::zeros(OriginalFloat.size(),CV_32F)
    };
    cv::Mat dftready;
    dftready.convertTo(dftready,CV_32F);
    std::vector&lt;cv::Mat&gt;array_to_merge;
    array_to_merge.push_back(OriginalComplex[0]);
    array_to_merge.push_back(OriginalComplex[1]);
    cv::merge(array_to_merge,dftready);
    cv::dft(dftready,DFTofSource,cv::DFT_COMPLEX_OUTPUT);
}
</code></pre>

<p>I'm a beginner in opencv and confused.
can anyone help me?</p>