title: Google mobile vision text API- read specific text with in a recatangle
body: <p>I am using Google mobile vision text API for reading a text using the APIs provided.</p>
  
  <p>My use cases  :</p>
  
  <p>Initially i am drawing a re-sizable  rectangle to the surface of view.
  Restrict the text that recognize by the google apis only with in the rectangle.</p>
  
  <pre><code>public class GraphicOverlay&lt;T extends GraphicOverlay.Graphic&gt; extends View 
  {
  
      protected void onDraw(Canvas canvas) 
          {
               super.onDraw(canvas);
              synchronized (mLock) 
          {
  
              if ((mPreviewWidth != 0) &amp;&amp; (mPreviewHeight != 0)) 
          {        
                  mWidthScaleFactor = (float) canvas.getWidth() / (float)     mPreviewWidth;
                      mHeightScaleFactor = (float) canvas.getHeight() / (float) mPreviewHeight;
              }
  
              for (Graphic graphic : mGraphics) 
          {
                  graphic.draw(canvas);
              }
  
              paint.setColor(Color.parseColor("#55000000"));
              paint.setStyle(Paint.Style.FILL);
              paint.setStrokeJoin(Paint.Join.ROUND);
              // mPaint.setStrokeCap(Paint.Cap.ROUND);
              paint.setStrokeWidth(5);
  
              canvas.drawPaint(paint);
              paint.setColor(Color.parseColor("#55FFFFFF"));
  
              if (groupId == 1) {
                  mCurrentRect= new Rect(point2.x+colorballs.get(1).getWidthOfBall() / 2,
                                          point4.y +colorballs.get(1).getWidthOfBall() / 2,
                                          point4.x+colorballs.get(1).getWidthOfBall() / 2,
                                          point2.y+colorballs.get(1).getWidthOfBall() / 2);
                  canvas.drawRect(mCurrentRect, paint);
              } else {
                  mCurrentRect= new Rect(point2.x + colorballs.get(1).getWidthOfBall() / 2,
                          point4.y + colorballs.get(3).getWidthOfBall() / 2, point4.x
                          + colorballs.get(3).getWidthOfBall() / 2, point2.y
                          + colorballs.get(1).getWidthOfBall() / 2);
                  canvas.drawRect(mCurrentRect, paint);
              }
              BitmapDrawable mBitmap;
              mBitmap = new BitmapDrawable();
  
              // draw the balls on the canvas`enter code here`
              for (ColorBall ball : colorballs) {
                  canvas.drawBitmap(ball.getBitmap(), ball.getX(), ball.getY(),
                          new Paint());
              }
          }
      }
  }
  
  
  
  class CustomTextRecognizer extends Detector&lt;TextBlock&gt; {
      private Detector&lt;TextBlock&gt; mDelegate;
      private GraphicOverlay&lt;OcrGraphic&gt; mOcrGraphicOverlay;
  
      CustomTextRecognizer(Detector&lt;TextBlock&gt; delegate, GraphicOverlay&lt;OcrGraphic&gt; ocrGraphicOverlay) {
          mDelegate = delegate;
          mOcrGraphicOverlay= ocrGraphicOverlay;
      }
  
      @Override
      public void receiveFrame(Frame frame) {
          Bitmap bt= frame.getBitmap();
          super.receiveFrame(frame);
      }
  
  
      public SparseArray&lt;TextBlock&gt; detect(Frame frame) {
  
       //How to compare the items that is inside my rectangle.
      }
   }
  </code></pre>