OpenCv Aruco marker is not detected when i parse the Mat directly
<p>Hope you can help me out. I try to use Aruco marker for finding the corners of an Window. So added an marker to each corner. But when i tried to detected the marker they don't get found. If it take a photo with an smartphone and then try to detect the marker on the Photo it works. Here is a minimum working Code example:</p>

<pre><code>#include &lt;opencv2/opencv.hpp&gt;
#include &lt;stdlib.h&gt;
#include &lt;string&gt; 
#include &lt;opencv2/aruco.hpp&gt;
using namespace cv;
using namespace std;
using namespace aruco;

Dictionary dictionary;
int markerSize = 200;
vector&lt;int&gt; ids;
vector&lt; vector&lt;Point2f&gt; &gt; corners;


Mat addMarkertoImage(const Mat image){
    Mat retImage, marker0;
    image.copyTo(retImage);
    drawMarker(dictionary, 0, markerSize, marker0, 1);

    unsigned char value;

    //Add marker to top left corner
    for(int i = 0; i&lt;marker0.rows; i++)
      for(int j = 0; j&lt;marker0.cols; j++){
        value = marker0.at&lt;uchar&gt;(i,j);
        Vec3b colorValue = Vec3b(value, value, value);
        retImage.at&lt;Vec3b&gt;(i,j) = colorValue;} 
 return retImage;
 }


int main(){
        Mat image, image_marker;
dictionary = getPredefinedDictionary(cv::aruco::DICT_6X6_250); 
image = imread( "bild.jpg", 1 );
image_marker = addMarkertoImage(image);
detectMarkers(image_marker, dictionary, corners, ids);
drawDetectedMarkers(image_marker, corners, ids);
    imshow("Display Image", image_marker);
  waitKey(0);
  return 0;
}
</code></pre>

<p>Any Ideas, why this does not work? But with an Photo taken by my iPhone camera is working?</p>