<h5 dir="auto">System information (version)</h5>
<p dir="auto">OpenCV =&gt; 4.2.5<br>
Operating System / Platform =&gt; Android 10<br>
Compiler =&gt; Visual Studio 2019 / Android Studio</p>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">When running a "DetectTextRectangles" from a "TextDetectionModel_EAST"<br>
it throws the exception:<br>
Org.Opencv.Core.CvException: 'cv::Exception: OpenCV(4.5.2) /build/master_pack-android/opencv/modules/dnn/src/model.cpp:96: error: (-201:Incorrect size of input array) Input size not specified in function 'processFrame'</p>
<h5 dir="auto">Steps to reproduce</h5>
<p dir="auto">NB: The code might look a bit weird as it is c# in a Xamarin.Android project.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="            TextDetectionModel_EAST detector = new TextDetectionModel_EAST(EastTextDetectionPath);
            detector.SetInputSize(640, 640);
            detector.DetectTextRectangles(img, textboxesMat);"><pre lang="MatOfRotatedRect" class="notranslate"><code class="notranslate">            TextDetectionModel_EAST detector = new TextDetectionModel_EAST(EastTextDetectionPath);
            detector.SetInputSize(640, 640);
            detector.DetectTextRectangles(img, textboxesMat);
</code></pre></div>
<p dir="auto">or</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="            TextDetectionModel_EAST detector = new TextDetectionModel_EAST(EastTextDetectionPath);
            Size siz = new Size(640, 640);
            detector.SetInputParams(1.0, siz);
            detector.DetectTextRectangles(img, textboxesMat);"><pre lang="MatOfRotatedRect" class="notranslate"><code class="notranslate">            TextDetectionModel_EAST detector = new TextDetectionModel_EAST(EastTextDetectionPath);
            Size siz = new Size(640, 640);
            detector.SetInputParams(1.0, siz);
            detector.DetectTextRectangles(img, textboxesMat);
</code></pre></div>
<p dir="auto">if you do it "the hard way" it works</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="            float nmsThresh = 0.4f;
            Size siz = new Size(640, 640);
            Net net = Dnn.ReadNetFromTensorflow(EastTextDetectionPath);

            Mat blob = Dnn.BlobFromImage(img, 1.0, siz);

            net.SetInput(blob);

            JavaList&lt;Mat&gt; outs = new JavaList&lt;Mat&gt;();
            JavaList&lt;string&gt; outNames = new JavaList&lt;string&gt;();
            outNames.Add(&quot;feature_fusion/Conv_7/Sigmoid&quot;);
            outNames.Add(&quot;feature_fusion/concat_3&quot;);
            net.Forward(outs, outNames);"><pre lang="float" class="notranslate"><code class="notranslate">            float nmsThresh = 0.4f;
            Size siz = new Size(640, 640);
            Net net = Dnn.ReadNetFromTensorflow(EastTextDetectionPath);

            Mat blob = Dnn.BlobFromImage(img, 1.0, siz);

            net.SetInput(blob);

            JavaList&lt;Mat&gt; outs = new JavaList&lt;Mat&gt;();
            JavaList&lt;string&gt; outNames = new JavaList&lt;string&gt;();
            outNames.Add("feature_fusion/Conv_7/Sigmoid");
            outNames.Add("feature_fusion/concat_3");
            net.Forward(outs, outNames);
</code></pre></div>
<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 4.5.2</li>
<li>Operating System / Platform =&gt; Windows 64 Bit:</li>
<li>Compiler =&gt; Visual Studio 2017</li>
</ul>
<h5 dir="auto">Detailed description</h5>

<p dir="auto">java app crash when calling init(Mat image, Rect boundingBox) method of video module Tracker.java.</p>
<p dir="auto">The following code is generated by gen_java.py.<br>
<strong>java_bindings_generator\gen\cpp\video.inl.hpp</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="//
//  void cv::Tracker::init(Mat image, Rect boundingBox)
//

JNIEXPORT void JNICALL Java_org_opencv_video_Tracker_init_10 (JNIEnv*, jclass, jlong, jlong, jint, jint, jint, jint);

JNIEXPORT void JNICALL Java_org_opencv_video_Tracker_init_10
  (JNIEnv* env, jclass , jlong self, jlong image_nativeObj, jint boundingBox_x, jint boundingBox_y, jint boundingBox_width, jint boundingBox_height)
{
    
    static const char method_name[] = &quot;video::init_10()&quot;;
    try {
        LOGD(&quot;%s&quot;, method_name);
        cv::Tracker* me = (cv::Tracker*) self; //TODO: check for NULL
        Mat&amp; image = *((Mat*)image_nativeObj);
        Rect boundingBox(boundingBox_x, boundingBox_y, boundingBox_width, boundingBox_height);
        me-&gt;init( image, boundingBox );
    } catch(const std::exception &amp;e) {
        throwJavaException(env, &amp;e, method_name);
    } catch (...) {
        throwJavaException(env, 0, method_name);
    }
}"><pre class="notranslate"><code class="notranslate">//
//  void cv::Tracker::init(Mat image, Rect boundingBox)
//

JNIEXPORT void JNICALL Java_org_opencv_video_Tracker_init_10 (JNIEnv*, jclass, jlong, jlong, jint, jint, jint, jint);

JNIEXPORT void JNICALL Java_org_opencv_video_Tracker_init_10
  (JNIEnv* env, jclass , jlong self, jlong image_nativeObj, jint boundingBox_x, jint boundingBox_y, jint boundingBox_width, jint boundingBox_height)
{
    
    static const char method_name[] = "video::init_10()";
    try {
        LOGD("%s", method_name);
        cv::Tracker* me = (cv::Tracker*) self; //TODO: check for NULL
        Mat&amp; image = *((Mat*)image_nativeObj);
        Rect boundingBox(boundingBox_x, boundingBox_y, boundingBox_width, boundingBox_height);
        me-&gt;init( image, boundingBox );
    } catch(const std::exception &amp;e) {
        throwJavaException(env, &amp;e, method_name);
    } catch (...) {
        throwJavaException(env, 0, method_name);
    }
}
</code></pre></div>
<p dir="auto">When I change the code generated by gen_java.py to the following, it works fine. <code class="notranslate">cv::Tracker* -&gt; Ptr&lt;cv::Tracker&gt;*</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="//
//  void cv::Tracker::init(Mat image, Rect boundingBox)
//

JNIEXPORT void JNICALL Java_org_opencv_video_Tracker_init_10 (JNIEnv*, jclass, jlong, jlong, jint, jint, jint, jint);

JNIEXPORT void JNICALL Java_org_opencv_video_Tracker_init_10
  (JNIEnv* env, jclass , jlong self, jlong image_nativeObj, jint boundingBox_x, jint boundingBox_y, jint boundingBox_width, jint boundingBox_height)
{
    
    static const char method_name[] = &quot;video::init_10()&quot;;
    try {
        LOGD(&quot;%s&quot;, method_name);
        Ptr&lt;cv::Tracker&gt;* me = (Ptr&lt;cv::Tracker&gt;*) self; //TODO: check for NULL
        Mat&amp; image = *((Mat*)image_nativeObj);
        Rect boundingBox(boundingBox_x, boundingBox_y, boundingBox_width, boundingBox_height);
        (*me)-&gt;init( image, boundingBox );
    } catch(const std::exception &amp;e) {
        throwJavaException(env, &amp;e, method_name);
    } catch (...) {
        throwJavaException(env, 0, method_name);
    }
}"><pre class="notranslate"><code class="notranslate">//
//  void cv::Tracker::init(Mat image, Rect boundingBox)
//

JNIEXPORT void JNICALL Java_org_opencv_video_Tracker_init_10 (JNIEnv*, jclass, jlong, jlong, jint, jint, jint, jint);

JNIEXPORT void JNICALL Java_org_opencv_video_Tracker_init_10
  (JNIEnv* env, jclass , jlong self, jlong image_nativeObj, jint boundingBox_x, jint boundingBox_y, jint boundingBox_width, jint boundingBox_height)
{
    
    static const char method_name[] = "video::init_10()";
    try {
        LOGD("%s", method_name);
        Ptr&lt;cv::Tracker&gt;* me = (Ptr&lt;cv::Tracker&gt;*) self; //TODO: check for NULL
        Mat&amp; image = *((Mat*)image_nativeObj);
        Rect boundingBox(boundingBox_x, boundingBox_y, boundingBox_width, boundingBox_height);
        (*me)-&gt;init( image, boundingBox );
    } catch(const std::exception &amp;e) {
        throwJavaException(env, &amp;e, method_name);
    } catch (...) {
        throwJavaException(env, 0, method_name);
    }
}
</code></pre></div>
<h5 dir="auto">Steps to reproduce</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Tracker tracker = TrackerMIL.create();
tracker.init( mat, rect);"><pre class="notranslate"><code class="notranslate">Tracker tracker = TrackerMIL.create();
tracker.init( mat, rect);
</code></pre></div>
<h5 dir="auto">Issue submission checklist</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I report the issue, it's not a question

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I checked the problem with documentation, FAQ, open issues,<br>
forum.opencv.org, Stack Overflow, etc and have not found solution

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I updated to latest OpenCV version and the issue is still there

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> There is reproducer code and related data files: videos, images, onnx, etc

</li>
</ul>