title: Draw rect over camera preview
body: <p>I have a camera preview where i get every frame, for each frame i analyze the objects inside and i have a list that contain every object recognized and the location, so i have already the locations for every single object. Now i want to draw a rect around that object on camera preview, but doing canvas.drawRect doesn't work, any suggestion?</p>
  <pre><code>                for (final Detector.Recognition result : results) {
                  final RectF location = result.getLocation();
                  if (location != null &amp;&amp; result.getConfidence() &gt;= 0.1) {
                      result.setLocation(location);
                      mappedRecognitions.add(result);
                      Log.d(&quot;OBJECT: &quot;, result.getTitle());
  
                      final Paint paint = new Paint();
                      paint.setColor(Color.RED);
                      paint.setStyle(Paint.Style.STROKE);
                      paint.setStrokeWidth(2.0f);
                      canvas_crop.drawRect(location, paint);
                      cropToFrameTransform.mapRect(location);
                  }
              }
  </code></pre>
  <p>This is the layout XML</p>
  <pre><code>&lt;androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
  xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
  xmlns:tools=&quot;http://schemas.android.com/tools&quot;
  android:layout_width=&quot;match_parent&quot;
  android:layout_height=&quot;match_parent&quot;
  tools:context=&quot;.MainActivity&quot;&gt;
  
  &lt;RelativeLayout
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:background=&quot;@android:color/black&quot;
      android:orientation=&quot;vertical&quot;&gt;
  
  
      &lt;FrameLayout
          android:id=&quot;@+id/container&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;&gt;
  
      &lt;/FrameLayout&gt;
  
      &lt;com.otaliastudios.cameraview.CameraView
          android:id=&quot;@+id/cameraView&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;/&gt;
  &lt;/RelativeLayout&gt;
  
  
  &lt;/androidx.coordinatorlayout.widget.CoordinatorLayout&gt;
  </code></pre>